Skip to main content
GET
https://api.keywordsai.co
/
api
/
v1
/
batches
import requests
import json

url = "https://api.keywordsai.co/api/v1/batches/"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "X-Data-Keywordsai-Params": json.dumps({
        "customer_identifier": "user123"
    })
}
params = {"limit": 10}

response = requests.get(url, headers=headers, params=params)
print(response.json())
{
  "object": "list",
  "data": [
    {
      "id": "batch_abc123",
      "object": "batch",
      "endpoint": "/v1/chat/completions",
      "status": "completed",
      "created_at": 1711471533,
      "completed_at": 1711493163,
      "request_counts": {
        "total": 100,
        "completed": 95,
        "failed": 5
      }
    },
    {
      "id": "batch_def456",
      "object": "batch",
      "endpoint": "/v1/chat/completions",
      "status": "in_progress",
      "created_at": 1711475163,
      "request_counts": {
        "total": 50,
        "completed": 23,
        "failed": 0
      }
    }
  ],
  "first_id": "batch_abc123",
  "last_id": "batch_def456",
  "has_more": false
}
Retrieve a list of all batch jobs for your organization. Use this to monitor the status of multiple batches or find specific batch IDs.
Customer credentials required: This endpoint requires your own OpenAI API key configured in Keywords AI dashboard (Settings → Providers).

Keywords AI parameters

You can pass Keywords AI tracking parameters via the X-Data-Keywordsai-Params header:
-H "X-Data-Keywordsai-Params: {\"customer_identifier\": \"user123\"}"

Query parameters

limit
integer
default:20
Maximum number of batches to return.
?limit=10
after
string
Cursor for pagination. Use the last_id from a previous response to get the next page.
?after=batch_def456

Response

Returns a list object containing batch metadata.
{
  "object": "list",
  "data": [
    {
      "id": "batch_abc123",
      "object": "batch",
      "endpoint": "/v1/chat/completions",
      "status": "completed",
      "created_at": 1711471533,
      "completed_at": 1711493163,
      "request_counts": {
        "total": 100,
        "completed": 95,
        "failed": 5
      }
    },
    {
      "id": "batch_def456",
      "object": "batch",
      "endpoint": "/v1/chat/completions",
      "status": "in_progress",
      "created_at": 1711475163,
      "request_counts": {
        "total": 50,
        "completed": 23,
        "failed": 0
      }
    }
  ],
  "first_id": "batch_abc123",
  "last_id": "batch_def456",
  "has_more": false
}
import requests
import json

url = "https://api.keywordsai.co/api/v1/batches/"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "X-Data-Keywordsai-Params": json.dumps({
        "customer_identifier": "user123"
    })
}
params = {"limit": 10}

response = requests.get(url, headers=headers, params=params)
print(response.json())