Asynchronous requests - cloro
Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
Assistant
Responses are generated using AI and may contain mistakes.
See Making requests for an overview of both request modes.You submit a task, we return a taskId, and the request runs in the background — like a tracking number rather than waiting at the counter. Submit tasks one at a time or in batches of up to 500.
Navigate to header: Step 1: make an API request Step 1: make an API request
payload takes the same parameters as the provider’s sync request. Include a webhook.url and we notify you when the job is done; omit it and you poll for the result.
cURL
Node.js (axios)
Python (requests)
curl -X POST "https://api.cloro.dev/v1/async/task" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"taskType": "CHATGPT",
"priority": 5,
"idempotencyKey": "your-custom-identifier-123",
"webhook": {
"url": "https://your-app.com/webhook-handler"
},
"payload": {
"prompt": "What is the weather in New York?",
"country": "US"
}
}'
import axios from 'axios';
const apiKey = 'YOUR_API_KEY';
const url = 'https://api.cloro.dev/v1/async/task';
const data = {
taskType: 'CHATGPT',
priority: 5,
idempotencyKey: 'your-custom-identifier-123',
webhook: {
url: 'https://your-app.com/webhook-handler',
},
payload: {
prompt: 'What is the weather in New York?',
country: 'US',
},
};
try {
const response = await axios.post(url, data, {
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
});
console.log(response.data);
} catch (error) {
console.error(error);
}
import requests
api_key = 'YOUR_API_KEY'
url = 'https://api.cloro.dev/v1/async/task'
payload = {
"taskType": "CHATGPT",
"priority": 5,
"idempotencyKey": "your-custom-identifier-123",
"webhook": {
"url": "https://your-app.com/webhook-handler"
},
"payload": {
"prompt": "What is the weather in New York?",
"country": "US"
}
}
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
**Identifying your requests with idempotencyKey**You can optionally include an idempotencyKey in your request. This is a unique string you create that allows you to easily identify and reference your requests in your own system.The idempotencyKey must be a unique string across your entire account. If you submit a request with an idempotency key that has already been used, the API returns 409:
{
"success": false,
"error": {
"code": "RESOURCE_ALREADY_EXISTS",
"message": "Task already exists",
"details": {
"field": "idempotencyKey",
"value": "abc12312233123441234451112322212222223",
"taskId": "b27a21e1-7c39-4aa2-a347-23e828c426f9"
},
"timestamp": "2025-12-10T11:41:40.243Z"
}
}
Generate unique keys using UUIDs, timestamps, or a combination of user ID + timestamp to ensure no duplicates.Key retention: a key stays bound to its task until the task record is deleted, whether it ended COMPLETED or FAILED. To retry a failed task before then, submit it with a new key.Recovering a lost taskId: GET /v1/async/task/{taskId} finds a task by its taskId only, not by its idempotencyKey. If your request times out or your serverless function (Vercel, Lambda) crashes before you save the taskId, resubmit with the same idempotencyKey. The API returns 409 and does not create a second task, so you are not charged twice, and error.details.taskId is the ID of the existing task: poll it as usual. If you set a webhook.url, the webhook payload also carries task.id and task.idempotencyKey.
Initial response
{
"success": true,
"task": {
"id": "b27a21e1-7c39-4aa2-a347-23e828c426f9",
"taskType": "CHATGPT",
"status": "QUEUED",
"priority": 5,
"createdAt": "2025-11-10T15:00:00.000Z",
"latencyMs": null,
"idempotencyKey": "your-custom-identifier-123"
},
"credits": {
"creditsToCharge": 5,
"creditsCharged": null
}
}
Understanding task states
QUEUED: received and waiting its turn, in priority order. A task waiting to retry a failed attempt is back inQUEUED.PROCESSING: a worker is running the task.COMPLETED: cloro got a result, returned inresponse. That result can be the provider’s own error or refusal text ( details).FAILED: no attempt returned a result, or the scheduler rejected the task when it reached it (invalid payload or insufficient credits).responsecarries the error.
The submit response always shows QUEUED. Poll the task status endpoint to follow the transitions; a webhook fires only once the task is COMPLETED or FAILED.Finished tasks are deleted about 24 hours after you create them, and HTML URLs in a result expire after 24 hours on their own clock.
Navigate to header: Step 2: receive the results Step 2: receive the results
Two ways to retrieve a result. Either way, a finished task carries task.latencyMs — the milliseconds from first pickup to the final outcome, excluding the initial queue wait. It is null while the task is QUEUED or PROCESSING, and stays null on a task that failed before processing ever started. On a retried task it covers every attempt, including the backoff between them, so it can be far longer than one provider call.
Don’t read task latency from the X-Latency-Ms header on a status call. That header times the status call itself — a few milliseconds — not the task. Task latency is only ever task.latencyMs.
Navigate to header: Option A: webhooks (recommended) Option A: webhooks (recommended)
If you provided a webhook.url in your request, we will send an HTTP POST to that URL containing the full result as soon as the task reaches a terminal state.See Webhooks for the payload shape, retry behavior, signature verification, and troubleshooting.
Navigate to header: Option B: polling Option B: polling
Without a webhook URL, GET the task status endpoint with your taskId. Once the task completes, the response carries the full result.
cURL
Node.js (axios)
Python (requests)
curl -X GET "https://api.cloro.dev/v1/async/task/YOUR_TASK_ID" \
-H "Authorization: Bearer YOUR_API_KEY"
import axios from 'axios';
const apiKey = 'YOUR_API_KEY';
const taskId = 'YOUR_TASK_ID';
const url = `https://api.cloro.dev/v1/async/task/${taskId}`;
try {
const response = await axios.get(url, {
headers: {
'Authorization': `Bearer ${apiKey}`,
},
});
console.log(response.data);
} catch (error) {
console.error(error);
}
import requests
api_key = 'YOUR_API_KEY'
task_id = 'YOUR_TASK_ID'
url = f'https://api.cloro.dev/v1/async/task/{task_id}'
headers = {
"Authorization": f"Bearer {api_key}"
}
response = requests.get(url, headers=headers)
print(response.json())
Navigate to header: Understanding limits Understanding limits
Navigate to header: Task submission limits Task submission limits
Your concurrency limit never blocks submission. Besides the per-second rate limit every endpoint has, two limits can:
- Credit limit: your balance must cover the task’s
creditsToCharge— see what happens when credits run out. - Queue limit: your organization can hold up to 100,000
QUEUEDtasks, counting tasks waiting to retry but notPROCESSINGones. Past that, a submit returns429 QUEUE_LIMIT_EXCEEDED, and a batch that would overflow the queue is rejected whole. Contact support if you need it raised.
Navigate to header: Task processing limits Task processing limits
The scheduler picks up queued tasks in priority order, and this is where your plan’s concurrency limit applies: if your plan allows 10 concurrent requests, up to 10 of your tasks run in parallel. Sync requests draw on the same slots, so sync traffic in flight leaves fewer for your tasks.
Navigate to header: Request prioritization Request prioritization
Set priority from 1 to 10 when you submit. Higher numbers run first, and tasks with the same priority run in the order they were received. Omitting it leaves the task at 1, so existing integrations are unaffected. Monitor how your queue is distributed across levels via the async status endpoint.
For practical concurrency patterns and examples, see our concurrency documentation.
Navigate to header: Common questions Common questions
Navigate to header: How do I cancel pending async tasks? How do I cancel pending async tasks?
Individual queued tasks cannot be canceled by taskId — once a task enters the QUEUED state, it stays there until it is either processed (COMPLETED / FAILED) or removed by a queue-wide clear.To wipe every pending task in one call, use the DELETE /v1/async/queue endpoint. It removes every QUEUED task for your organization (tasks already PROCESSING keep running) and returns the number cleared:
cURL
curl -X DELETE "https://api.cloro.dev/v1/async/queue" \
-H "Authorization: Bearer YOUR_API_KEY"
Navigate to header: How long do async tasks stay in the queue? How long do async tasks stay in the queue?
Tasks stay in the queue until they are processed, resulting in either COMPLETED or FAILED status. There is no fixed time-to-result. How quickly a task completes depends on:
- Queue depth: how many of your tasks are ahead of it in priority order.
- Concurrency limit: your plan’s limit caps how many of your tasks process in parallel, so a deep queue drains at most that many tasks at a time. See Rate & concurrency limits.
- Provider processing time: once a task is picked up, the time to the final outcome is reported in
task.latencyMs. Queue wait is excluded from that number.
Check your current queue depth and concurrency usage with the async status endpoint.
Navigate to header: How do I track the credits consumed by each task? How do I track the credits consumed by each task?
Both the polling response and the webhook payload include a credits object:
creditsToCharge— the estimated cost, computed at submission; nothing is reservedcreditsCharged—nulluntil the task finishes, then the amount actually billed (0for aFAILEDtask)
Use creditsCharged from the terminal state to attribute cost per job. How billing works covers what is charged.
Navigate to header: What happens to async tasks when my credits run out? What happens to async tasks when my credits run out?
Credits are checked twice, and the balance is never reserved in advance:
- At submission.
POST /v1/async/taskrejects with403 INSUFFICIENT_CREDITSwhen your balance does not cover that task’s cost.POST /v1/async/task/batchinstead returns200with a per-taskINSUFFICIENT_CREDITSerror for each task that doesn’t fit, so a partially affordable batch is partially accepted. - At scheduling. Tasks already sitting in
QUEUEDare re-checked when the scheduler picks them up. A task that no longer fits the balance moves toFAILEDwithcreditsCharged: 0and anINSUFFICIENT_CREDITSerror — it is not held, retried, or resumed when you top up. Re-submit those tasks after topping up.
Both checks are skipped if your organization is on a subscription with overages enabled.Because credits are only deducted when a task completes, the balance from GET /v1/credits reflects completed charges only — it does not net out creditsToCharge for work still queued or processing. To decide whether a submission will fit, subtract your own outstanding creditsToCharge from remaining rather than trusting remaining alone.
Navigate to header: A task came back COMPLETED but the result looks like an upstream error. What happened? A task came back COMPLETED but the result looks like an upstream error. What happened?
COMPLETED means cloro got a result from the provider, and that result can be the provider’s own error or refusal text; it is charged like any other result. Errors cloro recognizes are retried instead, and end in FAILED only if every attempt fails. See empty responses from AI providers to detect and retry the rest.
Navigate to header: Does async cost more credits than sync? Does async cost more credits than sync?
No — async is 2 credits cheaper per request. The base cost and feature add-ons are identical whether you use synchronous or async delivery, but sync monitor requests (/v1/monitor/*) carry a +2 credit surcharge that async and batch requests (/v1/async/*) do not. The creditsCharged field in the terminal task state shows the actual amount billed for each task.
Navigate to header: The async endpoint feels slow today. What should I check? The async endpoint feels slow today. What should I check?
Call GET /v1/async/status to see your account’s queue depth and concurrency usage. If the queue is deep and concurrency is saturated, throughput is plan-bound — see concurrency for how to raise it.
Was this page helpful?
YesNo
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"cloro","colors":{"primary":"#60A5FA","light":"#93C5FD","dark":"#3B82F6"},"logo":{"light":"https://mintcdn.com/cloro/31REGvIJOWq8\_kV2/logo/light.svg?fit=max\\u0026auto=format\\u0026n=31REGvIJOWq8\_kV2\\u0026q=85\\u0026s=9649c139f2768786bbd491a86c1a9dd9","dark":"https://mintcdn.com/cloro/31REGvIJOWq8\_kV2/logo/dark.svg?fit=max\\u0026auto=format\\u0026n=31REGvIJOWq8\_kV2\\u0026q=85\\u0026s=8b254a805d19d5a08a152025628fc518","href":"https://cloro.dev/"},"favicon":"https://mintcdn.com/cloro/JJLSAXWoRDaE6XhQ/favicon.ico?fit=max\\u0026auto=format\\u0026n=JJLSAXWoRDaE6XhQ\\u0026q=85\\u0026s=fb070a58a43d3a399505f112fcb2cf5b","api":{"playground":{"proxy":false}},"navbar":{"primary":{"type":"button","label":"Dashboard","href":"https://dashboard.cloro.dev/"}},"footer":{"socials":{"github":"https://github.com/cloro-dev","website":"https://cloro.dev/"}},"seo":{"metatags":{"canonical":"https://cloro.dev/docs"}},"integrations":{"posthog":{"apiKey":"phc\_O2d3bu6YrOXrcUYH9E1Dx6zc4kkW8eez5qXOFbBWii3","apiHost":"https://reverseproxy.cloro.dev"}},"banner":{"content":"The AI Assistant is here to help — ask it anything instead of browsing through the pages.","dismissible":true},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"cloro","hasAudioNarration":false,"actualSubdomain":"cloro","customDomains":["cloro.dev"],"gitSource":{"type":"github","owner":"cloro-dev","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true,"agentFeedback":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"}},"buildId":"6afee69d0b27e3d5820b1225","clientVersion":"0.0.4227","searchFilterCounts":[{"language":"default","tag":"API Reference","count":76},{"language":"default","tag":"Google","count":37},{"language":"default","tag":"Documentation","count":23},{"language":"default","tag":"Guides","count":12},{"language":"default","tag":"Google AI Mode","count":10},{"language":"default","tag":"ChatGPT","count":10},{"language":"default","tag":"Integrations","count":9},{"language":"default","tag":"AI Overview","count":7},{"language":"default","tag":"Async tasks","count":5},{"language":"default","tag":"Gemini","count":5}]},"assistantConfig":{"deflection":{"enabled":true,"email":"support@cloro.dev"}},"basePath":"/docs","hasChatPermissions":true,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[]} {"page":{"pagePath":"guides/making-requests/async","slug":"/guides/making-requests/async","pageMetadata":{"title":"Asynchronous requests","description":"Submit async tasks to cloro: submit-and-fetch flow, webhooks vs polling, task states, priority, queue limits, and clearing queued jobs.","icon":"clock","href":"/guides/making-requests/async"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Submit async tasks to cloro: submit-and-fetch flow, webhooks vs polling, task states, priority, queue limits, and clearing queued jobs.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Heading,Info,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Info)_missingMdxReference(`Info`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`See `,_jsx(_components.a,{href:`/guides/making-requests`,children:`Making requests`}),` for an overview of both request modes.`]}),`\n`,_jsxs(_components.p,{children:[`You submit a task, we return a `,_jsx(_components.code,{children:`taskId`}),`, and the request runs in the background — like a tracking number rather than waiting at the counter. Submit tasks one at a time or `,_jsx(_components.a,{href:`/api-reference/endpoint/create-batch-tasks`,children:`in batches of up to 500`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`step-1-make-an-api-request`,children:`Step 1: make an API request`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`payload`}),` takes the same `,_jsx(_components.a,{href:`/guides/making-requests/sync#common-parameters`,children:`parameters`}),` as the provider’s sync request. Include a `,_jsx(_components.code,{children:`webhook.url`}),` and we notify you when the job is done; omit it and you poll for the result.`]}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`cURL`,numberOfLines:`15`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`15`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -X`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` POST`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://api.cloro.dev/v1/async/task\\"\`}),\_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Authorization: Bearer YOUR_API_KEY\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type: application/json\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"taskType\": \"CHATGPT\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"priority\": 5,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"idempotencyKey\": \"your-custom-identifier-123\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"webhook\": {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"url\": \"https://your-app.com/webhook-handler\\"\`})}),\`\\n\`,\_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"payload\": {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"prompt\": \"What is the weather in New York?\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"country\": \"US\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` }'`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`Node.js (axios)`,numberOfLines:`29`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`29`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` axios`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'axios'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` apiKey`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'YOUR_API_KEY'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` url`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'https://api.cloro.dev/v1/async/task'\`}),\_jsx(\_components.span,{style:{color:\`#1F2328\`,\\"--shiki-dark\\":\`#D4D4D4\`},children:\`;\`})\]}),\`\\n\`,\_jsx(\_components.span,{className:\`line\`}),\`\\n\`,\_jsxs(\_components.span,{className:\`line\`,children:\[\_jsx(\_components.span,{style:{color:\`#CF222E\`,\\"--shiki-dark\\":\`#569CD6\`},children:\`const\`}),\_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` taskType:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'CHATGPT'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` priority:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` idempotencyKey:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'your-custom-identifier-123'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` webhook:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` url:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'https://your-app.com/webhook-handler'\`}),\_jsx(\_components.span,{style:{color:\`#1F2328\`,\\"--shiki-dark\\":\`#D4D4D4\`},children:\`,\`})\]}),\`\\n\`,\_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` payload:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` prompt:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'What is the weather in New York?'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` country:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'US'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`};`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`try`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` axios`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`post`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`url`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Authorization'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `Bearer \"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`apiKey`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Content-Type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'application/json'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`} `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`catch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`Python (requests)`,numberOfLines:`25`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`25`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`api_key `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'YOUR_API_KEY'`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`url `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'https://api.cloro.dev/v1/async/task'\`})\]}),\`\\n\`,\_jsx(\_components.span,{className:\`line\`}),\`\\n\`,\_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`payload `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"taskType\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"CHATGPT\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"priority\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"idempotencyKey\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"your-custom-identifier-123\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"webhook\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://your-app.com/webhook-handler\\"\`})\]}),\`\\n\`,\_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"payload\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"prompt\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"What is the weather in New York?\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"country\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"US\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`headers `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Authorization\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Bearer `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`api_key`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"application/json\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.post(url, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`json`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`payload, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`headers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`headers)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(response.json())`})]}),`\n`]})})})]}),`\n`,_jsxs(Info,{children:[_jsx(_components.p,{children:_jsxs(_components.strong,{children:[`Identifying your requests with `,_jsx(_components.code,{children:`idempotencyKey`})]})}),_jsxs(_components.p,{children:[`You can optionally include an `,_jsx(_components.code,{children:`idempotencyKey`}),` in your request. This is a unique string you create that allows you to easily identify and reference your requests in your own system.`]}),_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`idempotencyKey`}),` must be a `,_jsx(_components.strong,{children:`unique string`}),` across your entire account. If you submit a request with an idempotency key that has already been used, the API returns `,_jsx(_components.code,{children:`409`}),`:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`13`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`13`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"success\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`false`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"RESOURCE_ALREADY_EXISTS\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Task already exists\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"details\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"field\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"idempotencyKey\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"value\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"abc12312233123441234451112322212222223\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"taskId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"b27a21e1-7c39-4aa2-a347-23e828c426f9\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"timestamp\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"2025-12-10T11:41:40.243Z\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsx(_components.p,{children:`Generate unique keys using UUIDs, timestamps, or a combination of user ID + timestamp to ensure no duplicates.`}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Key retention`}),`: a key stays bound to its task until the task record is `,_jsx(_components.a,{href:`/api-reference/endpoint/get-task-status#task-retention-policy`,children:`deleted`}),`, whether it ended `,_jsx(_components.code,{children:`COMPLETED`}),` or `,_jsx(_components.code,{children:`FAILED`}),`. To retry a failed task before then, submit it with a new key.`]}),_jsxs(_components.p,{children:[_jsxs(_components.strong,{children:[`Recovering a lost `,_jsx(_components.code,{children:`taskId`})]}),`: `,_jsx(_components.code,{children:`GET /v1/async/task/{taskId}`}),` finds a task by its `,_jsx(_components.code,{children:`taskId`}),` only, not by its `,_jsx(_components.code,{children:`idempotencyKey`}),`. If your request times out or your serverless function (Vercel, Lambda) crashes before you save the `,_jsx(_components.code,{children:`taskId`}),`, resubmit with the same `,_jsx(_components.code,{children:`idempotencyKey`}),`. The API returns `,_jsx(_components.code,{children:`409`}),` and does not create a second task, so you are not charged twice, and `,_jsx(_components.code,{children:`error.details.taskId`}),` is the ID of the existing task: poll it as usual. If you set a `,_jsx(_components.code,{children:`webhook.url`}),`, the webhook payload also carries `,_jsx(_components.code,{children:`task.id`}),` and `,_jsx(_components.code,{children:`task.idempotencyKey`}),`.`]})]}),`\n`,_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`Initial response`,numberOfLines:`16`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`16`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"success\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"task\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"b27a21e1-7c39-4aa2-a347-23e828c426f9\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"taskType\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"CHATGPT\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"QUEUED\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"priority\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"createdAt\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"2025-11-10T15:00:00.000Z\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"latencyMs\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"idempotencyKey\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"your-custom-identifier-123\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"credits\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"creditsToCharge\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"creditsCharged\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`null`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})}),`\n`,_jsxs(Info,{children:[_jsx(_components.p,{children:_jsx(_components.strong,{children:`Understanding task states`})}),_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`QUEUED`}),`: received and waiting its turn, in `,_jsx(_components.a,{href:`#request-prioritization`,children:`priority`}),` order. A task waiting to retry a failed attempt is back in `,_jsx(_components.code,{children:`QUEUED`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`PROCESSING`}),`: a worker is running the task.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`COMPLETED`}),`: cloro got a result, returned in `,_jsx(_components.code,{children:`response`}),`. That result can be the provider’s own error or refusal text (`,_jsx(_components.a,{href:`#a-task-came-back-completed-but-the-result-looks-like-an-upstream-error-what-happened`,children:`details`}),`).`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`FAILED`}),`: no attempt returned a result, or the scheduler rejected the task when it reached it (invalid payload or insufficient credits). `,_jsx(_components.code,{children:`response`}),` carries the error.`]}),`\n`]}),_jsxs(_components.p,{children:[`The submit response always shows `,_jsx(_components.code,{children:`QUEUED`}),`. Poll the `,_jsx(_components.a,{href:`/api-reference/endpoint/get-task-status`,children:`task status`}),` endpoint to follow the transitions; a webhook fires only once the task is `,_jsx(_components.code,{children:`COMPLETED`}),` or `,_jsx(_components.code,{children:`FAILED`}),`.`]}),_jsxs(_components.p,{children:[`Finished tasks are deleted `,_jsx(_components.a,{href:`/api-reference/endpoint/get-task-status#task-retention-policy`,children:`about 24 hours after you create them`}),`, and HTML URLs in a result `,_jsx(_components.a,{href:`/guides/output-formats`,children:`expire after 24 hours`}),` on their own clock.`]})]}),`\n`,_jsx(Heading,{level:`2`,id:`step-2-receive-the-results`,children:`Step 2: receive the results`}),`\n`,_jsxs(_components.p,{children:[`Two ways to retrieve a result. Either way, a finished task carries `,_jsx(_components.code,{children:`task.latencyMs`}),` — the milliseconds from first pickup to the final outcome, excluding the initial queue wait. It is `,_jsx(_components.code,{children:`null`}),` while the task is `,_jsx(_components.code,{children:`QUEUED`}),` or `,_jsx(_components.code,{children:`PROCESSING`}),`, and stays `,_jsx(_components.code,{children:`null`}),` on a task that failed before processing ever started. On a retried task it covers every attempt, including the backoff between them, so it can be far longer than one provider call.`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Don’t read task latency from the `,_jsx(_components.code,{children:`X-Latency-Ms`}),` header on a status call. That header times the status call itself — a few milliseconds — not the task. Task latency is only ever `,_jsx(_components.code,{children:`task.latencyMs`}),`.`]})}),`\n`,_jsx(Heading,{level:`3`,id:`option-a-webhooks-recommended`,children:`Option A: webhooks (recommended)`}),`\n`,_jsxs(_components.p,{children:[`If you provided a `,_jsx(_components.code,{children:`webhook.url`}),` in your request, we will send an HTTP `,_jsx(_components.code,{children:`POST`}),` to that URL containing the full result as soon as the task reaches a terminal state.`]}),`\n`,_jsxs(_components.p,{children:[`See `,_jsx(_components.a,{href:`/guides/webhooks`,children:`Webhooks`}),` for the payload shape, retry behavior, signature verification, and troubleshooting.`]}),`\n`,_jsx(Heading,{level:`3`,id:`option-b-polling`,children:`Option B: polling`}),`\n`,_jsxs(_components.p,{children:[`Without a webhook URL, `,_jsx(_components.code,{children:`GET`}),` the `,_jsx(_components.a,{href:`/api-reference/endpoint/get-task-status`,children:`task status`}),` endpoint with your `,_jsx(_components.code,{children:`taskId`}),`. Once the task completes, the response carries the full result.`]}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`cURL`,numberOfLines:`2`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -X`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` GET`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://api.cloro.dev/v1/async/task/YOUR\_TASK\_ID\\"\`}),\_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Authorization: Bearer YOUR_API_KEY\"`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`Node.js (axios)`,numberOfLines:`16`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`16`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` axios`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'axios'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` apiKey`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'YOUR_API_KEY'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` taskId`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'YOUR_TASK_ID'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` url`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `https://api.cloro.dev/v1/async/task/\\"}),\_jsx(\_components.span,{style:{color:\`#0A3069\`,\\"--shiki-dark\\":\`#569CD6\`},children:\\"${\\"}),\_jsx(\_components.span,{style:{color:\`#1F2328\`,\\"--shiki-dark\\":\`#9CDCFE\`},children:\`taskId\`}),\_jsx(\_components.span,{style:{color:\`#0A3069\`,\\"--shiki-dark\\":\`#569CD6\`},children:\`}\`}),\_jsx(\_components.span,{style:{color:\`#0A3069\`,\\"--shiki-dark\\":\`#CE9178\`},children:\\"\`\\"}),\_jsx(\_components.span,{style:{color:\`#1F2328\`,\\"--shiki-dark\\":\`#D4D4D4\`},children:\`;\`})\]}),\`\\n\`,\_jsx(\_components.span,{className:\`line\`}),\`\\n\`,\_jsxs(\_components.span,{className:\`line\`,children:\[\_jsx(\_components.span,{style:{color:\`#CF222E\`,\\"--shiki-dark\\":\`#C586C0\`},children:\`try\`}),\_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` axios`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`get`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`url`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Authorization'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `Bearer \"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`apiKey`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`} `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`catch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`Python (requests)`,numberOfLines:`12`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`api_key `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'YOUR_API_KEY'`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`task_id `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'YOUR_TASK_ID'`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`url `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'https://api.cloro.dev/v1/async/task/\`}),\_jsx(\_components.span,{style:{color:\`#CF222E\`,\\"--shiki-dark\\":\`#569CD6\`},children:\`{\`}),\_jsx(\_components.span,{style:{color:\`#1F2328\`,\\"--shiki-dark\\":\`#D4D4D4\`},children:\`task\_id\`}),\_jsx(\_components.span,{style:{color:\`#CF222E\`,\\"--shiki-dark\\":\`#569CD6\`},children:\`}\`}),\_jsx(\_components.span,{style:{color:\`#0A3069\`,\\"--shiki-dark\\":\`#CE9178\`},children:\`'\`})\]}),\`\\n\`,\_jsx(\_components.span,{className:\`line\`}),\`\\n\`,\_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`headers `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Authorization\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Bearer `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`api_key`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.get(url, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`headers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`headers)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(response.json())`})]}),`\n`]})})})]}),`\n`,_jsx(Heading,{level:`2`,id:`understanding-limits`,children:`Understanding limits`}),`\n`,_jsx(Heading,{level:`3`,id:`task-submission-limits`,children:`Task submission limits`}),`\n`,_jsxs(_components.p,{children:[`Your concurrency limit never blocks submission. Besides the `,_jsx(_components.a,{href:`/guides/error-handling#rate-limits-429`,children:`per-second rate limit`}),` every endpoint has, two limits can:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Credit limit`}),`: your balance must cover the task’s `,_jsx(_components.code,{children:`creditsToCharge`}),` — see `,_jsx(_components.a,{href:`#what-happens-to-async-tasks-when-my-credits-run-out`,children:`what happens when credits run out`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Queue limit`}),`: your organization can hold up to `,_jsx(_components.strong,{children:`100,000`}),` `,_jsx(_components.code,{children:`QUEUED`}),` tasks, counting tasks waiting to retry but not `,_jsx(_components.code,{children:`PROCESSING`}),` ones. Past that, a submit returns `,_jsx(_components.code,{children:`429 QUEUE_LIMIT_EXCEEDED`}),`, and a batch that would overflow the queue is rejected whole. `,_jsx(_components.a,{href:`/guides/billing#what-does-the-free-tier-include-and-can-free-tier-users-contact-support`,children:`Contact support`}),` if you need it raised.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`task-processing-limits`,children:`Task processing limits`}),`\n`,_jsxs(_components.p,{children:[`The scheduler picks up queued tasks in `,_jsx(_components.a,{href:`#request-prioritization`,children:`priority`}),` order, and this is where your plan’s `,_jsx(_components.strong,{children:`concurrency limit`}),` applies: if your plan allows 10 concurrent requests, up to 10 of your tasks run in parallel. Sync requests draw on the same slots, so sync traffic in flight leaves fewer for your tasks.`]}),`\n`,_jsx(Heading,{level:`3`,id:`request-prioritization`,children:`Request prioritization`}),`\n`,_jsxs(_components.p,{children:[`Set `,_jsx(_components.code,{children:`priority`}),` from 1 to 10 when you submit. Higher numbers run first, and tasks with the same priority run in the order they were received. Omitting it leaves the task at 1, so existing integrations are unaffected. Monitor how your queue is distributed across levels via the `,_jsx(_components.a,{href:`/api-reference/endpoint/get-async-status`,children:`async status endpoint`}),`.`]}),`\n`,_jsx(Info,{children:_jsxs(_components.p,{children:[`For practical concurrency patterns and examples, see our\n`,_jsx(_components.a,{href:`/guides/concurrency`,children:`concurrency`}),` documentation.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`common-questions`,children:`Common questions`}),`\n`,_jsx(Heading,{level:`3`,id:`how-do-i-cancel-pending-async-tasks`,children:`How do I cancel pending async tasks?`}),`\n`,_jsxs(_components.p,{children:[`Individual queued tasks cannot be canceled by `,_jsx(_components.code,{children:`taskId`}),` — once a task enters the `,_jsx(_components.code,{children:`QUEUED`}),` state, it stays there until it is either processed (`,_jsx(_components.code,{children:`COMPLETED`}),` / `,_jsx(_components.code,{children:`FAILED`}),`) or removed by a queue-wide clear.`]}),`\n`,_jsxs(_components.p,{children:[`To wipe every pending task in one call, use the `,_jsx(_components.a,{href:`/api-reference/endpoint/clear-async-queue`,children:_jsx(_components.code,{children:`DELETE /v1/async/queue`})}),` endpoint. It removes every `,_jsx(_components.code,{children:`QUEUED`}),` task for your organization (tasks already `,_jsx(_components.code,{children:`PROCESSING`}),` keep running) and returns the number cleared:`]}),`\n`,_jsx(CodeBlock,{filename:`cURL`,numberOfLines:`2`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -X`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` DELETE`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://api.cloro.dev/v1/async/queue\\"\`}),\_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Authorization: Bearer YOUR_API_KEY\"`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`how-long-do-async-tasks-stay-in-the-queue`,children:`How long do async tasks stay in the queue?`}),`\n`,_jsxs(_components.p,{children:[`Tasks stay in the queue until they are processed, resulting in either `,_jsx(_components.code,{children:`COMPLETED`}),` or `,_jsx(_components.code,{children:`FAILED`}),` status. There is no fixed time-to-result. How quickly a task completes depends on:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Queue depth`}),`: how many of your tasks are ahead of it in `,_jsx(_components.a,{href:`#request-prioritization`,children:`priority`}),` order.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Concurrency limit`}),`: your plan’s limit caps how many of your tasks process in parallel, so a deep queue drains at most that many tasks at a time. See `,_jsx(_components.a,{href:`/guides/concurrency`,children:`Rate \u0026 concurrency limits`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Provider processing time`}),`: once a task is picked up, the time to the final outcome is reported in `,_jsx(_components.code,{children:`task.latencyMs`}),`. Queue wait is excluded from that number.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Check your current queue depth and concurrency usage with the `,_jsx(_components.a,{href:`/api-reference/endpoint/get-async-status`,children:`async status endpoint`}),`.`]}),`\n`,_jsx(Heading,{level:`3`,id:`how-do-i-track-the-credits-consumed-by-each-task`,children:`How do I track the credits consumed by each task?`}),`\n`,_jsxs(_components.p,{children:[`Both the polling response and the webhook payload include a `,_jsx(_components.code,{children:`credits`}),` object:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`creditsToCharge`}),` — the estimated cost, computed at submission; nothing is reserved`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`creditsCharged`}),` — `,_jsx(_components.code,{children:`null`}),` until the task finishes, then the amount actually billed (`,_jsx(_components.code,{children:`0`}),` for a `,_jsx(_components.code,{children:`FAILED`}),` task)`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Use `,_jsx(_components.code,{children:`creditsCharged`}),` from the terminal state to attribute cost per job. `,_jsx(_components.a,{href:`/guides/billing#how-billing-works`,children:`How billing works`}),` covers what is charged.`]}),`\n`,_jsx(Heading,{level:`3`,id:`what-happens-to-async-tasks-when-my-credits-run-out`,children:`What happens to async tasks when my credits run out?`}),`\n`,_jsx(_components.p,{children:`Credits are checked twice, and the balance is never reserved in advance:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`At submission.`}),` `,_jsx(_components.a,{href:`/api-reference/endpoint/create-async-task`,children:_jsx(_components.code,{children:`POST /v1/async/task`})}),` rejects with `,_jsx(_components.code,{children:`403 INSUFFICIENT_CREDITS`}),` when your balance does not cover that task’s cost. `,_jsx(_components.a,{href:`/api-reference/endpoint/create-batch-tasks`,children:_jsx(_components.code,{children:`POST /v1/async/task/batch`})}),` instead returns `,_jsx(_components.code,{children:`200`}),` with a per-task `,_jsx(_components.code,{children:`INSUFFICIENT_CREDITS`}),` error for each task that doesn’t fit, so a partially affordable batch is partially accepted.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`At scheduling.`}),` Tasks already sitting in `,_jsx(_components.code,{children:`QUEUED`}),` are re-checked when the scheduler picks them up. A task that no longer fits the balance moves to `,_jsx(_components.code,{children:`FAILED`}),` with `,_jsx(_components.code,{children:`creditsCharged: 0`}),` and an `,_jsx(_components.code,{children:`INSUFFICIENT_CREDITS`}),` error — it is not held, retried, or resumed when you top up. Re-submit those tasks after topping up.`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`Both checks are skipped if your organization is on a subscription with overages enabled.`}),`\n`,_jsxs(_components.p,{children:[`Because credits are only deducted when a task completes, the balance from `,_jsx(_components.a,{href:`/api-reference/endpoint/get-credits`,children:_jsx(_components.code,{children:`GET /v1/credits`})}),` reflects `,_jsx(_components.strong,{children:`completed charges only`}),` — it does not net out `,_jsx(_components.code,{children:`creditsToCharge`}),` for work still queued or processing. To decide whether a submission will fit, subtract your own outstanding `,_jsx(_components.code,{children:`creditsToCharge`}),` from `,_jsx(_components.code,{children:`remaining`}),` rather than trusting `,_jsx(_components.code,{children:`remaining`}),` alone.`]}),`\n`,_jsxs(Heading,{level:`3`,id:`a-task-came-back-completed-but-the-result-looks-like-an-upstream-error-what-happened`,children:[`A task came back `,_jsx(_components.code,{children:`COMPLETED`}),` but the result looks like an upstream error. What happened?`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`COMPLETED`}),` means cloro got a result from the provider, and that result can be the provider’s own error or refusal text; it is charged like any other result. Errors cloro recognizes are retried instead, and end in `,_jsx(_components.code,{children:`FAILED`}),` only if every attempt fails. See `,_jsx(_components.a,{href:`/guides/error-handling#empty-responses-from-ai-providers`,children:`empty responses from AI providers`}),` to detect and retry the rest.`]}),`\n`,_jsx(Heading,{level:`3`,id:`does-async-cost-more-credits-than-sync`,children:`Does async cost more credits than sync?`}),`\n`,_jsxs(_components.p,{children:[`No — async is 2 credits cheaper per request. The base cost and feature add-ons are identical whether you use synchronous or async delivery, but sync monitor requests (`,_jsx(_components.code,{children:`/v1/monitor/*`}),`) carry a `,_jsx(_components.a,{href:`/guides/providers#sync-request-surcharge`,children:`+2 credit surcharge`}),` that async and batch requests (`,_jsx(_components.code,{children:`/v1/async/*`}),`) do not. The `,_jsx(_components.code,{children:`creditsCharged`}),` field in the terminal task state shows the actual amount billed for each task.`]}),`\n`,_jsx(Heading,{level:`3`,id:`the-async-endpoint-feels-slow-today-what-should-i-check`,children:`The async endpoint feels slow today. What should I check?`}),`\n`,_jsxs(_components.p,{children:[`Call `,_jsx(_components.a,{href:`/api-reference/endpoint/get-async-status`,children:_jsx(_components.code,{children:`GET /v1/async/status`})}),` to see your account’s queue depth and concurrency usage. If the queue is deep and concurrency is saturated, throughput is plan-bound — see `,_jsx(_components.a,{href:`/guides/concurrency#can-i-increase-my-concurrency-limit`,children:`concurrency`}),` for how to raise it.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Asynchronous requests","description":"Submit async tasks to cloro: submit-and-fetch flow, webhooks vs polling, task states, priority, queue limits, and clearing queued jobs.","icon":"clock","href":"/guides/making-requests/async"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Step 1: make an API request","slug":"step-1-make-an-api-request","depth":2,"children":[]},{"title":"Step 2: receive the results","slug":"step-2-receive-the-results","depth":2,"children":[{"title":"Option A: webhooks (recommended)","slug":"option-a-webhooks-recommended","depth":3,"children":[]},{"title":"Option B: polling","slug":"option-b-polling","depth":3,"children":[]}]},{"title":"Understanding limits","slug":"understanding-limits","depth":2,"children":[{"title":"Task submission limits","slug":"task-submission-limits","depth":3,"children":[]},{"title":"Task processing limits","slug":"task-processing-limits","depth":3,"children":[]},{"title":"Request prioritization","slug":"request-prioritization","depth":3,"children":[]}]},{"title":"Common questions","slug":"common-questions","depth":2,"children":[{"title":"How do I cancel pending async tasks?","slug":"how-do-i-cancel-pending-async-tasks","depth":3,"children":[]},{"title":"How long do async tasks stay in the queue?","slug":"how-long-do-async-tasks-stay-in-the-queue","depth":3,"children":[]},{"title":"How do I track the credits consumed by each task?","slug":"how-do-i-track-the-credits-consumed-by-each-task","depth":3,"children":[]},{"title":"What happens to async tasks when my credits run out?","slug":"what-happens-to-async-tasks-when-my-credits-run-out","depth":3,"children":[]},{"title":"A task came back COMPLETED but the result looks like an upstream error. What happened?","slug":"a-task-came-back-completed-but-the-result-looks-like-an-upstream-error-what-happened","depth":3,"children":[]},{"title":"Does async cost more credits than sync?","slug":"does-async-cost-more-credits-than-sync","depth":3,"children":[]},{"title":"The async endpoint feels slow today. What should I check?","slug":"the-async-endpoint-feels-slow-today-what-should-i-check","depth":3,"children":[]}]}],"codeExamples":{}},"jsLinks":[],"subdomain":"cloro","siteName":"cloro","title":"Asynchronous requests - cloro","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-16T12:06:54.175Z","originalFileLocation":"guides/making-requests/async.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Submit async tasks to cloro: submit-and-fetch flow, webhooks vs polling, task states, priority, queue limits, and clearing queued jobs.\">\u003cmeta data-mint-head name=\"application-name\" content=\"cloro\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/cloro/4KOv8pRhaY1jvVpr/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/docs/mintlify-assets/_mintlify/favicons/cloro/4KOv8pRhaY1jvVpr/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/cloro/4KOv8pRhaY1jvVpr/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/cloro/4KOv8pRhaY1jvVpr/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/cloro/4KOv8pRhaY1jvVpr/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/cloro/4KOv8pRhaY1jvVpr/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/cloro/4KOv8pRhaY1jvVpr/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/cloro/4KOv8pRhaY1jvVpr/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/cloro/4KOv8pRhaY1jvVpr/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Asynchronous requests - cloro\">\u003cmeta data-mint-head property=\"og:description\" content=\"Submit async tasks to cloro: submit-and-fetch flow, webhooks vs polling, task states, priority, queue limits, and clearing queued jobs.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"cloro\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://cloro.dev/docs/guides/making-requests/async\\">\\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://cloro.mintlify.site/docs/\_mintlify/api/og/v2?division=Types+of+requests\\u0026amp;title=Asynchronous+requests\\u0026amp;description=Submit+async+tasks+to+cloro%3A+submit-and-fetch+flow%2C+webhooks+vs+polling%2C+task+states%2C+priority%2C+queue+limits%2C+and+clearing+queued+jobs.\\u0026amp;theme=3dd67aad49c38e49a018244e\\u0026amp;signature=d710c4d2c17eb578ffd95e0071c006ed7855b22b3a28e9aa8d80048e351a76b6\\">\\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Asynchronous requests - cloro\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Submit async tasks to cloro: submit-and-fetch flow, webhooks vs polling, task states, priority, queue limits, and clearing queued jobs.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://cloro.mintlify.site/docs/\_mintlify/api/og/v2?division=Types+of+requests\\u0026amp;title=Asynchronous+requests\\u0026amp;description=Submit+async+tasks+to+cloro%3A+submit-and-fetch+flow%2C+webhooks+vs+polling%2C+task+states%2C+priority%2C+queue+limits%2C+and+clearing+queued+jobs.\\u0026amp;theme=3dd67aad49c38e49a018244e\\u0026amp;signature=d710c4d2c17eb578ffd95e0071c006ed7855b22b3a28e9aa8d80048e351a76b6\\">\\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/docs/mintlify-assets/_mintlify/favicons/cloro/4KOv8pRhaY1jvVpr/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"cloro\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#60A5FA\">\u003clink data-mint-head rel=\"canonical\" href=\"https://cloro.dev/docs/guides/making-requests/async\\">\\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/guides/making-requests/async.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\\",\\"@graph\\":\[{\\"@type\\":\\"Organization\\",\\"@id\\":\\"https://cloro.dev/#organization\\",\\"name\\":\\"cloro\\",\\"url\\":\\"https://cloro.dev\\",\\"logo\\":{\\"@type\\":\\"ImageObject\\",\\"url\\":\\"https://mintcdn.com/cloro/31REGvIJOWq8\_kV2/logo/light.svg?fit=max\\u0026auto=format\\u0026n=31REGvIJOWq8\_kV2\\u0026q=85\\u0026s=9649c139f2768786bbd491a86c1a9dd9\\"}},{\\"@type\\":\\"WebSite\\",\\"@id\\":\\"https://cloro.dev/docs#website\\",\\"name\\":\\"cloro\\",\\"url\\":\\"https://cloro.dev/docs\\",\\"publisher\\":{\\"@id\\":\\"https://cloro.dev/#organization\\"}},{\\"@type\\":\\"WebPage\\",\\"@id\\":\\"https://cloro.dev/docs/guides/making-requests/async#webpage\\",\\"url\\":\\"https://cloro.dev/docs/guides/making-requests/async\\",\\"name\\":\\"Asynchronous requests\",\"description\":\"Submit async tasks to cloro: submit-and-fetch flow, webhooks vs polling, task states, priority, queue limits, and clearing queued jobs.\",\"dateModified\":\"2026-11-16T12:06:54.175Z\",\"isPartOf\":{\"@id\":\"https://cloro.dev/docs#website\\"},\\"breadcrumb\\":{\\"@id\\":\\"https://cloro.dev/docs/guides/making-requests/async#breadcrumb\\"}},{\\"@type\\":\\"BreadcrumbList\\",\\"@id\\":\\"https://cloro.dev/docs/guides/making-requests/async#breadcrumb\\",\\"itemListElement\\":\[{\\"@type\\":\\"ListItem\\",\\"position\\":1,\\"name\\":\\"Guides\\",\\"item\\":\\"https://cloro.dev/docs/guides/authentication\\"},{\\"@type\\":\\"ListItem\\",\\"position\\":2,\\"name\\":\\"Types of requests\",\"item\":\"https://cloro.dev/docs/guides/making-requests/sync\\"},{\\"@type\\":\\"ListItem\\",\\"position\\":3,\\"name\\":\\"Asynchronous requests\",\"item\":\"https://cloro.dev/docs/guides/making-requests/async\\"}\]},{\\"@type\\":\[\\"Article\\",\\"TechArticle\\"\],\\"@id\\":\\"https://cloro.dev/docs/guides/making-requests/async#article\\",\\"headline\\":\\"Asynchronous requests\",\"name\":\"Asynchronous requests\",\"description\":\"Submit async tasks to cloro: submit-and-fetch flow, webhooks vs polling, task states, priority, queue limits, and clearing queued jobs.\",\"url\":\"https://cloro.dev/docs/guides/making-requests/async\\",\\"mainEntityOfPage\\":{\\"@id\\":\\"https://cloro.dev/docs/guides/making-requests/async#webpage\\"},\\"dateModified\\":\\"2026-11-16T12:06:54.175Z\\",\\"publisher\\":{\\"@id\\":\\"https://cloro.dev/#organization\\"},\\"isPartOf\\":{\\"@id\\":\\"https://cloro.dev/docs#website\\"}}\]}\\u003c/script>\\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\\",\\"@type\\":\\"WebSite\\",\\"name\\":\\"cloro\\",\\"publisher\\":{\\"@type\\":\\"Organization\\",\\"name\\":\\"cloro\\"},\\"provider\\":{\\"@type\\":\\"Organization\\",\\"name\\":\\"Mintlify\\",\\"url\\":\\"https://mintlify.com\\"}}\\u003c/script>","agentPointerHref":"/docs/guides/making-requests/async.md","siteName":"cloro","nav":{"global":null,"tabs":\[{"tab":"Documentation","icon":"book-open","groups":\[{"group":"Introduction","icon":"book-open","pages":\[{"title":"Welcome to cloro","href":""},{"title":"Quickstart: make your first cloro API request","sidebarTitle":"Quickstart","href":"/introduction/quickstart"}]},{"group":"Guides","icon":"file-text","pages":[{"title":"Authentication","icon":"key","href":"/guides/authentication"},{"title":"Making requests","icon":"send","href":"/guides/making-requests"},{"group":"Types of requests","expanded":true,"pages":[{"title":"Synchronous requests","description":"Make synchronous requests to the cloro API: request structure, common parameters, response shape, and code examples.","icon":"bolt","href":"/guides/making-requests/sync"},{"title":"Asynchronous requests","icon":"clock","href":"/guides/making-requests/async"}]},{"title":"Webhooks","description":"Receive async task results via webhooks: payload shape, retry behavior, HMAC signature verification in Node.js, Python, and Go, and troubleshooting tips.","icon":"webhook","href":"/guides/webhooks"},{"title":"Error handling","icon":"shield","href":"/guides/error-handling"},{"title":"Versioning and deprecation","icon":"tag","href":"/guides/versioning"},{"title":"Rate \u0026 concurrency limits","icon":"zap","href":"/guides/concurrency"},{"title":"Supported AI providers, features, and credit pricing","sidebarTitle":"Providers","icon":"network-wired","href":"/guides/providers"},{"title":"Billing \u0026 credits","icon":"credit-card","href":"/guides/billing"},{"title":"Account \u0026 organizations","icon":"user","href":"/guides/account"},{"title":"Output formats","icon":"code","href":"/guides/output-formats"}]},{"group":"Integrations","icon":"plug","pages":[{"title":"MCP server: give any agent cloro's monitoring tools","sidebarTitle":"MCP server","icon":"plug-circle-bolt","href":"/integrations/mcp"},{"title":"Agent skills","icon":"book-open","href":"/integrations/skills"},{"title":"Python SDK","icon":"python","href":"/integrations/python"},{"title":"TypeScript SDK","icon":"node-js","href":"/integrations/typescript"},{"title":"Vercel AI SDK","icon":"triangle","href":"/integrations/vercel-ai-sdk"},{"title":"n8n integration — query AI engines from workflows","sidebarTitle":"n8n","icon":"diagram-project","href":"/integrations/n8n"},{"title":"Zapier integration — connect cloro to 8,000+ apps","sidebarTitle":"Zapier","icon":"bolt","href":"/integrations/zapier"},{"title":"LangChain","icon":"python","href":"/integrations/langchain"},{"title":"OpenClaw","icon":"claw-marks","href":"/integrations/openclaw"}]}]},{"tab":"API Reference","icon":"code","pages":[{"title":"API Reference","href":"/api-reference/introduction"}]},{"tab":"Changelog","icon":"newspaper","pages":[{"title":"Changelog","href":"/changelog"}]}]},"basePath":"","title":"Asynchronous requests - cloro","deploymentId":"dpl_2MqcLy8smQrrovUehgcZEsoo1tJX","buildId":"dpl_2MqcLy8smQrrovUehgcZEsoo1tJX","dynamics":[],"chunks":[]}