Skip to navigation

Send a prompt to a project (project API key)

Queues a prompt exactly as if the key’s creator typed it in the app. Needs a PROJECT key (Project settings → API), which only works on its own project. Returns at once with the prompt’s id; poll its URL for the reply. Prompts from one key continue one conversation unless freshSession is true. Paid tools cannot be run this way.

A run may pause to ask a question (status paused_for_question); it then holds the project’s queue until it is answered with the prompt’s /answer call or cancelled. An unattended caller should send questions: "never", which tells the run to state its assumptions and carry on instead of asking. callbackUrl is POSTed the prompt’s view (plus event) when it pauses or finishes, so there is no need to poll; the callback carries no secret, so confirm anything that matters with a GET on the prompt.

Authentication

X-API-Keystring

Create one in the app under Settings → API keys. It is shown once and stored only as a hash, so it cannot be recovered — losing it means issuing a new one.

A key reads the endpoints below and nothing else. It is not a session: it cannot create or delete projects, change settings, or issue another API key. It sees exactly what its owner sees, re-checked on every request, so removing someone’s access to a project removes it from their key on the very next call.

OR
AuthorizationBearer

The same key, sent as Authorization: Bearer <key>.

Path parameters

projectIdintegerRequired

Request

This endpoint expects an object.
promptstringRequired<=20000 characters
callbackUrlstringOptionalformat: "uri"

Public https URL to POST when the prompt pauses on a question or finishes (events: paused_for_question, completed, error, cancelled).

freshSessionbooleanOptionalDefaults to false
Start a new conversation instead of continuing this key's.
questionsenumOptionalDefaults to ask

never: the run must not ask; it states assumptions instead.

Allowed values:

Response

Queued.
createdAtstringOptional
errorstring or nullOptional
finishedAtstring or nullOptional
idintegerOptional
positionintegerOptional
Prompts ahead of this one, while queued.
promptstringOptional
questionobject or nullOptional

Present while status is paused_for_question.

responsestringOptional
The reply, once it has started.
startedAtstring or nullOptional
statusenumOptional
summarystringOptional
urlstringOptional

Returned on POST: where to poll.

Errors

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
403
Forbidden Error
409
Conflict Error
422
Unprocessable Entity Error
429
Too Many Requests Error