Docs / API reference /
Submit an async task
POST https://api.answerline.dev/v1/async/task
Queue a task to run asynchronously in the background. The response contains a task ID you can poll for the result, or the result can be delivered by webhook.
Body
-
taskType"AIMODE" | "GOOGLE" | "GOOGLE_NEWS" | "GEMINI" | "CHATGPT" | "COPILOT" | "PERPLEXITY" | "GROK" required -
Engine that should handle this task.
-
payloadobject required -
Request body specific to the engine. Needs at least
prompt(queryfor Google Search). -
priorityinteger -
Priority of the task, from 1 to 10; tasks with higher numbers run first. Default: 1.
-
idempotencyKeystring -
Distinct string that stops the same task from being created twice. No two tasks in your account may share it: the key stays bound while its task is kept (4 to 5 days after it finishes), and a failed task frees it 24 hours after failing.
-
webhookobject -
Settings for the webhook that reports a finished task.
1 property
-
webhook.urlstring required -
Endpoint that gets the webhook POST request once the task finishes.
-
Returns
-
successboolean required -
taskobject required -
Summary fields that every async task response includes.
7 properties
-
task.idstring required -
Identifier unique to the task.
-
task.taskType"AIMODE" | "GOOGLE" | "GOOGLE_NEWS" | "GEMINI" | "CHATGPT" | "COPILOT" | "PERPLEXITY" | "GROK" required -
Engine that handles this task.
-
task.status"QUEUED" | "PROCESSING" | "COMPLETED" | "FAILED" required -
Status of the task right now.
-
task.priorityinteger required -
Priority of the task, from 1 to 10; tasks with higher numbers run first. Default: 1.
-
task.createdAtstring required -
Creation time of the task.
-
task.latencyMsinteger | null -
Time from the task's start to its final outcome, in milliseconds. The wait in the queue before it starts is not counted. Null for tasks in
QUEUEDorPROCESSINGstate, and for tasks that failed before processing began. -
task.idempotencyKeystring | null -
Idempotency key supplied with the request, if any.
-
-
creditsobject required -
Charge details for one async task, in USD.
2 properties
-
credits.creditsToChargenumber required -
USD amount held back from the balance for this task.
-
credits.creditsChargednumber | null required -
USD amount charged for the task (0 when a free request covered it); null while it has not finished.
-
Responses
- 200
- Task created. The response includes its ID and starting status.
- 401
- Unauthorized - authentication failed
- 403
- Forbidden - INSUFFICIENT_CREDITS: too little balance left to pay for this task
- 409
- Conflict - a task already uses this idempotencyKey
- 422
- Validation Error - the body of the request is invalid
- 429
- Queue Limit Exceeded - the task does not fit in your queue. This status is also returned when the API cannot take the request right now (
SERVICE_OVERLOADED, sent withRetry-Afterand without limit headers) and when one address presented too many unknown keys (RATE_LIMIT_EXCEEDED, withRetry-After) - 500
- Internal Server Error