Run Task
Run a task with the specified inputs and receive structured output.
This endpoint executes the task using its active revision(s) and returns the results. Key features:
- Automatic revision selection based on traffic weights
- Structured output matching the task’s output modality:
json: Structured JSON responsesimage: Generated image files (PNG, JPEG)audio: Generated audio filespdf: Formatted PDF documentstext: Plain text responsescsv: CSV data files
- Execution metadata (tokens, timing, credits charged)
- Support for file uploads when required
- Automatic fallback to backup model on primary model failures
- Optional manual fallback model triggering
- Reporting group tracking for analytics and billing
Request Body:
⚠️ IMPORTANT: The request body must use the task_input field (not input_params):
The keys in task_input should match the {variable} placeholders defined in your task’s user_prompt. For example, if your prompt contains {text} and {language}, your request should be:
Required:
task_inputobject with parameters matching the task’s prompt variables- File upload when task
file_input_modeis notnone
Optional Body Fields:
task_referenceto attach your own tracking ID to this runtask_filesfor base64-encoded file uploads
Optional Query Parameters:
revision_idorrevision_tagfor testing or comparisonreporting_groupname for segmented analyticsuse_fallback_modelflag to manually trigger fallback
The response includes:
- Structured output matching the task’s output_format
- Execution metadata (tokens used, timing, credits charged)
- Fallback model usage information if applicable
- Input data for audit purposes
- References to any processed files
Common Use Cases:
A/B Testing Revisions:
Compare different prompt versions by explicitly specifying revision_id or revision_tag for each request, then analyze results.
Gradual Rollouts: Configure traffic weights on revisions to gradually shift traffic from an old prompt to a new one while monitoring performance.
Fallback Model Strategy:
Use use_fallback_model=true to manually switch to the backup model during known primary model outages or rate limits.
Analytics Segmentation:
Pass reporting_group to track metrics by customer, feature, or experiment cohort for billing and performance analysis.
Authentication
API key or access token, sent as Authorization: Bearer <token>. The simplest option: create an API key in your dashboard under Settings, then paste it here.
API key or access token, sent as Authorization: Bearer <token>. The simplest option: create an API key in your dashboard under Settings, then paste it here.
Path parameters
Query parameters
Request
Key-value pairs mapping variable names to their values. Keys must match the variable placeholders in your task’s user_prompt.
Optional base64-encoded files to include with the task run
Response headers
Response
Additional data about the Task execution, including submitted inputs. submitted is absent on runs that failed before their input was recorded, so the object can be empty.
Surface-specific source identifier for correlating this run.