API v1
Plinda Engine API
One REST API for AI answer engines, search results and web pages. You queue a task, a worker runs it from the country you pick, and you get back the answer text, its sources and an optional brand analysis. All responses use the same envelope: { "success": true, "data": ... } or { "success": false, "error": ... }.
Base URL: https://promptgale.com
Authentication
Create a key in the dashboard under API keys and send it as a bearer token on every request. Keys start with pk_live_. We store only a hash, so a lost key cannot be recovered; revoke it and create a new one.
Authorization: Bearer pk_live_...Async tasks
POST /v1/async/task validates the request, holds the task price from your balance and returns the task with status QUEUED (201). Poll GET /v1/async/task/{id} until the status is COMPLETED or FAILED, or pass webhookUrl to be called when it finishes. Completed tasks are charged; failed tasks are refunded in full. Retryable engine errors are retried up to 3 attempts before a task fails.
curl -X POST https://promptgale.com/v1/async/task \
-H "Authorization: Bearer $PLINDA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: run-2026-11-21-001" \
-d '{
"taskType": "PERPLEXITY",
"payload": {
"prompt": "Which project management tools are best for agencies?",
"country": "US",
"brand": "Acme",
"competitors": ["Globex", "Initech"]
},
"webhookUrl": "https://example.com/hooks/plinda"
}'{
"success": true,
"data": {
"id": "tsk_8Jx0c2...",
"taskType": "PERPLEXITY",
"status": "QUEUED",
"country": "US",
"credits": 1,
"attempts": 0,
"maxAttempts": 3,
"result": null,
"error": null,
"createdAt": "2026-11-21T12:00:00.000Z"
}
}curl https://promptgale.com/v1/async/task/tsk_8Jx0c2... \
-H "Authorization: Bearer $PLINDA_API_KEY"const API = 'https://promptgale.com';
const headers = { Authorization: `Bearer ${process.env.PLINDA_API_KEY}` };
async function waitFor(id) {
for (;;) {
const res = await fetch(`${API}/v1/async/task/${id}`, { headers });
const { data } = await res.json();
if (data.status === 'COMPLETED' || data.status === 'FAILED') return data;
await new Promise((r) => setTimeout(r, 2000));
}
}Send the same Idempotency-Key header (or idempotencyKey field) to retry a submit safely: the original task is returned with 200. Reusing a key with a different body returns RESOURCE_ALREADY_EXISTS. Submit up to 500 tasks at once with POST /v1/async/task/batch; a batch is accepted or rejected as a whole.
curl -X POST https://promptgale.com/v1/async/task/batch \
-H "Authorization: Bearer $PLINDA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"tasks":[
{"taskType":"CHATGPT","payload":{"prompt":"best crm","country":"US"}},
{"taskType":"GEMINI","payload":{"prompt":"best crm","country":"US"}}
]}'List your tasks with GET /v1/tasks?limit=50&engine=CHATGPT&status=COMPLETED&cursor=... (newest first; pass nextCursor to page). Balance is at GET /v1/credits and daily usage at GET /v1/usage?from=2026-11-01&to=2026-11-30.
Sync tasks
POST /v1/sync/task takes the same body and waits for the result. It answers 200 with the finished task (completed or failed) or, after 290 seconds (or Prefer: wait=N), 202 with the pending task and a Location header so you can keep polling. Prefer async for batches and anything in a job queue.
curl -X POST https://promptgale.com/v1/sync/task \
-H "Authorization: Bearer $PLINDA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"taskType":"GOOGLE_SERP","payload":{"query":"crm for agencies","country":"GB"}}'Task types
taskType is case-insensitive. Aliases: GOOGLE → GOOGLE_AIO, AIMODE → GOOGLE_AIMODE, BING → BING_SEARCH, MICROSOFT_COPILOT → COPILOT, BING_COPILOT → COPILOT, COPILOT_SEARCH → BING_COPILOT_SEARCH, BING_AIMODE → BING_COPILOT_SEARCH, WEB_SEARCH → GOOGLE_SERP, SEARCH → GOOGLE_SERP, PLACES → GOOGLE_PLACES, GOOGLE_MAPS → GOOGLE_PLACES, MAPS → GOOGLE_PLACES. Live status per engine is at GET /v1/capabilities.
| taskType | Engine | Kind | Credits |
|---|---|---|---|
| CHATGPT | ChatGPT | answer | 1 |
| GEMINI | Gemini | answer | 1 |
| PERPLEXITY | Perplexity | answer | 1 |
| COPILOT | Microsoft Copilot | answer | 1 |
| BING_COPILOT_SEARCH | Bing Copilot Search | answer | 1 |
| META_AI | Meta AI | answer | 1 |
| GOOGLE_AIO | Google AI Overview | answer | 1.25 |
| GOOGLE_AIMODE | Google AI Mode | answer | 1.25 |
| GOOGLE_SERP | Google Search | search | 0.3 |
| GOOGLE_NEWS | Google News | search | 0.3 |
| BING_SEARCH | Bing Search | search | 0.3 |
| BRAVE_SEARCH | Brave Search | search | 0.3 |
| GOOGLE_PLACES | Google Places | places | 1 |
| WEB_SCRAPE | Web Scrape | page | 0.3 |
Payload fields
Top-level body fields, shared by every engine:
| Field | Type | Description |
|---|---|---|
| taskType | string | Engine to run. Required. |
| payload | object | Engine input, see below. Required. |
| webhookUrl | string (url) | Called with the finished task. Optional. |
| idempotencyKey | string | Up to 200 characters. Optional. |
| priority | integer 0..10 | Higher runs first within your account. Default 0. |
Answer engines
| Field | Type | Description |
|---|---|---|
| prompt | string | 1 to 4000 characters. Required. |
| country | ISO2 | Market to ask from. Default US. |
| brand | string | Turns on the analysis block (rule-based part). |
| brandAliases | string[] | Other names that count as the brand. |
| brandDomains | string[] | Domains that count as citing the brand. |
| competitors | string[] | Brands to compare against, up to 50. |
| include | object | markdown (default true), html, rawResponse, screenshot, analysis (booleans). analysis: full answer analysis with sentiment, with or without brand. |
Search engines
| Field | Type | Description |
|---|---|---|
| query | string | 1 to 2048 characters. Required. |
| country | ISO2 | Default US. |
| hl | string | Interface language override, for example es. |
| page | integer 1..20 | Result page. Default 1. |
| limit | integer 1..100 | Results per page. Default 10. |
Places
| Field | Type | Description |
|---|---|---|
| query | string | 1 to 500 characters, for example "coworking palermo". Required. |
| country | ISO2 | Default US. |
| hl | string | Interface language override. |
| limit | integer 1..20 | Places to return. Default 10. |
Web scrape
| Field | Type | Description |
|---|---|---|
| url | string (http/https) | Page to fetch. Required. |
| render | boolean | Render JavaScript in a browser. Default false. |
| country | ISO2 | Default US. |
| maxChars | integer | Truncate the extracted text. |
Result schema
data.result is set when a task completes. SERP tasks fill organic (and news for news search), places tasks fillplaces, and both leave text empty; answer tasks fill text, markdown and sources.
| Field | Type | Description |
|---|---|---|
| engine | string | Canonical task type. |
| text | string | Plain answer text. |
| markdown | string? | Answer with formatting kept. |
| sources | Source[] | position, url, domain, title?, snippet?, cited (false = only in the source list), citationNumber?. |
| organic | Organic[]? | position, url, title, domain, snippet?. |
| news | News[]? | position, url, title, source?, date?. |
| places | Place[]? | position, name, url (Google Maps), placeId?, rating?, reviews?, category?, address?, phone?, website?, hours?, lat?, lng?, sponsored?. |
| searchQueries | string[]? | Queries the engine ran, when it shows them. |
| relatedQuestions | string[]? | Follow-up questions the engine suggests, when it shows them. |
| model | string? | Model name when the engine exposes it. |
| analysis | Analysis? | brands (yours and competitors: mentioned, mentions, firstPosition, rank, cited, citedUrls, role, shareOfVoice, recommended, sentiment, sentimentReason), brandsNamed (every brand named, in order), sources (kind: owned, competitor, ugc, news, marketplace, review, reference, other), citationKinds, method, llm. |
| location | object | country, locale, timezone, exitIp?, exitCountry?, proxyLabel?. |
| durationMs | integer | Time spent running the engine. |
| meta | object | captchaSolves, captchaCostUsd, attempts?, notes?, analysisCostUsd?. |
{
"engine": "PERPLEXITY",
"text": "For agencies, the most recommended tools are ...",
"markdown": "For agencies, the most recommended tools are ...",
"sources": [
{ "position": 1, "url": "https://example.com/review", "domain": "example.com",
"title": "Review", "cited": true }
],
"searchQueries": ["project management tools agencies"],
"model": "default",
"analysis": {
"status": "ok",
"brands": [
{ "name": "Acme", "role": "target", "mentioned": true, "mentions": 2,
"firstPosition": 118, "rank": 1, "cited": true, "citedUrls": ["https://acme.com/"] }
]
},
"location": { "country": "US", "locale": "en-US", "timezone": "America/New_York",
"exitCountry": "US", "proxyLabel": "us-1" },
"durationMs": 14210,
"meta": { "captchaSolves": 0, "captchaCostUsd": 0, "attempts": 1 }
}Errors
Errors use the HTTP status below and a stable code. A task that fails while running is not an HTTP error: it ends with status FAILED and an error object.
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "request validation failed",
"details": [{ "path": "payload.prompt", "message": "Too small: expected string to have >=1 characters" }],
"timestamp": "2026-11-21T12:00:00.000Z"
}
}| Code | HTTP | Meaning |
|---|---|---|
| VALIDATION_ERROR | 400 | The body or a parameter is invalid. details lists each field. |
| MISSING_API_KEY | 401 | No Authorization header. |
| INVALID_API_KEY | 401 | The key is unknown or revoked. |
| INSUFFICIENT_CREDITS | 402 | Not enough available credits, or the key reached its daily limit. |
| FORBIDDEN | 403 | The request is not allowed (for example a cross-origin form post). |
| RESOURCE_NOT_FOUND | 404 | No task with that id in your account. |
| RESOURCE_ALREADY_EXISTS | 409 | The idempotency key was already used with a different request. |
| LOCATION_UNSUPPORTED | 422 | The engine does not take that location field (state, uule, city or location), or does not support grids. |
| REGION_UNSUPPORTED | 422 | The engine cannot run from that country (details.cause no_exit). Not retryable; see /v1/countries?taskType=. |
| EVIDENCE_UNSUPPORTED | 422 | |
| ENGINE_UNAVAILABLE | 503 | The engine is turned off for now. Check /v1/capabilities. |
| QUEUE_LIMIT_EXCEEDED | 429 | Too many pending tasks on the account. Wait for some to finish. |
| INTERNAL_ERROR | 500 | Something failed on our side. Safe to retry. |
| GOOGLE_REDIRECT_UNRESOLVED | 502 |
Task error codes: CAPTCHA_UNSOLVED SIGNIN_WALL LOGIN_WALL BLOCKED TIMEOUT NO_ANSWER PROXY_ERROR NAVIGATION UNSUPPORTED INTERNAL ACCOUNT_LOGGED_OUT ENGINE_REFUSED CONSENT_WALL AGE_GATE LOCATION_UNSUPPORTED NO_PROXY EXITS_UNAVAILABLE LEASE_EXPIRED TASK_CANCELLED INSUFFICIENT_CREDITS
Batches
POST /v1/batches takes up to 10,000 items ({ items: [{ customId?, taskType, payload, idempotencyKey?, webhookUrl? }], idempotencyKey?, webhookUrl?, metadata? }). Every item is checked first; one bad item refuses the whole batch with the failing indexes. Items are queued as room frees up: each account keeps at most twice its concurrency limit of batch tasks queued or running, accounts and batches take turns, and your single tasks go before queued batch tasks of the same priority. Credits are held per item when it is queued; an item you cannot pay for at that moment ends rejected with INSUFFICIENT_CREDITS. The same idempotencyKey within 30 days returns the first batch. Follow it with GET /v1/batches/{id} (counts, percent, credits held and charged) and read GET /v1/batches/{id}/items?status=&cursor=&include=result. When every item has finished, webhookUrl gets{"event":"batch.completed","data":<batch>}, signed like task webhooks over ${batchId}.${timestamp}.${rawBody}.
Evidence pages
payload.include.html: true saves the screen the engine showed for the answer as one self-contained page (styles and images inlined, scripts removed) at result.htmlUrl; result.evidence has its status, format and expiry. Pages open without an API key for 30 days, are not indexed and run no scripts. +0.25 credit, charged only when the page was saved. Engines: CHATGPT, GEMINI, PERPLEXITY, META_AI, COPILOT, GOOGLE_AIO, GOOGLE_AIMODE, GOOGLE_SERP, BING_COPILOT_SEARCH; others answer 422 EVIDENCE_UNSUPPORTED. include.rawHtml returns the page HTML inline instead.
Queue, stats and utilities
GET /v1/async/status: your queued and running tasks, batch items not queued yet, concurrency used and limit. DELETE /v1/async/queue: cancels every queued task (FAILED with TASK_CANCELLED, credits released) and pending batch item. GET /stats?hours=24: counts by status and engine, success rate, durations, top errors. GET /capacity: per engine status, queue depth and usable accounts. POST /v1/google/goto {"url":"https://www.google.com/goto?url=..."}: the page a Google redirect leads to (no credits). WEB_SCRAPE returns result.page (metadata, JSON-LD, images) and with maxAge (seconds) serves a cached read (result.cached). Agents: /llms.txt, /llms-full.txt, /.well-known/agent-skills/.
Webhooks
When a task with webhookUrl finishes we POST the task to that URL. Any 2xx response counts as delivered. Other responses and timeouts (30 s) are retried 4 more times, after 2, 4, 8 and 16 minutes.
{
"event": "task.completed", // or "task.failed"
"data": { "id": "tsk_...", "status": "COMPLETED", "result": { ... }, ... }
}| Field | Type | Description |
|---|---|---|
| plinda-webhook-id | header | Unique per delivery attempt. Use it to deduplicate. |
| plinda-webhook-timestamp | header | Unix seconds when the request was signed. |
| plinda-webhook-signature | header | v1,<base64 HMAC-SHA256>. Key: the signing secret of the API key that created the task. |
The signed message is ${taskId}.${timestamp}.${rawBody}. Compute it over the raw request body, before any JSON parsing.
import crypto from 'node:crypto';
import express from 'express';
const app = express();
const SECRET = process.env.PLINDA_SIGNING_SECRET; // shown once when the key is created
// Keep the raw body: the signature covers the exact bytes we sent.
app.post('/hooks/plinda', express.raw({ type: 'application/json' }), (req, res) => {
const raw = req.body.toString('utf8');
const timestamp = req.header('plinda-webhook-timestamp');
const signature = req.header('plinda-webhook-signature') ?? '';
const event = JSON.parse(raw);
// Reject old deliveries (replay protection): 5 minutes of tolerance.
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return res.sendStatus(400);
const expected = crypto
.createHmac('sha256', SECRET)
.update(`${event.data.id}.${timestamp}.${raw}`)
.digest('base64');
const given = signature.replace(/^v1,/, '');
const ok =
given.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(given), Buffer.from(expected));
if (!ok) return res.sendStatus(401);
// Deduplicate on plinda-webhook-id, then handle event.data
res.sendStatus(200);
});Countries
Pass any ISO 3166-1 alpha-2 code as payload.country. Locale, timezone and language headers follow the country. Search engines serve every country (by URL parameters when we have no exit there); chat engines need an exit in the country. GET /v1/countries?taskType=CHATGPT lists what an engine accepts. Finer locations: payload.state (US, +1 credit, GET /v1/states?country=US), payload.uule and payload.city (Google engines), payload.location (a point, +1 credit), and location grids with POST /v1/async/task/grid.
MCP
The MCP server speaks streamable HTTP at https://promptgale.com/mcp and uses the same API key as a bearer token. Tools: run_prompt submit_prompt get_task web_search web_scrape get_credits get_usage get_capabilities list_countries list_states submit_location_grid get_location_grid.
claude mcp add --transport http plinda https://promptgale.com/mcp \
--header "Authorization: Bearer pk_live_..."{
"mcpServers": {
"plinda": {
"url": "https://promptgale.com/mcp",
"headers": { "Authorization": "Bearer pk_live_..." }
}
}
}OpenAPI
The machine-readable contract is at /v1/openapi.json (OpenAPI 3.1). Use it to generate a client or import it into your API tool.