supapulsedocs
API referenceError codes

Error codes

Every error the Supapulse ingest API returns, what causes it, and how to fix it.

Format

Most errors are JSON with one error field:

{ "error": "Invalid API token" }

Validation errors (422) use Laravel's format:

{
  "message": "The selected type is invalid.",
  "errors": {
    "type": ["The selected type is invalid."]
  }
}

Status codes

StatusErrorCauseFix
202noneAccepted and queued.Nothing. The body is { "success": true }.
401Missing API tokenNo X-API-Token header and no token field.Send the token.
401Invalid token formatThe token doesn't start with pub_ or sec_.Check for quotes, spaces or a truncated value.
401Invalid API tokenNo active site has this token. It was regenerated, mistyped, or the site was deleted.Copy the token again from the site's settings.
402This site's team has no active plan.The site's team has no active plan or trial. The body also has "code": "plan_inactive".Start a plan or trial.
402This team reached its monthly event limit.The team used more than its plan's monthly events plus a 10% grace. The body has "code": "quota_exceeded". Not returned for revenue.Upgrade, or wait for the monthly reset.
403Origin not allowedThe Origin (or Referer) host isn't the site's domain or a subdomain of it.Fix the domain in the site's settings, or send from the right domain.
422Validation errorstype missing or not allowed for the token, data missing or not an object, or a revenue or identify field broke a rule.See below.
429Too Many AttemptsMore than 2,000 requests in an hour from one IP address.Wait for Retry-After.
5xxA server problem.Retry with backoff.

402 responses

A 402 has two fields, error and code:

{ "error": "This site's team has no active plan.", "code": "plan_inactive" }
codeMeaning
plan_inactiveThe team's trial ended or it has no plan. Statuses that can still ingest: active, trial, past due, unpaid and grace period.
quota_exceededThe team's monthly event count reached its plan limit plus 10%. Pageviews, events and identify are rejected until the count resets or the plan grows.

Revenue is never rejected for quota, only for plan_inactive. POST /api/fingerprint checks the plan only. The Stripe webhook answers 200 with { "ignored": "plan_inactive" } instead of 402. The SDKs treat 402 as final and don't retry it. Plan checks are cached for up to a minute, so a change takes about that long to apply.

Validation

FieldRule
typeRequired. pageview, event or identify with a public token; those plus revenue with a secret token.
dataRequired. An object.

Sending revenue with a public token fails here with 422, because revenue isn't an allowed type for it.

Revenue

FieldRule
data.customer_idRequired string, up to 255 characters.
data.amountRequired number from 0 to 99999999.99.
data.transaction_idRequired string, up to 255 characters.
data.event_typeOne of purchase, subscription, renewal, upgrade, downgrade, churn, refund.
data.currencyThree letters.
data.visitor_fingerprint, data.session_idStrings, up to 64 characters.
data.subscription_idString, up to 255 characters.
data.mrr_impactNumber from -99999999.99 to 99999999.99.
data.is_recurringBoolean.
data.metadataObject with up to 50 keys.
data.payment_processorString, up to 32 characters.
data.occurred_atA date, not more than a day in the future.

Identify

FieldRule
data.customer_idRequired string, up to 255 characters.
data.session_id, data.visitor_fingerprintStrings, up to 64 characters.
data.source_customer_idString, up to 255 characters.

A 422 response names each failing field in errors.

Errors after the 202

Revenue and identify are validated before they're queued. Pageviews and events aren't, and the worker needs more than the API checks. It drops the event silently if this is missing:

TypeNeeds
pageviewdata.url
eventdata.event_name and data.url

The browser tracker always sends what pageviews and events need. A revenue event with the same transaction_id and event_type as an earlier one is ignored, not an error.

Checklist

  1. Is the token the right kind? Public for the browser, secret for revenue.
  2. Is the site's domain set to the domain the requests come from?
  3. Does the request have type and a data object?
  4. For revenue: are customer_id, amount and transaction_id set, and is transaction_id new for that event type?
  5. A 402: does the site's team have an active plan, and is it under its monthly limit?
  6. Still stuck? See Debugging.