> This page is for version v1 (default).
> For other versions, use one of these documentation indexes:
> - v1 (default): https://docs.rightbrain.ai/v-1/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.rightbrain.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.rightbrain.ai/_mcp/server.

# Run Task

POST https://app.rightbrain.ai/api/v1/org/{org_id}/project/{project_id}/task/{task_id}/run
Content-Type: application/json

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:

1. Automatic revision selection based on traffic weights
2. Structured output matching the task's output modality:
   * `json`: Structured JSON responses
   * `image`: Generated image files (PNG, JPEG)
   * `audio`: Generated audio files
   * `pdf`: Formatted PDF documents
   * `text`: Plain text responses
   * `csv`: CSV data files
3. Execution metadata (tokens, timing, credits charged)
4. Support for file uploads when required
5. Automatic fallback to backup model on primary model failures
6. Optional manual fallback model triggering
7. Reporting group tracking for analytics and billing

**Request Body:**

⚠️ **IMPORTANT**: The request body must use the `task_input` field (not `input_params`):

```json
{
  "task_input": {
    "variable_name": "value to substitute in user_prompt"
  }
}
```

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:

```json
{
  "task_input": {
    "text": "Hello world",
    "language": "Spanish"
  }
}
```

**Required:**

* `task_input` object with parameters matching the task's prompt variables
* File upload when task `file_input_mode` is not `none`

**Optional Body Fields:**

* `task_reference` to attach your own tracking ID to this run
* `task_files` for base64-encoded file uploads

**Optional Query Parameters:**

* `revision_id` or `revision_tag` for testing or comparison
* `reporting_group` name for segmented analytics
* `use_fallback_model` flag 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.

Reference: https://docs.rightbrain.ai/api-reference/api-reference/tasks/tasks/run-task

## Authentication

- `Authorization` header (bearer token, required) — 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.

## Servers

- `https://app.rightbrain.ai/api/v1` (Production, default)
- `https://app.rightbrain.ai/api/v1` (Staging API)
- `https://app.rblocal.dev/api/v1` (Local development)

## Request

### Path parameters

- `org_id` (string, required) — The unique identifier of the organization.
- `project_id` (string, required) — The unique identifier of the project.
- `task_id` (string, required) — The specific Task to reference.

### Query parameters

- `revision_id` (string, optional, nullable) — Optional Task Revision ID to use for execution. If not provided, an active revision will be selected based on traffic weights.
- `revision_tag` (string, optional, nullable) — Optional Task Revision Tag to use for execution. If not provided, an active revision will be selected based on traffic weights.
- `reporting_group` (string, optional, nullable) — Optional reporting group name to associate with this task run
- `use_fallback_model` (boolean, optional, default: false) — If true, immediately use the fallback model instead of the primary model. Requires the task to have a fallback model configured.

### Body (application/json)

This endpoint expects an object.

- `task_input` (map from string to any, required) — Key-value pairs mapping variable names to their values. Keys must match the variable placeholders in your task's user_prompt.
- `task_files` (list of OrgOrgIdProjectProjectIdTaskTaskIdRunPostRequestBodyContentApplicationJsonSchemaTaskFilesItems, optional) — Optional base64-encoded files to include with the task run
- `task_reference` (string, optional) — Optional reference ID for tracking this task run

## Response

### 200

Task executed successfully

