docs.dev

Generate documentation or an image

POST
/api/admin/ai/generate

With kind: "doc" (the default), writes markdown for the editor to splice in as editable blocks — optionally grounded in web search results, which are cited inline. With kind: "image", returns a generated image as a data URL that the editor stores through the regular upload pipeline.

docsdev_admin<token>

Sealed (AES-256-GCM) session cookie issued by POST /api/admin/login or the GitHub OAuth callback.

In: cookie

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/admin/ai/generate" \  -H "Content-Type: application/json" \  -d '{    "prompt": "setting up webhooks"  }'
{  "ok": true,  "markdown": "string",  "sources": [    {      "title": "string",      "url": "string",      "snippet": "string"    }  ]}
{  "ok": false,  "error": "string"}
{  "ok": false,  "error": "string"}
{  "ok": false,  "error": "string"}