SnozeDevelopers
API referenceAi

Run an AI generator and return its structured result

Runs the named generator as a single non-streaming model call with a schema-constrained output, allowing one repair attempt when the model misses the schema, and returns the decoded result with token usage. Requires a workspace member with the `ai:write` permission, and the call consumes the workspace AI allowance: a workspace that has reached its limit is refused before the model is called. Send an `Idempotency-Key` header to make retries safe; a replay within the window returns the original response.

POST
/v1/workspaces/{workspaceId}/ai/generate

Authorization

apiKey
headerAuthorizationBearer <snoze_sk_…>

Workspace API key created in Workspace settings → API keys. Scopes on the key bound what it can read and write.

Path Parameters

workspaceId*string

Request Body

application/json
  1. body
generator*string
input*unknown
options?|null

Response Body

Success

application/json
  1. response
data*
Example Request
curl -X POST 'https://api.snoze.dev/v1/workspaces/string/ai/generate' \  -H 'Content-Type: application/json' \  -d '{  "generator": "string",  "input": null}'
Example Response
{  "data": {    "runId": "string",    "generator": "string",    "output": null,    "diagnostics": [      {        "severity": "info",        "code": "string",        "message": "string",        "path": "string"      }    ],    "usage": {      "inputTokens": 0,      "outputTokens": 0,      "cachedInputTokens": 0,      "cacheWriteInputTokens": 0,      "model": "string"    }  }}