Skip to main content
POST
Track a sale
Use this endpoint from a trusted server after a paid order, subscription, renewal, or other revenue event.

Authentication and permission

Send a secret biqli_... workspace API key with Conversions: Write (conversions.create). The key selects the workspace. Never expose it in browser code and never send a workspace ID.

Direct sale request

Pass clickId when the checkout or order still carries the Biqli bq_id. Amounts are integers in the currency’s minor unit, so $54.99 is 5499 for usd.

Deferred sale request

After a lead has established customer attribution, you may omit clickId. Biqli first uses the named lead when leadEventName is present, then the customer attribution selected by the workspace’s first-click or last-click model.

Idempotency

Use a stable invoiceId and paymentProcessor for durable financial-event deduplication. Also send Idempotency-Key for safe transport retries. An exact replay returns the original 201 response and the Idempotency-Replayed: true header without repeating side effects. Reusing an invoice, event, or idempotency identifier with different data returns 409 idempotency_conflict.

Response

The response includes the same event, click, link, customer, and request fields as a lead, plus normalized sale data:
amountUsd is an integer in USD cents. A non-USD request requires a current exchange rate; otherwise the API returns 422 currency_unavailable.

Errors

Read Track a lead for customer attribution setup and Authentication for API-key rotation and least-privilege access.

Authorizations

Authorization
string
header
required

A workspace API key beginning with biqli_.

Headers

Idempotency-Key
string

Stable retry key. Reuse only for the same logical request and payload.

Required string length: 1 - 255
X-Biq-Client
string

Integration name recorded in API diagnostics.

Maximum string length: 64
X-Biq-Client-Version
string

Integration version recorded in API diagnostics.

Maximum string length: 64
X-Biq-Request-Id
string

Caller-generated request identifier for tracing.

Required string length: 1 - 100
Pattern: ^[A-Za-z0-9._:-]+$

Body

application/json
customerExternalId
string
required
Required string length: 1 - 100
amount
integer
required

Amount in the currency's minor unit.

Required range: 0 <= x <= 9007199254740991
clickId
string | null
Required string length: 1 - 100
Pattern: ^[A-Za-z0-9_-]+$
currency
string | null
default:usd
Pattern: ^[a-z]{3}$
eventName
string | null
default:Purchase
Required string length: 1 - 255
paymentProcessor
string | null
default:custom
Maximum string length: 32
Pattern: ^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$
invoiceId
string | null
Required string length: 1 - 255
leadEventName
string | null
Required string length: 1 - 255
customerName
string | null
Maximum string length: 255
customerEmail
string<email> | null
Maximum string length: 254
customerAvatar
string<uri> | null
Maximum string length: 2048
Pattern: ^https?://
eventId
string | null
Required string length: 1 - 100
Pattern: ^[A-Za-z0-9](?:[A-Za-z0-9._:-]*[A-Za-z0-9])?$
metadata
object | null
occurredAt
string<date-time> | null
Pattern: Z$

Response

Sale created or idempotently replayed.

event
object
required
click
object
required
customer
object
required
request_id
string
required
sale
object
required