# API reference

Source: https://analytics.5h3ll.site/docs/api

Send payments, goals and crawler visits from your own backend.

All endpoints accept and return JSON and authenticate with your website API key as a bearer token. Keep the key on your server.

```
Authorization: Bearer YOUR_API_KEY
```

## Payments

`POST /api/v1/payments` records a payment or refund from any provider. Sending the same `transaction_id` again does not create a duplicate.

| Field | Type | Notes |
| --- | --- | --- |
| `transaction_id` | string | Required. Your unique ID for the payment. |
| `amount` | number | Required. Major units, for example 29.99. |
| `currency` | string | ISO code. Defaults to the website currency. |
| `visitor_id` | string | Value of the ml_vid cookie, for attribution. |
| `email` | string | Used to match returning customers. |
| `refunded` | boolean | Records a refund against the payment. |
| `renewal` | boolean | Marks a recurring renewal. |

```
curl -X POST https://analytics.5h3ll.site/api/v1/payments \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"transaction_id":"order_1001","amount":29.99,"currency":"USD","visitor_id":"VISITOR_ID"}'
```

Response: `{ "ok": true, "attributed": true, "visitor_id": "..." }`

## Goals

`POST /api/v1/goals` with `visitor_id` and `name`. See [Goals](https://analytics.5h3ll.site/docs/goals).

## Crawls

`POST /api/v1/crawls` reports one crawler request. The body is limited to 16 KB.

```
curl -X POST https://analytics.5h3ll.site/api/v1/crawls \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"hits":[{"user_agent":"Mozilla/5.0 (compatible; GPTBot/1.1)","ip":"20.171.206.1","url":"https://example.com/pricing","status":200}]}'
```

## Errors

| Status | Meaning |
| --- | --- |
| `400` | A required field is missing or invalid. |
| `401` | The API key is missing or wrong. |
| `429` | You are over the allowance or sending too quickly. |

Previous

AI crawler tracking

Next

AI agents and MCP

Something missing or wrong? [Open a support ticket](https://analytics.5h3ll.site/support).
