Report outcomes
Report each stage your product's users reach to the outcomes API, with the visit token when you have one, so Handline can trace results and send conversions.
Report an outcome every time someone reaches one of the product's stages: signed up, activated, paid, or for a sales-led product, a lead, a meeting, an opportunity or a win. Report it from your server, with or without a token.
Before you start#
- The product key. An owner or admin creates it on Keys in the product's settings. It starts with
hl_prod_and is shown once. Keep it on your server, such as inHANDLINE_PRODUCT_KEY. It can only report outcomes and delete a visitor's data. - The product id. It is in the product's address in Handline,
/p/<product id>/, and starts withprd_. - The stage ids. They are set on Outcome stages:
signed-up,activatedandpaidfor a self-serve product;lead,meeting,opportunityandwonfor a sales-led one, unless your team changed them.
Send the request#
POST https://app.handline.io/api/v1/products/{productId}/outcomes, operation outcomes.report, with Authorization: Bearer <product key> and a JSON body.
curl https://app.handline.io/api/v1/products/prd_01J…/outcomes \ -H "Authorization: Bearer $HANDLINE_PRODUCT_KEY" \ -H "content-type: application/json" \ -d '{"stage":"signed-up","externalId":"acct_8812","token":"v1.eyJ…","occurredAt":"2026-11-22T09:14:03Z"}'With the helper package, reportOutcome sends the same request.
- stagestringRequired
One of the product's live stages. A retired or unknown stage is refused, with the stages you can use.
- externalIdstringRequired
Your own opaque id for who reached the stage, such as the account id, 1 to 200 characters. Never an email or a name: an id that looks like an email is refused.
- tokenstring or null
The visit token kept at sign-up, up to 400 characters. Leave it out, or send
null, when there is none.- occurredAtstring
When it happened, ISO 8601 with an offset. Defaults to when Handline receives it. An outcome more than 90 days old is recorded as late.
- valueobject
{ "amount": 49, "currency": "EUR" }: a non-negative amount and a three-letter currency code. Kept only for stages that carry a value, such aspaid.- hashedEmailstring
SHA-256, as 64 lower-case hex characters, of the trimmed, lower-case email. Handline forwards it to an ad platform only when the product allows it and the visitor consented, and never stores it. A plain email is refused.
- testboolean
A test outcome while setting up: shown on the set-up checklist, never in results, never sent on.
Read the answer#
{ "outcome": { "id": "out_3f…", "stage": "signed-up", "traced": true, "late": false, "test": false, "inherited": false }, "duplicate": false, "conversions": [{ "id": "cnv_…", "channelId": "meta", "status": "queued", "reason": null }]}tracedis whether Handline joined the outcome to a visit.inheritedis true when a later stage had no token and was joined through an earlier stage with the sameexternalId.conversionslists what goes to the ad platform the visit came from. Each isqueued, ornot_sentorrejectedwith the reason, such as no consent or the platform's age limit.
Rules that make retries safe#
- The same stage and
externalIdis recorded once. Reporting it again answers"duplicate": trueand changes nothing, so retry freely. - A later stage can leave out the token. Report it with the same
externalId, and Handline joins it to the visit of the earlier traced stage. - One click converts once per stage. A second account on the same token is recorded, but sends no second conversion.
- Report every outcome, traced or not. Handline shows the share it can trace; a sudden drop opens a work item.
Errors and limits#
Every error has error.code, error.message and error.next, which says what to do, and error.details naming each field to fix.
| Status | Means |
|---|---|
| 400 | The body is not valid. error.details says which field and how to fix it. |
| 401 | No valid key. Send Authorization: Bearer <product key>. |
| 403 or 404 | The key can't call this route, or the product isn't the key's. |
| 429 | Rate limited: a product key may make 1,200 calls a minute. Retry after the seconds in retry-after. |
Later stages from a CRM or an agent#
For a sales-led product, your CRM or your agent reports meeting, opportunity and won the same way. Use the externalId and token from the lead form delivery. An agent key with the report scope can call the MCP tool outcomes_report.
Delete one visitor's data#
With the same product key, POST /api/v1/products/{productId}/privacy/delete (operation privacy.deleteVisits) with { "token": "v1.…" } or { "outcomeId": "out_…" }. See delete data.
Was this page helpful?