> ## Documentation Index
> Fetch the complete documentation index at: https://learn.biq.li/llms.txt
> Use this file to discover all available pages before exploring further.

# REST API

> Send server conversion events without an official SDK.

Use the REST API when your server language does not have an official Biqli SDK.

## Requirements

* A secret `biqli_...` workspace API key
* **Conversions -> Write** permission
* JSON over HTTPS
* Stable identifiers for retry safety

## Track a lead

```bash theme={null}
curl --request POST \
  --url 'https://biq.li/api/v1/track/lead' \
  --header "Authorization: Bearer $BIQLI_API_KEY" \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: signup:customer_1842' \
  --data '{
    "clickId": "qPa4lSpsKj3B",
    "eventId": "signup:customer_1842",
    "eventName": "Signed up",
    "customerExternalId": "customer_1842"
  }'
```

## Track a sale

```bash theme={null}
curl --request POST \
  --url 'https://biq.li/api/v1/track/sale' \
  --header "Authorization: Bearer $BIQLI_API_KEY" \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: stripe:in_1842' \
  --data '{
    "customerExternalId": "customer_1842",
    "amount": 4999,
    "currency": "usd",
    "paymentProcessor": "stripe",
    "invoiceId": "in_1842"
  }'
```

## Implement retries

Retry only network failures and HTTP `408`, `425`, `429`, and `5xx` responses. Honor `Retry-After` when present. Use exponential backoff with jitter and a maximum attempt count.

Keep the same body and `Idempotency-Key` for the same logical event. A successful replay returns `Idempotency-Replayed: true`.

Do not retry `4xx` validation, authentication, permission, or conflict responses until you correct the request.

## Trace requests

You may send:

```http theme={null}
X-Biq-Client: acme-backend
X-Biq-Client-Version: 1.4.0
X-Biq-Request-Id: req_signup_customer_1842
```

Store the returned `X-Biq-Request-Id` with failures so support can locate the request without receiving your secret or complete customer payload.

See [Track a lead](/docs/api-reference/conversions/track-lead) and [Track a sale](/docs/api-reference/conversions/track-sale) for every field and error.
