Skip to main content

Batch jobs

Each service has a batch endpoint that accepts a JSON array of up to 1,000 requests in a POST body:
curl -X POST 'https://api.agentfirst.dev/ai/batches' \
-H "Authorization: Bearer $AGENT_FIRST_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
  "prompts": [
    "Where can I buy a vintage guitar?",
    "Help me find guitar repair shops nearby.",
    "Do any local stores sell vinyl records?",
    "[Additional prompts here]"
  ],
  "country": "US",
  "subdivision": "TN"
}'
curl -X POST 'https://api.agentfirst.dev/search/batches' \
-H "Authorization: Bearer $AGENT_FIRST_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
  "terms": ["musical instruments"],
  "country": "US"
}'
curl -X POST 'https://api.agentfirst.dev/browser/batches' \
-H "Authorization: Bearer $AGENT_FIRST_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
  "urls": [
    "https://guitars.com/",
    "https://cartervintage.com/",
    "https://musiccityvintageguitars.com/",
    "[Additional URLs here]"
  ],
  "country": "US",
  "city": "Nashville"
}'
Search, AI, or browsing and geotargeting parameters can be included in the body. In response, the API will provide a job identifier and confirmation of the request count:
{
  "id": "b3829f53-abc9-4e62-8a65-2d9359d586d6",
  "count": 37
}
The job status can be requested any time thereafter by passing back the ID:
curl -H "Authorization: Bearer $AGENT_FIRST_TOKEN" \
'https://api.agentfirst.dev/ai/batches'\
'?id=b3829f53-abc9-4e62-8a65-2d9359d586d6'
curl -H "Authorization: Bearer $AGENT_FIRST_TOKEN" \
'https://api.agentfirst.dev/search/batches'\
'?id=a0482596-c2ad-445a-a435-727002156a20'
curl -H "Authorization: Bearer $AGENT_FIRST_TOKEN" \
'https://api.agentfirst.dev/browser/batches'\
'?id=cfde9b46-f599-49ab-844e-9b2461285284'