- `task_id` (string, required) — The unique identifier of the Task associated with this run.
- `task_revision_id` (string, required) — The unique identifier of the Task Revision associated with this run.
- `response` (TaskRunResponse, required) — The structured response from the Task execution.
- `run_data` (TaskRunRunData, required) — 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.
- `id` (string, required) — The unique identifier of the Task Run.
- `created` (string, required) — The timestamp when the Task Run was created.
- `input_tokens` (integer, required) — The number of tokens submit as input to the model.
- `output_tokens` (integer, required) — The number of tokens generated and output by the model.
- `total_tokens` (integer, required) — The total token usage for the TaskRun.
- `input_processor_timing` (double, required, nullable) — The execution time for the TaskRun in seconds.
- `llm_call_timing` (double, required, nullable) — The execution time for the TaskRun in seconds.
- `charged_credits` (string, required, nullable) — The total credits charged for the TaskRun.
- `model_name` (string, optional, nullable) — Name of the LLM model associated with the task revision used for this run.
- `task_name` (string, optional, nullable) — Name of the task associated with this run.
- `output_modality` (enum, optional, nullable) — Output modality configured on the associated task.
  - Allowed values: `json`, `image`, `audio`, `pdf`, `text`, `csv`
- `files` (list of TaskRunFileMetadata, optional, default: []) — List of file metadata objects with enriched information including download URLs.
- `is_error` (boolean, optional, default: false)
- `llm_retries` (integer, optional, default: 0) — Number of retry attempts made during LLM execution.
- `used_fallback_model` (boolean, optional, default: false) — Whether the fallback model was used
- `primary_failure_reason` (string, optional, nullable) — Reason the primary model failed
- `fallback_llm_model_id` (string, optional, nullable) — Fallback model that was used
- `user_id` (string, optional, nullable) — The unique identifier of the User who executed the task.
- `reporting_group_id` (string, optional, nullable) — The ID of the reporting group to associate with this task run
- `reference` (string, optional, nullable) — An optional reference identifier for this task run
- `context_id` (string, optional, nullable) — An optional context ID for grouping related task runs
- `actor_user_id` (string, optional, nullable) — User whose authority caused this run.
- `actor_basis` (string, optional, nullable) — Reason the run actor was trusted.
- `execution_surface` (enum, optional, nullable) — Platform surface through which execution entered.
  - Allowed values: `a2a`, `eval`, `gmail_inbox`, `internal_task_agent`, `internal_task_agent_approval_resume`, `mcp`, `schedule`, `slack`, `task_agent_api`, `task_agent_approval_resume`, `task_agent_task_tool`, `task_api`, `webhook`
- `execution_source_id` (string, optional, nullable) — Surface-specific source identifier for correlating this run.
- `rag_retrieval_timing` (double, optional, nullable) — The task RAG retrieval time in seconds.
- `rag_query_rewrite_input_tokens` (integer, optional, nullable) — Input tokens used by the task RAG query rewrite model.
- `rag_query_rewrite_output_tokens` (integer, optional, nullable) — Output tokens used by the task RAG query rewrite model.
- `rag_query_rewrite_total_tokens` (integer, optional, nullable) — Total tokens used by the task RAG query rewrite model.
- `mcp_tool_timing` (double, optional, nullable) — Total time spent waiting on MCP tool calls in seconds.
- `input_processor_charged_credits` (string, optional, nullable) — Credits charged for input processor work during this task run.
- `reporting_group` (ReportingGroup, optional, nullable) — The reporting group associated with this task run
- `event_trigger_id` (list of string, optional, nullable) — Webhook trigger event IDs associated with this TaskRun, if any.

## Errors

### 400 Bad Request Error

Bad Request - Invalid task input format **Common causes:** - Invalid UUID format in path or query parameters - Missing required fields in the request body - Invalid enum value provided - Type mismatch (e.g., string instead of number) **Resolution:** Check the request body and parameters match the schema.

- `detail` (ErrorResponseDetail, required) — A plain error message, a list of field-level validation errors, a service validation error, or a domain error object with `reason` and `message`.

### 401 Unauthorized Error

Unauthorized - Authentication failed **Common causes:** - Missing `Authorization` header - Expired access token - Invalid or malformed token - Using API key in wrong format **Resolution:** Ensure you're including a valid Bearer token or API key in the Authorization header.

- `detail` (ErrorResponseDetail, required) — A plain error message, a list of field-level validation errors, a service validation error, or a domain error object with `reason` and `message`.

