> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://onepin.ai/docs/reference/api-reference/workflows/runs/start/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://onepin.ai/_mcp/server. # Start Run POST https://api.onepin.ai/api/v1/workflows/{workflow_id}/runs Content-Type: application/json Start a new execution of a workflow (202 Accepted). Enqueues the workflow for asynchronous execution and returns the newly created run in `pending` or `running` status. The run progresses through its nodes in the background; poll `GET /runs/{run_id}/status` for lightweight progress updates, or `GET /runs/{run_id}` once to load the immutable definition snapshot. The optional request body supplies run-scoped inputs: `script_text` (and optionally `source_language`) replaces the source\_script text for THIS run's snapshot only — the stored workflow definition is not modified, so concurrent runs with different scripts cannot race. Requires exactly one source\_script node (422 otherwise). Use `POST /runs/preview` or `POST /estimate` to compute the credit cost before committing to an actual run — those endpoints are read-only and incur no charges. Returns 409 if the workspace is at its concurrent-run limit or another run for this workflow is already active. Requires at least `editor` role in the workspace; viewers cannot run workflows. Reference: https://onepin.ai/docs/reference/api-reference/workflows/runs/start ## Authentication - `Authorization` header (bearer token, required) — Clerk JWT token - `Authorization` header (bearer token, required) — Onepin live API key (`op_live_...`). Test and public keys are reserved in Phase 1. ## Servers - `https://api.onepin.ai` (prod, default) - `https://dev-api.onepin.ai` (dev) ## Request ### Path parameters - `workflow_id` (string, required) ### Headers - `X-Workspace-Id` (string, optional, nullable) ### Body (application/json) This endpoint expects a WorkflowRunStartIn. - `script_text` (string, optional, nullable) — Run this workflow with this script text instead of the text saved in the workflow's source_script node. Applied to the run's definition snapshot only. - `source_language` (string, optional, nullable) — BCP-47 language of script_text (e.g. en-us). Optional; when omitted the saved source_language (or automatic detection) applies. ## Response ### 202 Successful Response - `data` (WorkflowRunOut, required) - `meta` (Meta, required) ## Errors ### 422 Unprocessable Entity Error Validation Error - `detail` (list of ValidationError, optional) ## Types ### WorkflowRunOut - `id` (string, required) - `workflow_id` (string, required) - `status` (string, required) - `run_number` (integer, required) - `token_cost` (integer, required) - `created_at` (datetime, required) - `updated_at` (datetime, required) - `total_nodes` (integer, optional, default: 0) - `total_steps` (integer, optional, default: 0) - `finished_steps` (integer, optional, default: 0) - `finished_nodes` (integer, optional, default: 0) — Graph nodes that have reached a terminal state, judged by each node's highest-iteration step, so a retried node counts once. Pair with total_nodes for 'N of M completed'. A node interrupted by an automatic pause does NOT count while parked (its step is cancelled with a hard recovery checkpoint and is reopened in place on resume), so that kind of pause neither inflates the count nor drops it on resume. A partial-recovery resume schedules a NEW iteration for the node, so the count can drop by one until that iteration finishes. finished_steps counts rows and never excludes the parked row. - `held_nodes` (list of HeldNodeOut, optional, nullable) — Nodes the run is parked in front of, each with the locales it will process. Meaningful while status == 'paused'; cleared to null on resume and RETAINED on a run cancelled while paused. Null (never []) also means never computed: a run paused before this field shipped, or one parked straight from 'pending'. [] means it WAS computed and nothing is held. Excludes nodes skipped by an upstream discard and a node interrupted mid-execution by an automatic pause (that one is visible as its own cancelled step). - `usage_summary` (map from string to any, optional) - `started_at` (datetime, optional, nullable) - `completed_at` (datetime, optional, nullable) - `pause_requested_at` (datetime, optional, nullable) - `paused_at` (datetime, optional, nullable) - `paused_ms` (integer, optional, default: 0) - `pause_reason` (enum, optional, nullable) — Why the run is paused or draining toward an automatic pause. Manual pauses use user; null when no pause is active. - Allowed values: `user`, `provider_outage`, `provider_rate_limited`, `provider_billing`, `node_timeout` - `pause_error` (string, optional, nullable) — Aggregate customer-facing explanation for an automatic pause. Null for manual pauses and separate from terminal error. - `error` (string, optional, nullable) - `has_export` (boolean, optional, default: false) - `triggered_by` (TriggeredByOut, optional, nullable) — Actor that triggered a workflow run. ``user_name`` is guaranteed non-empty: derived from ``donut.utils.user.user_display_name`` which falls back to ``email`` when both first/last names are empty (``email`` is NOT NULL on User). - `credits` (integer, optional, default: 0) — Credits debited from the user's spendable balance for this run; excludes invoiced overage. ### Meta - `request_id` (string, required) - `timestamp` (datetime, required) ### ValidationError - `loc` (list of ValidationErrorLocItems, required) - `msg` (string, required) - `type` (string, required) - `input` (any, optional) - `ctx` (ValidationErrorCtx, optional) ### HeldNodeOut One node the run is parked in front of — it has no step row yet. - `node_id` (string, required) - `locales` (list of string, optional) — Locales of the lines this node will process once the run resumes. Empty means render no language line. ### TriggeredByOut Actor that triggered a workflow run. ``user_name`` is guaranteed non-empty: derived from ``donut.utils.user.user_display_name`` which falls back to ``email`` when both first/last names are empty (``email`` is NOT NULL on User). - `user_id` (string, required) - `user_name` (string, required) ### ValidationErrorLocItems ### ValidationErrorCtx ## Examples **Request** ```json {} ``` **Response** ```json { "data": { "id": "string", "workflow_id": "string", "status": "string", "run_number": 1, "token_cost": 1, "created_at": "2024-01-15T09:30:00Z", "updated_at": "2024-01-15T09:30:00Z", "total_nodes": 0, "total_steps": 0, "finished_steps": 0, "finished_nodes": 0, "held_nodes": [ { "node_id": "string", "locales": [ "string" ] } ], "usage_summary": {}, "started_at": "2024-01-15T09:30:00Z", "completed_at": "2024-01-15T09:30:00Z", "pause_requested_at": "2024-01-15T09:30:00Z", "paused_at": "2024-01-15T09:30:00Z", "paused_ms": 0, "pause_reason": "user", "pause_error": "string", "error": "string", "has_export": false, "triggered_by": { "user_id": "string", "user_name": "string" }, "credits": 0 }, "meta": { "request_id": "string", "timestamp": "2024-01-15T09:30:00Z" } } ``` **SDK Code** ```python import requests url = "https://api.onepin.ai/api/v1/workflows/workflow_id/runs" payload = {} headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.onepin.ai/api/v1/workflows/workflow_id/runs'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.onepin.ai/api/v1/workflows/workflow_id/runs" payload := strings.NewReader("{}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") 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 require 'uri' require 'net/http' url = URI("https://api.onepin.ai/api/v1/workflows/workflow_id/runs") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.onepin.ai/api/v1/workflows/workflow_id/runs") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{}") .asString(); ``` ```php request('POST', 'https://api.onepin.ai/api/v1/workflows/workflow_id/runs', [ 'body' => '{}', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.onepin.ai/api/v1/workflows/workflow_id/runs"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.onepin.ai/api/v1/workflows/workflow_id/runs")! 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() ``` > Onepin is a voice workflow platform that orchestrates, validates, and ships production-ready audio across 33 TTS models.