Run tasks via the API
A task is a stateless, versioned AI function. Run it by POSTing to its /run endpoint. The request carries your inputs; the response carries the structured output plus token, timing, and credit metrics.
All requests use bearer authentication — see Authentication.
Request body
Send a JSON body with a single task_input object. Its keys match the {placeholder} variables in the task’s prompt.
The field is task_input, not input_params. A request without task_input fails validation.
Attach files
Tasks that accept image, PDF, or other file inputs take files in one of two ways. Whether a task accepts files, and which types, is set by its file_input_mode (none, image, pdf, image_or_pdf, or any).
Base64 in JSON
Multipart form data
Add a task_files array alongside task_input. Each entry has base64 content and a filename.
Query parameters
If neither revision_id nor revision_tag is given, Rightbrain selects an active revision by its configured traffic weights (this is how A/B tests are served). See Versioning & revisions.
Response
A successful run returns the task run object. Your model output is in response; everything else is metadata.
Response headers
Every run response includes:
x-task-run-id— the ID of this run.x-task-revision-id— the revision that served it.
List and fetch runs
List responses are paginated — see Errors & pagination. Uploaded files and generated files appear in files. For image, audio, PDF, or CSV output tasks, the generated output also has a response.download_url.
download_url is a path starting with /org/. Append it to https://app.rightbrain.ai/api/v1 and send the same Bearer authentication as the run request. It is not a public or signed URL. Resolving its leading slash against the host would drop /api/v1 and reach the wrong route. Missing or invalid authentication returns 401.
Alternatively, construct the file endpoint from the run ID and a stored_filename: