Skip to content
Longplay
Docs
Browse docs / Funnel decision HTTP reference
On this page

Funnel decision HTTP reference

HTTP headers, JSON payloads, response statuses, and recovery for campaign_decide, read_decision, and report_used.

Markdown
API v1

Endpoint and headers#

All three operations are sent from your backend to the same endpoint. Angle brackets are template values; obtain the App UUID, Server Key, Funnel UUID, and user ID from real configuration and trusted identity.

request.httpShell
POST https://api.longplayai.com/api/v1/funnelsAuthorization: Bearer <SERVER_KEY>Content-Type: application/jsonX-Indiana-Project: <APP_UUID>X-Indiana-Environment: sandboxX-Indiana-Protocol: 0.10
Operations in this path
operationSuccess HTTPPurpose
campaign_decide200 or 202Accept a decision; 202 means processing continues
read_decision200 or 202Read an accepted decision by decisionId
report_used200Record caller-reported adoption

Operations in this path

  • campaign_decide

    Success HTTP
    200 or 202
    Purpose
    Accept a decision; 202 means processing continues
  • read_decision

    Success HTTP
    200 or 202
    Purpose
    Read an accepted decision by decisionId
  • report_used

    Success HTTP
    200
    Purpose
    Record caller-reported adoption

Responses include X-Request-Id and Cache-Control: no-store. A 202 response includes Retry-After: 1. Send Prefer: respond-async to receive a pending status immediately.

Decide#

Fill attributes with registered business facts verified by your backend. The empty object below only shows the request shape. customer may also be { type: "id", value: "<CUSTOMER_UUID>" }. For a missing externalUserId, optional customerData applies only when creating the Customer.

decide.request.jsonJSON
{  "operation": "campaign_decide",  "funnelId": "<PUBLISHED_FUNNEL_UUID>",  "requestId": "<PERSISTED_REQUEST_UUID>",  "customer": {    "type": "externalUserId",    "value": "<VERIFIED_USER_ID>"  },  "attributes": {}}

Example completed response. The published Funnel defines the value and its data fields.

decide.response.jsonJSON
{  "scope": {    "projectId": "<APP_UUID>",    "environment": "sandbox"  },  "decisionId": "<DECISION_UUID>",  "requestId": "<PERSISTED_REQUEST_UUID>",  "status": "completed",  "decision": {    "requestId": "<PERSISTED_REQUEST_UUID>",    "decisionId": "<DECISION_UUID>",    "customerId": "<CUSTOMER_UUID>",    "externalUserId": "<VERIFIED_USER_ID>",    "versionId": "<PUBLISHED_VERSION_UUID>",    "receiptId": "<RECEIPT_UUID>",    "value": {      "type": "bundle",      "data": {        "recommendedPlan": "pro",        "annualOffers": [{ "plan": "pro", "percentOff": 20 }]      },      "offering": null,      "coupons": [],      "paywall": null    }  }}

For a 202 / pending response, retain decisionId and call read_decision on the same endpoint, or let the SDK poll. Reuse the original requestId when retrying.

decide.pending.jsonJSON
{  "scope": { "projectId": "<APP_UUID>", "environment": "sandbox" },  "decisionId": "<DECISION_UUID>",  "requestId": "<PERSISTED_REQUEST_UUID>",  "status": "pending",  "decision": null}

Read a pending decision#

After receiving a decisionId with pending status, read it with the same Server Key, App, and environment. The response uses the same shape as the Decide responses above. Do not generate a new campaign_decide requestId.

read-decision.request.jsonJSON
{  "operation": "read_decision",  "decisionId": "<DECISION_UUID_FROM_DECIDE>"}

Adoption receipt: report_used#

Use the decide decisionId. eventId is a persisted UUID for the adoption fact; occurredAt is the actual ISO 8601 occurrence time. Retry with the same eventId, occurrence time, and reference. This records a caller statement; it does not prove payment or issue a Coupon.

receipt.request.jsonJSON
{  "operation": "report_used",  "decisionId": "<DECISION_UUID_FROM_DECIDE>",  "eventId": "<PERSISTED_EVENT_UUID>",  "occurredAt": "<ACTUAL_TIME_ISO_8601>",  "reference": "<ORDER_OR_SUBSCRIPTION_ID>"}
receipt.response.jsonJSON
{  "scope": { "projectId": "<APP_UUID>", "environment": "sandbox" },  "decisionId": "<DECISION_UUID_FROM_DECIDE>",  "eventId": "<PERSISTED_EVENT_UUID>",  "source": "caller_reported"}

Errors and recovery#

What to check first
HTTP / codeAction
400 / INVALID_REQUESTCheck operation, UUIDs, attributes, and JSON body.
401 / UNAUTHENTICATEDCheck that the Server Key is complete and valid, and that the request has no browser Origin.
403 / FORBIDDENCheck the Key's App/environment and customers:write, sessions:create, and funnels:run; Paywall or Offering steps also need entitlements:read, buying from a Paywall needs billing:read and billing:write, and Coupons need offers:resolve.
409 / CONFLICTA paused Funnel accepts no new decisions; show it as temporarily unavailable. Replaying the original requestId still returns the original result.
202 / pendingKeep the decisionId and read the original decision after Retry-After.

What to check first

  • 400 / INVALID_REQUEST

    Action
    Check operation, UUIDs, attributes, and JSON body.
  • 401 / UNAUTHENTICATED

    Action
    Check that the Server Key is complete and valid, and that the request has no browser Origin.
  • 403 / FORBIDDEN

    Action
    Check the Key's App/environment and customers:write, sessions:create, and funnels:run; Paywall or Offering steps also need entitlements:read, buying from a Paywall needs billing:read and billing:write, and Coupons need offers:resolve.
  • 409 / CONFLICT

    Action
    A paused Funnel accepts no new decisions; show it as temporarily unavailable. Replaying the original requestId still returns the original result.
  • 202 / pending

    Action
    Keep the decisionId and read the original decision after Retry-After.

Error responses contain requestId and an error object. Follow error.code, retryable, and recovery, and retain X-Request-Id for support. When acceptance is unknown, retry the original requestId and complete input; do not create a second decision with a new ID.