Markdown
All docs

Quickstart

Get your first real AI answer in four steps: quote, submit, check progress, read the answers. All you need is an API key.

OpenAPI file

Create a key in the console and export it. Every command below reads it from here.

export API_KEY="your key"
  1. 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
      }'

    max_charge is the most the job can cost, and the amount that will be held when you submit.

  2. Submit the job

    Send the same body with two more headers. Idempotency-Key is an ID you choose: if the connection drops, retry with the same value and no second job is created. X-Max-Price is 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 id from the response:

    export JOB_ID="the id from the response"
  3. Check progress

    Wait for retry_after_seconds between 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"

    counts shows how many answers are in each status; the job is done when pending reaches 0. held is what is still on hold and charged is what has been charged so far.

  4. Read the answers

    Finished answers are available while the job is still running. Check each answer's status before you read its text. [] means none this time and null means 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_cursor is not null, pass it as cursor to 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.

ResultstatusCharged?
There is an answeransweredCharged
No AI answer appearedno_answerCharged; this is a result too
The AI declined to answerrefusedCharged
Not collectedfailedNot charged; the held amount is released
In progresspendingThe cost is on hold, not charged yet
If you get settlement_unknown, billing is not known yet. Ask again with the same Idempotency-Key, never a new one.

Where to go next