### 402 Payment Required Error

Payment Required - the organization cannot execute tasks **Common causes:** - `No credits remaining` - the account's credit balance is exhausted - `Trial expired` - the trial period ended - `Subscription cancelled` - the subscription is cancelled, or is cancelling and past its end date - `Payment required - grace period expired` - payment failed and the grace period has passed **Resolution:** Top up credits or update the subscription, then retry the run.

- `detail` (ErrorResponseDetail, required) — A plain error message, a list of field-level validation errors, a service validation error, or a domain error object with `reason` and `message`.

### 403 Forbidden Error

Forbidden - Insufficient permissions for task **Common causes:** - Your role lacks the required permission for this action - The task belongs to a different organization or project - The action requires admin or owner privileges **Resolution:** Contact your organization admin to request appropriate access.

- `RunTaskRequestForbiddenError`
  - PermissionCheckFailedErrorResponse: PermissionCheckFailedErrorResponse
  - MissingAuthenticationErrorResponse: MissingAuthenticationErrorResponse

### 404 Not Found Error

Task or revision not found

- `detail` (ErrorResponseDetail, required) — A plain error message, a list of field-level validation errors, a service validation error, or a domain error object with `reason` and `message`.

### 422 Unprocessable Entity Error

Unprocessable Entity - Invalid task input parameters **Common causes:** - Request is well-formed but violates business rules - Invalid combination of fields (e.g., mutually exclusive options) - Referenced resource doesn't exist or is in wrong state - Field value is valid type but out of acceptable range **Resolution:** Check the error message for specific validation failures and adjust your request.

- `detail` (ErrorResponseDetail, required) — A plain error message, a list of field-level validation errors, a service validation error, or a domain error object with `reason` and `message`.

### 500 Internal Server Error

Internal Server Error - Failed to execute task

- `detail` (ErrorResponseDetail, required) — A plain error message, a list of field-level validation errors, a service validation error, or a domain error object with `reason` and `message`.

## Types

### OrgOrgIdProjectProjectIdTaskTaskIdRunPostRequestBodyContentApplicationJsonSchemaTaskFilesItems

- `filename` (string, optional)
- `content` (string, optional)

### TaskRunResponse

The structured response from the Task execution.

- string
- map from string to any

### TaskRunRunData

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.

- `submitted` (TaskRunRunDataSubmitted, optional) — The input parameters provided when executing the Task.

### TaskRunFileMetadata

Metadata for files submitted/generated during task execution.

- `original_filename` (string, required) — The original filename as submitted by the user
- `stored_filename` (string, required) — The generated filename used for storage
- `content_type` (string, required) — MIME type of the file
- `download_url` (string, optional, nullable) — Download path relative to https://app.rightbrain.ai/api/v1. Append the path to that API base URL and send Bearer authentication. The leading slash does not include the /api/v1 prefix.
- `size_bytes` (integer, optional, nullable) — File size in bytes (if available)

### ReportingGroup

Schema for reporting group responses.

- `name` (string, required) — Name of the reporting group
- `id` (string, required)
- `project_id` (string, required)
- `created` (string, required)
- `modified` (string, required)
- `description` (string, optional, nullable) — Optional description

### ErrorResponseDetail

A plain error message, a list of field-level validation errors, a service validation error, or a domain error object with `reason` and `message`.

- string
- list of ErrorResponseDetailOneOf1Items
- ErrorResponseDetail2
- ErrorResponseDetail3
- ErrorResponseDetail4

### PermissionCheckFailedErrorResponse

- `detail` (PermissionCheckFailedErrorPayload, required) — The error payload.

### MissingAuthenticationErrorResponse

- `detail` (MissingAuthenticationErrorPayload, required) — The error payload.

### TaskRunRunDataSubmitted

The input parameters provided when executing the Task.

### ErrorResponseDetailOneOf1Items

