Quickstart
Get your first real AI answer in four steps: quote, submit, check progress, read the answers. All you need is an API key.
Create a key in the console and export it. Every command below reads it from here.
export API_KEY="your key"
Get a quote
A quote creates no job and holds no money. This example asks one question 3 times on ChatGPT web and 3 times on Perplexity web, 6 answers in all.
curl https://api.askcrawl.com/v1/answers/quote \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompts": ["best crm for small business"], "engines": ["chatgpt.web", "perplexity.web"], "samples": 3 }'{ "code": "ok", "request_id": "…", "data": { "item": { "answers": 6, "max_charge": "0.015", "currency": "USD", "engines": [ { "engine": "chatgpt.web", "answers": 3, "price": "0.0018" }, { "engine": "perplexity.web", "answers": 3, "price": "0.0032" } ] } } }max_chargeis the most the job can cost, and the amount that will be held when you submit.Submit the job
Send the same body with two more headers.
Idempotency-Keyis an ID you choose: if the connection drops, retry with the same value and no second job is created.X-Max-Priceis your ceiling: if the job could cost more, it is not submitted and nothing is charged. A submitted job cannot be cancelled.curl https://api.askcrawl.com/v1/answers \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: my-first-job" \ -H "X-Max-Price: 0.02" \ -d '{ "prompts": ["best crm for small business"], "engines": ["chatgpt.web", "perplexity.web"], "samples": 3 }'You get a job ID straight away, before any answer has been collected. Keep the
idfrom the response:export JOB_ID="the id from the response"
Check progress
Wait for
retry_after_secondsbetween checks instead of polling in a tight loop. Some platforms answer in seconds; others take minutes or longer.curl https://api.askcrawl.com/v1/jobs/$JOB_ID \ -H "Authorization: Bearer $API_KEY"
countsshows how many answers are in each status; the job is done whenpendingreaches 0.heldis what is still on hold andchargedis what has been charged so far.Read the answers
Finished answers are available while the job is still running. Check each answer's
statusbefore you read its text.[]means none this time andnullmeans not available or unknown, so neither should be counted as zero.curl "https://api.askcrawl.com/v1/answers?job_id=$JOB_ID" \ -H "Authorization: Bearer $API_KEY"
Answers come 20 to a page. While
page.next_cursoris notnull, pass it ascursorto get the next page.
What you pay for
The maximum cost is held when you submit, and each answer is settled on its own. The hold on any answer that was not collected is released.
| Result | status | Charged? |
|---|---|---|
| There is an answer | answered | Charged |
| No AI answer appeared | no_answer | Charged; this is a result too |
| The AI declined to answer | refused | Charged |
| Not collected | failed | Not charged; the held amount is released |
| In progress | pending | The cost is on hold, not charged yet |
settlement_unknown, billing is not known yet. Ask again with the same Idempotency-Key, never a new one.Where to go next
- Connect an AI assistant and let it quote and collect for you, with no code.
- Sampling and intervals explains how many runs a conclusion needs.
- Brand reports and comparisons turn answers into mention and citation rates.
- Errors and charges covers every error code and what to do about it.