Quickstart
1. Get an API key
Sign in to the dashboard and create a key on the API keys page. The key is shown once, so store it as a secret. Every new account gets 100 free requests, usable on every live engine, ChatGPT in this guide included; after that, requests are paid from a balance you top up on the Billing page.
export API_KEY=sk_...
Install an SDK, or skip this and use curl. The TypeScript SDK runs on Node 18+, Deno, Bun and browsers; the Python SDK needs Python 3.10+.
npm install @answerline/sdk
pip install answerline
2. Make a synchronous call
A monitor endpoint waits for the engine's answer and returns it in the response. Pass your API base URL, https://api.answerline.dev, to the SDK client.
curl -X POST "https://api.answerline.dev/v1/monitor/chatgpt" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt":"iPhone 17 or Galaxy S26?","country":"US","include":{"markdown":true}}'
import { Client } from "@answerline/sdk";
const client = new Client({ apiKey: process.env.API_KEY!, baseUrl: "https://api.answerline.dev" });
const answer = await client.chatgpt({ prompt: "iPhone 17 or Galaxy S26?", country: "US", include: { markdown: true } });
console.log(answer.result);
import os
from answerline import Client
client = Client(os.environ["API_KEY"], base_url="https://api.answerline.dev")
answer = client.chatgpt("iPhone 17 or Galaxy S26?", "US", include={"markdown": True})
print(answer["result"]["markdown"])
The response is {"success": true, "result": {…}}; the fields of result are listed on each engine's page, for example
ChatGPT. A synchronous call can take up to five minutes
($0.0006 for this one at Starter), and stays open until the engine answers.
3. Target a market
Set country (ISO 3166-1 alpha-2) on every request. Gemini also takes a US state; ChatGPT answers at country level. Google Search, Google News and AI Mode add
hl for the interface language, and Google Search and AI Mode take a city in location or uule; each engine page lists its request options. List the countries an engine supports
and the US states:
curl -X GET "https://api.answerline.dev/v1/countries?model=chatgpt" \ -H "Authorization: Bearer $API_KEY" curl -X GET "https://api.answerline.dev/v1/states?country=US" \ -H "Authorization: Bearer $API_KEY"
const countries = await client.countries("chatgpt");
const states = await client.states("US");
countries = client.countries("chatgpt")
states = client.states("US")
4. Queue a task and poll
An async task runs the same request in the background and answers at once with the task's id. Tasks run in order as engine capacity frees up and
cost the same as a synchronous call. An idempotencyKey makes creating the task safe to repeat.
curl -X POST "https://api.answerline.dev/v1/async/task" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"taskType":"CHATGPT","payload":{"prompt":"iPhone 17 or Galaxy S26?","country":"US"},"idempotencyKey":"iphone-galaxy-us-2026-09-15"}'
curl -X GET "https://api.answerline.dev/v1/async/task/$TASK_ID" \
-H "Authorization: Bearer $API_KEY"
const { task } = await client.createTask({
taskType: "CHATGPT",
payload: { prompt: "iPhone 17 or Galaxy S26?", country: "US" },
idempotencyKey: "iphone-galaxy-us-2026-09-15",
});
const done = await client.waitForTask(task.id);
console.log(done.task.status, done.credits.creditsCharged, done.response);
created = client.create_task("CHATGPT", {"prompt": "iPhone 17 or Galaxy S26?", "country": "US"}, idempotency_key="iphone-galaxy-us-2026-09-15")
done = client.wait_for_task(created["task"]["id"])
print(done["task"]["status"], done["credits"]["creditsCharged"], done.get("response"))
A task moves from QUEUED to PROCESSING to COMPLETED or FAILED. Once it has finished, response holds
the engine's result or the error. waitForTask and wait_for_task poll with backoff for up to 11 minutes by default.
5. Receive results by webhook
Add a webhook URL and the finished task is sent to it, signed with your account's secret, so you don't have to poll. The URL must use https and
resolve to a public address. Verify each delivery as the webhooks guide shows before trusting it.
curl -X POST "https://api.answerline.dev/v1/async/task" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"taskType":"CHATGPT","payload":{"prompt":"iPhone 17 or Galaxy S26?","country":"US"},"webhook":{"url":"https://your-app.com/hooks/answers"}}'
await client.createTask({
taskType: "CHATGPT",
payload: { prompt: "iPhone 17 or Galaxy S26?", country: "US" },
webhook: { url: "https://your-app.com/hooks/answers" },
});
client.create_task("CHATGPT", {"prompt": "iPhone 17 or Galaxy S26?", "country": "US"}, webhook_url="https://your-app.com/hooks/answers")
Next steps
- Async tasks and batches: batches, priorities, idempotency and the queue.
- Authentication and errors: error codes and which requests to retry.
- Rate limits: the queue, concurrency and limit headers.
- Balance and pricing: what each request costs.
- MCP server and integrations: use the API from agents and automation tools.