- `type` (string, required) — Error type identifier
- `loc` (list of ErrorResponseDetailOneOf1ItemsLocItems, optional) — Path to the error location. Integer segments index into a list.
- `msg` (string, optional) — Human-readable error message. Present on errors produced by FastAPI's own request validation.
- `message` (string, optional) — Human-readable error message. Used instead of `msg` by Rightbrain's own validators.

### ErrorResponseDetail2

Validation error returned by a service after request parsing, such as a Task clone dependency failure.

- `type` ("validation_error", required)
- `errors` (list of ErrorResponseDetailOneOf2ErrorsItems, required)

### ErrorResponseDetail3

Domain error raised via a brain.exc.BaseError subclass. The exact extra field name and shape vary by error type.

- `reason` (string, required) — Machine-readable, upper-snake-case error reason, e.g. RESOURCE_NOT_FOUND, PERMISSION_CHECK_FAILED, TAG_NAME_CONFLICT.
- `message` (string, required) — Human-readable error message

### ErrorResponseDetail4

Integration precondition failure. Uses `code` rather than `reason`, and carries no extra field. Raised by the Gmail trigger routes when the underlying integration is not authorized.

- `code` (string, required) — Machine-readable code, e.g. GMAIL_INTEGRATION_AUTH_REQUIRED.
- `message` (string, required) — Human-readable error message

### PermissionCheckFailedErrorPayload

- `message` (string, required) — Human readable representation of the error
- `reason` (enum, required) — The machine-readable error reason.
  - Allowed values: `PERMISSION_CHECK_FAILED`
- `permissionCheckFailedError` (PermissionCheckFailedErrorDetails, required) — Metadata detailing more information about the error.

### MissingAuthenticationErrorPayload

- `message` (string, required) — Human readable representation of the error
- `reason` (enum, required) — The machine-readable error reason.
  - Allowed values: `MISSING_AUTHENTICATION`
- `missingAuthenticationError` (EmptyErrorDetails, required) — Metadata detailing more information about the error.

### ErrorResponseDetailOneOf1ItemsLocItems

- string
- integer

### ErrorResponseDetailOneOf2ErrorsItems

- `type` (string, required) — Error type identifier
- `loc` (list of ErrorResponseDetailOneOf2ErrorsItemsLocItems, optional) — Path to the error location. Integer segments index into a list.
- `msg` (string, optional) — Human-readable error message. Present on errors produced by FastAPI's own request validation.
- `message` (string, optional) — Human-readable error message. Used instead of `msg` by Rightbrain's own validators.

### PermissionCheckFailedErrorDetails

- `permission` (string, required)
- `subject` (IAMObjectErrorDetails, optional, nullable)
- `resource` (IAMObjectErrorDetails, optional, nullable)

### EmptyErrorDetails

### ErrorResponseDetailOneOf2ErrorsItemsLocItems

- string
- integer

### IAMObjectErrorDetails

- `type` (string, required)
- `id` (string, optional, nullable)

## Examples

### Single ticket triage

**Request**

```json
{
  "task_input": {
    "body": "I was billed twice for my Pro subscription on the 3rd and the 5th. Please refund the duplicate charge.",
    "plan": "Pro",
    "subject": "Charged twice this month"
  }
}
```

**Response**

```json
{
  "task_id": "019f8a00-1c3d-7e42-b8f1-2a5c9d4e7b60",
  "task_revision_id": "019f8a01-4b3d-7e52-9c02-3b6d8f1a5c71",
  "response": {
    "category": "billing",
    "priority": "high",
    "summary": "Customer was double-charged for their Pro plan renewal and wants a refund."
  },
  "run_data": {
    "submitted": {
      "body": "I was billed twice for my Pro subscription on the 3rd and the 5th. Please refund the duplicate charge.",
      "plan": "Pro",
      "subject": "Charged twice this month"
    },
    "integration_tool_calls": [],
    "mcp_tool_calls": []
  },
  "id": "019f8a04-8e60-7b85-af37-6e9fb14d8fa4",
  "created": "2026-07-24T10:02:17Z",
  "input_tokens": 186,
  "output_tokens": 42,
  "total_tokens": 228,
  "input_processor_timing": 0.00015282,
  "llm_call_timing": 1.346,
  "charged_credits": "1",
  "model_name": "claude-sonnet-5",
  "task_name": "Support Ticket Triage",
  "output_modality": "json",
  "files": [],
  "is_error": false,
  "llm_retries": 0,
  "used_fallback_model": false,
  "user_id": "019f6c10-1a2b-7c3d-8e4f-5a6b7c8d9e01",
  "input_processor_charged_credits": "0"
}
```

