Submit async tasks in a batch

Create as many as 500 async tasks in a single request. Tasks are validated one by one, so an invalid task does not stop the others from being accepted. The response lists a result for each task.

post/v1/async/task/batch

Request

  • Base URL: https://api.answerline.dev
  • URL: https://api.answerline.dev/v1/async/task/batch
  • Auth: HTTP bearer

Request body

taskType'AIMODE' | 'GOOGLE' | 'GOOGLE_NEWS' | 'GEMINI' | 'CHATGPT' | 'COPILOT' | 'PERPLEXITY' | 'GROK' required

AI provider that should handle this task.

payloadobject required

Request body specific to the provider. Needs at least prompt (query for 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.

Example request

[
  {
    "taskType": "CHATGPT",
    "payload": {
      "prompt": "How is Northwind Traders reviewed by customers?",
      "country": "US"
    },
    "priority": 5,
    "idempotencyKey": "batch-chatgpt-001",
    "webhook": {
      "url": "https://your-app.com/webhook-handler"
    }
  }
]

Response

The batch was processed. See the summary and each task's result to learn which tasks succeeded or failed.

successboolean required

Set to true for every batch that was processed successfully; individual tasks inside it can still have failed.

Example response

{
  "success": true,
  "summary": {
    "total": 3,
    "succeeded": 2,
    "failed": 1
  },
  "results": [
    {
      "success": true,
      "task": {
        "id": "b27a21e1-7c39-4aa2-a347-23e828c426f9",
        "taskType": "CHATGPT",
        "status": "QUEUED",
        "priority": 1,
        "createdAt": "2026-04-09T15:00:00.000Z",
        "idempotencyKey": "batch-chatgpt-001"
      },
      "credits": {
        "creditsToCharge": 0.00062
      }
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.