POST /v1/decide — request a CrawlClick placement
POST the question, its topics and a brand-safety flag to /v1/decide with your ccp_ key; CrawlClick answers 200 with either a disclosed fill and a decision_id valid for 15 minutes, or "filled" false.
Status: Coming. POST /v1/decide is the call a partner makes at the moment it answers a question. It asks CrawlClick whether a sponsored placement fits, and returns one with its disclosure, or says there is none. The route is built and tested but not yet open to partners: CrawlClick issues the base URL and your ccp_… key when the service opens. This page covers the request, both kinds of answer, the limits on your account, and the refusals. To confirm a placement you showed, see Sign a receipt.
POST/v1/decideComing
Ask for a labelled sponsored placement to show in an answer you are about to return.
- Host
- https://<issued with your partner key>
- Authentication
Authorization: Bearer ccp_…with thedecidescope.- Source
- api-crawlclick-com/crates/crawlclick/src/decision_api.rs
Request body (JSON)
| Field | Type | Description |
|---|---|---|
| queryoptional | string | The question being answered. Truncated to 500 characters. |
| topicsoptional | string[] | Topics of the answer. At most 30 are read; each is trimmed and lower-cased, and any longer than 60 characters is dropped. |
| urloptional | string | Your own reference to where the answer appears. Truncated to 2048 characters. |
| safeoptional | boolean | Defaults to true. Send false when the context is not brand-safe, so campaigns that exclude unsafe contexts are skipped. |
Responses
200 · A placement. Show disclosure.passage and confirm it with a receipt before expires_at.
{"filled": true, "decision_id": "ccx1.…", "expires_at": 1795000000, "sponsored": true, "disclosure": {"format": "inline_prefix", "label": "Sponsored", "passage": "…", "advertiser": "…"}, "campaign_id": "…", "creative_id": "…", "landing_url": "https://…", "price_micros": 2400, "marker": "…"}200 · Nothing eligible. Answer without a placement.
{"filled": false}200 · Your account reached its daily cap of fills. Fills resume at the next UTC day.
{"filled": false, "reason": "daily_fill_cap"}Refusals
| Status | Code | Means | Do instead |
|---|---|---|---|
| 401 | invalid_key | The bearer token is missing, unknown, revoked, or lacks the scope this route needs. | Send Authorization: Bearer ccp_… with the key CrawlClick issued. A rotated or revoked key stops working within about ten seconds; ask CrawlClick for a new one. |
| 429 | rate_limited | Your per-minute request limit, set on your partner account, was exceeded. | Back off and retry. The limit is a token bucket that refills continuously at your per-minute rate, counted per partner and separately for decisions and receipts. |
| 413 | — | The body is over 65,536 bytes. The body is {"error": "body too large"}, with no code. | Send only the documented fields. Truncate query and topics on your side. |
| 503 | — | The service is at capacity. The body is empty and Retry-After: 1 is set. | For a decision, answer without a placement. For a receipt, retry after a second. |
| 400 | bad_request | The body is not JSON of this shape. An empty body is accepted and treated as {"safe": true}. | Send a JSON object with only the four documented fields. consumer, channel and tier are ignored if sent: they are fixed on your account. |
How do I call /v1/decide with curl?
Send a JSON object with a bearer key that has the decide scope. Every field is optional.
curl -sS -X POST "$CRAWLCLICK_DECISION_URL/v1/decide" \
-H "Authorization: Bearer $CRAWLCLICK_PARTNER_KEY" \
-H "Content-Type: application/json" \
--max-time 1 \
-d '{"query": "best crm for a two-person startup", "topics": ["crm"], "url": "https://your.app/thread/123", "safe": true}'
A fill looks like this. The values are the ones the API contract uses as its example:
{
"filled": true,
"decision_id": "ccx1.…",
"expires_at": 1795000000,
"sponsored": true,
"disclosure": {
"format": "inline_prefix",
"label": "Sponsored",
"passage": "Sponsored: Acme CRM sets up in 5 minutes for two-person teams.",
"advertiser": "acme.example"
},
"campaign_id": "acme",
"creative_id": "acme-1",
"landing_url": "https://acme.example/crm",
"price_micros": 2400,
"marker": "acme-crm"
}
What does CrawlClick do with each request field?
The service normalises the body before it matches campaigns, and it never rejects a request for a field being too long:
queryis cut to 500 characters. It is the question you are answering, used to match campaigns.topicsis read up to 30 entries. Each one is trimmed and lower-cased; an entry that is empty after trimming, or longer than 60 characters, is dropped rather than refused. Topics are what most campaigns target, so send the two or three that describe the answer.urlis cut to 2,048 characters. It is your own reference to where the answer appears, such as a thread URL. CrawlClick stores it with the confirmed serve, so it shows up in reconciliation; it does not need to be public.safedefaults totrue. Sendfalsewhen the conversation is not brand-safe. Campaigns that exclude unsafe contexts are then skipped.
An empty body is accepted and treated as "safe": true with nothing else. Fields the service does not know are ignored, including consumer, channel and tier: those are fixed on your partner account. A body that is not JSON, or a known field of the wrong type (for example topics sent as a string), gets 400 bad_request.
What is in a fill, and which fields do I use?
decision_idis the token you sign in the receipt. Store it exactly as returned.expires_atis a Unix time in seconds, 900 seconds after the decision was made. A receipt has to arrive before it.disclosureis what you show.passageis the sentence to render, and it starts with “Sponsored:”.labelis always “Sponsored”,formatis alwaysinline_prefix, andadvertiseris the advertiser’s landing domain. The rules are on Show the disclosure.landing_urlis the advertiser’s page for the placement.campaign_id,creative_idandmarkeridentify what was shown. Write them to your serve log.price_microsis the price the placement cleared at, in integer micro-dollars (1 USD is 1,000,000). It is the advertiser’s price for a confirmed serve, not your earnings; your share is set in your partner agreement.
What is the decision_id token, and can I read it?
A decision_id has three dot-separated parts: the prefix ccx1, the decision’s claims as unpadded base64url JSON, and an HMAC-SHA256 tag over the prefix and the claims, also unpadded base64url. The claims carry the decision id, your partner id, the campaign, creative, price and expiry. The middle part is readable, because it is encoded rather than encrypted, but treat the whole token as opaque. Changing any byte breaks the tag, and the receipt is then refused with 400 invalid_decision. Use the response fields above rather than decoding the claims, so a later token version cannot break your code.
Why did I get “filled” false?
A 200 with "filled": false is a normal answer, not an error. Show your answer without a placement. It happens when:
- no funded, reviewed campaign targets the question, its topics or your channel;
safewasfalseand the matching campaigns exclude unsafe contexts;- the winning creative has no text or no landing domain, so it cannot carry a disclosure;
- your account reached its daily fill cap, in which case the body also has
"reason": "daily_fill_cap".
Do not retry a no-fill for the same answer: the same request against the same campaigns gives the same result.
How do the daily fill cap and the rate limit work?
The daily fill cap limits how many fills your account gets per UTC day. Each node of the decision service counts the fills it hands you and stops filling at your cap until the next UTC day; a no-fill does not count. Because each node counts separately, the cap is then applied exactly at settlement, across all nodes, to confirmed serves. Confirmed serves beyond the cap are recorded as refused and are not paid. A fill counts towards a node’s count whether or not you confirm it, so call /v1/decide when you are about to answer, not speculatively.
The rate limit is a per-minute number set on your partner account. It works as a token bucket: you can send up to that many requests at once, and capacity refills continuously at the per-minute rate. Decisions and receipts are counted in separate buckets, so a burst of decisions cannot block your receipts. A request over the limit gets 429 rate_limited. No rate-limit headers are sent. The check happens before the body is parsed, so a malformed request still uses up capacity.
How fast is /v1/decide, and what timeout should I use?
A decision is made from data the service keeps in memory: the partner directory, the reviewed campaigns and the budget available on that node. No database is read on the request path. Your answer should never wait on an ad, though. Set a client timeout that fits your own latency budget, and if the call is slow, fails, or returns anything other than 200, show the answer without a placement. Do not retry /v1/decide inside the answer path. The reference client does exactly this.
What should I do with each refusal?
401 invalid_key: the key is missing, unknown, revoked, or lacks thedecidescope. CheckCRAWLCLICK_PARTNER_KEY; if it was rotated, ask CrawlClick for the new one. Retrying will not help.429 rate_limited: answer without a placement. Spread requests out or ask CrawlClick to review your limit.400 bad_request: fix the body. The same body fails the same way every time.
The full list, shared with the other routes, is on the errors reference.