**SDK Code**

```python Single ticket triage
import requests

url = "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task/task_id/run"

payload = { "task_input": {
        "body": "I was billed twice for my Pro subscription on the 3rd and the 5th. Please refund the duplicate charge.",
        "plan": "Pro",
        "subject": "Charged twice this month"
    } }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Single ticket triage
const url = 'https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task/task_id/run';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"task_input":{"body":"I was billed twice for my Pro subscription on the 3rd and the 5th. Please refund the duplicate charge.","plan":"Pro","subject":"Charged twice this month"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Single ticket triage
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task/task_id/run"

	payload := strings.NewReader("{\n  \"task_input\": {\n    \"body\": \"I was billed twice for my Pro subscription on the 3rd and the 5th. Please refund the duplicate charge.\",\n    \"plan\": \"Pro\",\n    \"subject\": \"Charged twice this month\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Single ticket triage
require 'uri'
require 'net/http'

url = URI("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task/task_id/run")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"task_input\": {\n    \"body\": \"I was billed twice for my Pro subscription on the 3rd and the 5th. Please refund the duplicate charge.\",\n    \"plan\": \"Pro\",\n    \"subject\": \"Charged twice this month\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Single ticket triage
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task/task_id/run")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"task_input\": {\n    \"body\": \"I was billed twice for my Pro subscription on the 3rd and the 5th. Please refund the duplicate charge.\",\n    \"plan\": \"Pro\",\n    \"subject\": \"Charged twice this month\"\n  }\n}")
  .asString();
```

```php Single ticket triage
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task/task_id/run', [
  'body' => '{
  "task_input": {
    "body": "I was billed twice for my Pro subscription on the 3rd and the 5th. Please refund the duplicate charge.",
    "plan": "Pro",
    "subject": "Charged twice this month"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Single ticket triage
using RestSharp;

var client = new RestClient("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task/task_id/run");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"task_input\": {\n    \"body\": \"I was billed twice for my Pro subscription on the 3rd and the 5th. Please refund the duplicate charge.\",\n    \"plan\": \"Pro\",\n    \"subject\": \"Charged twice this month\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Single ticket triage
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["task_input": [
    "body": "I was billed twice for my Pro subscription on the 3rd and the 5th. Please refund the duplicate charge.",
    "plan": "Pro",
    "subject": "Charged twice this month"
  ]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task/task_id/run")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Urgent technical ticket

**Request**

```json
{
  "task_input": {
    "body": "All our webhook deliveries have been failing with a 500 error since 9am. This is blocking our production sync.",
    "plan": "Enterprise",
    "subject": "Webhooks failing with 500"
  }
}
```

**Response**

```json
{
  "task_id": "019f8a00-1c3d-7e42-b8f1-2a5c9d4e7b60",
  "task_revision_id": "019f8a01-4b3d-7e52-9c02-3b6d8f1a5c71",
  "response": {
    "category": "billing",
    "priority": "high",
    "summary": "Customer was double-charged for their Pro plan renewal and wants a refund."
  },
  "run_data": {
    "submitted": {
      "body": "I was billed twice for my Pro subscription on the 3rd and the 5th. Please refund the duplicate charge.",
      "plan": "Pro",
      "subject": "Charged twice this month"
    },
    "integration_tool_calls": [],
    "mcp_tool_calls": []
  },
  "id": "019f8a04-8e60-7b85-af37-6e9fb14d8fa4",
  "created": "2026-07-24T10:02:17Z",
  "input_tokens": 186,
  "output_tokens": 42,
  "total_tokens": 228,
  "input_processor_timing": 0.00015282,
  "llm_call_timing": 1.346,
  "charged_credits": "1",
  "model_name": "claude-sonnet-5",
  "task_name": "Support Ticket Triage",
  "output_modality": "json",
  "files": [],
  "is_error": false,
  "llm_retries": 0,
  "used_fallback_model": false,
  "user_id": "019f6c10-1a2b-7c3d-8e4f-5a6b7c8d9e01",
  "input_processor_charged_credits": "0"
}
```

**SDK Code**

```python Urgent technical ticket
import requests

