Submit an API trigger (unversioned)
const url = 'https://api.gopromptless.ai/triggers';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"instructions":"Document the new rate limiting feature added in v2.5","context":{"jira_ticket":"DOC-456","release":"v2.5.0"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.gopromptless.ai/triggers \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "instructions": "Document the new rate limiting feature added in v2.5", "context": { "jira_ticket": "DOC-456", "release": "v2.5.0" } }'Request a documentation update. Authenticate with your organization’s API key as a bearer token. A successful request returns the identifier of the trigger event.
POST /triggers and POST /v1/triggers are the same operation, served by one handler and one idempotency scope.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Optional key of up to 255 characters that makes the submission idempotent within your organization. A repeat submission that reuses a key already accepted returns the original trigger_event_id with deduplicated set to true instead of creating a new trigger event.
Request Bodyrequired
Section titled “Request Bodyrequired”JSON request body for API-triggered task intake.
object
What you want Promptless to document. Be specific about which docs to update and what changes to make.
Optional arbitrary metadata to attach to the request. Appears in trigger history for reference and is passed through to the workflow as additional context.
object
Responses
Section titled “Responses”The trigger was accepted and enqueued for processing.
Response body returned when an API trigger is accepted for processing.
object
Identifier of the trigger event. Use it to correlate with trigger history.
True when an Idempotency-Key matched an earlier submission, so this response replays that trigger event instead of creating a new one.
Example
{ "trigger_event_id": "550e8400-e29b-41d4-a716-446655440000", "deduplicated": false}The Idempotency-Key header is blank or longer than 255 characters (invalid_idempotency_key).
Error body returned when an API trigger request is rejected.
object
Stable machine-readable error code.
Human-readable explanation of the error.
Example
{ "error": "authentication_failed", "message": "Authentication failed."}The API key is missing, invalid, or revoked.
Error body returned when an API trigger request is rejected.
object
Stable machine-readable error code.
Human-readable explanation of the error.
Example
{ "error": "authentication_failed", "message": "Authentication failed."}The organization has not finished setting up Promptless (org_not_configured), or no configured doc collection is eligible to receive the request (no_eligible_doc_collection).
Error body returned when an API trigger request is rejected.
object
Stable machine-readable error code.
Human-readable explanation of the error.
Example
{ "error": "authentication_failed", "message": "Authentication failed."}The request body is invalid (e.g. empty instructions).
Validation error body returned when the request fails schema validation.
object
object
Examplegenerated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ]}The trigger could not be enqueued for processing (enqueue_failed).
Error body returned when an API trigger request is rejected.
object
Stable machine-readable error code.
Human-readable explanation of the error.
Example
{ "error": "authentication_failed", "message": "Authentication failed."}Trigger intake is temporarily unavailable (runtime_store_unavailable).
Error body returned when an API trigger request is rejected.
object
Stable machine-readable error code.
Human-readable explanation of the error.
Example
{ "error": "authentication_failed", "message": "Authentication failed."}