url = "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task/task_id/run"

payload = { "task_input": {
        "body": "All our webhook deliveries have been failing with a 500 error since 9am. This is blocking our production sync.",
        "plan": "Enterprise",
        "subject": "Webhooks failing with 500"
    } }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Urgent technical ticket
const url = 'https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task/task_id/run';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"task_input":{"body":"All our webhook deliveries have been failing with a 500 error since 9am. This is blocking our production sync.","plan":"Enterprise","subject":"Webhooks failing with 500"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Urgent technical ticket
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task/task_id/run"

	payload := strings.NewReader("{\n  \"task_input\": {\n    \"body\": \"All our webhook deliveries have been failing with a 500 error since 9am. This is blocking our production sync.\",\n    \"plan\": \"Enterprise\",\n    \"subject\": \"Webhooks failing with 500\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Urgent technical ticket
require 'uri'
require 'net/http'

url = URI("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task/task_id/run")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"task_input\": {\n    \"body\": \"All our webhook deliveries have been failing with a 500 error since 9am. This is blocking our production sync.\",\n    \"plan\": \"Enterprise\",\n    \"subject\": \"Webhooks failing with 500\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Urgent technical ticket
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task/task_id/run")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"task_input\": {\n    \"body\": \"All our webhook deliveries have been failing with a 500 error since 9am. This is blocking our production sync.\",\n    \"plan\": \"Enterprise\",\n    \"subject\": \"Webhooks failing with 500\"\n  }\n}")
  .asString();
```

```php Urgent technical ticket
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task/task_id/run', [
  'body' => '{
  "task_input": {
    "body": "All our webhook deliveries have been failing with a 500 error since 9am. This is blocking our production sync.",
    "plan": "Enterprise",
    "subject": "Webhooks failing with 500"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Urgent technical ticket
using RestSharp;

var client = new RestClient("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task/task_id/run");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"task_input\": {\n    \"body\": \"All our webhook deliveries have been failing with a 500 error since 9am. This is blocking our production sync.\",\n    \"plan\": \"Enterprise\",\n    \"subject\": \"Webhooks failing with 500\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Urgent technical ticket
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["task_input": [
    "body": "All our webhook deliveries have been failing with a 500 error since 9am. This is blocking our production sync.",
    "plan": "Enterprise",
    "subject": "Webhooks failing with 500"
  ]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task/task_id/run")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Follow-up run with task_reference

**Request**

```json
{
  "task_input": {
    "body": "Update: I checked my statement again and the two charges were for different months, not a duplicate. Please disregard.",
    "plan": "Pro",
    "subject": "Charged twice this month"
  },
  "task_reference": "ticket-482913"
}
```

**Response**

```json
{
  "task_id": "019f8a00-1c3d-7e42-b8f1-2a5c9d4e7b60",
  "task_revision_id": "019f8a01-4b3d-7e52-9c02-3b6d8f1a5c71",
  "response": {
    "category": "billing",
    "priority": "high",
    "summary": "Customer was double-charged for their Pro plan renewal and wants a refund."
  },
  "run_data": {
    "submitted": {
      "body": "I was billed twice for my Pro subscription on the 3rd and the 5th. Please refund the duplicate charge.",
      "plan": "Pro",
      "subject": "Charged twice this month"
    },
    "integration_tool_calls": [],
    "mcp_tool_calls": []
  },
  "id": "019f8a04-8e60-7b85-af37-6e9fb14d8fa4",
  "created": "2026-07-24T10:02:17Z",
  "input_tokens": 186,
  "output_tokens": 42,
  "total_tokens": 228,
  "input_processor_timing": 0.00015282,
  "llm_call_timing": 1.346,
  "charged_credits": "1",
  "model_name": "claude-sonnet-5",
  "task_name": "Support Ticket Triage",
  "output_modality": "json",
  "files": [],
  "is_error": false,
  "llm_retries": 0,
  "used_fallback_model": false,
  "user_id": "019f6c10-1a2b-7c3d-8e4f-5a6b7c8d9e01",
  "input_processor_charged_credits": "0"
}
```

**SDK Code**

```python Follow-up run with task_reference
import requests

url = "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task/task_id/run"

payload = {
    "task_input": {
        "body": "Update: I checked my statement again and the two charges were for different months, not a duplicate. Please disregard.",
        "plan": "Pro",
        "subject": "Charged twice this month"
    },
    "task_reference": "ticket-482913"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Follow-up run with task_reference
const url = 'https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task/task_id/run';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"task_input":{"body":"Update: I checked my statement again and the two charges were for different months, not a duplicate. Please disregard.","plan":"Pro","subject":"Charged twice this month"},"task_reference":"ticket-482913"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Follow-up run with task_reference
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task/task_id/run"

	payload := strings.NewReader("{\n  \"task_input\": {\n    \"body\": \"Update: I checked my statement again and the two charges were for different months, not a duplicate. Please disregard.\",\n    \"plan\": \"Pro\",\n    \"subject\": \"Charged twice this month\"\n  },\n  \"task_reference\": \"ticket-482913\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Follow-up run with task_reference
require 'uri'
require 'net/http'

url = URI("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task/task_id/run")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"task_input\": {\n    \"body\": \"Update: I checked my statement again and the two charges were for different months, not a duplicate. Please disregard.\",\n    \"plan\": \"Pro\",\n    \"subject\": \"Charged twice this month\"\n  },\n  \"task_reference\": \"ticket-482913\"\n}"

response = http.request(request)
puts response.read_body
```

```java Follow-up run with task_reference
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task/task_id/run")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"task_input\": {\n    \"body\": \"Update: I checked my statement again and the two charges were for different months, not a duplicate. Please disregard.\",\n    \"plan\": \"Pro\",\n    \"subject\": \"Charged twice this month\"\n  },\n  \"task_reference\": \"ticket-482913\"\n}")
  .asString();
```

```php Follow-up run with task_reference
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task/task_id/run', [
  'body' => '{
  "task_input": {
    "body": "Update: I checked my statement again and the two charges were for different months, not a duplicate. Please disregard.",
    "plan": "Pro",
    "subject": "Charged twice this month"
  },
  "task_reference": "ticket-482913"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Follow-up run with task_reference
using RestSharp;

var client = new RestClient("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task/task_id/run");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"task_input\": {\n    \"body\": \"Update: I checked my statement again and the two charges were for different months, not a duplicate. Please disregard.\",\n    \"plan\": \"Pro\",\n    \"subject\": \"Charged twice this month\"\n  },\n  \"task_reference\": \"ticket-482913\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Follow-up run with task_reference
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "task_input": [
    "body": "Update: I checked my statement again and the two charges were for different months, not a duplicate. Please disregard.",
    "plan": "Pro",
    "subject": "Charged twice this month"
  ],
  "task_reference": "ticket-482913"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task/task_id/run")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```