> The index of all pages is at https://docs.afffast.com/llms.txt.

# Quickstart

Make your first API call with a test key and the Sandbox Network. It takes less than 5 minutes.

In this guide you make a test key, connect the Sandbox Network, and read the first conversions. The Sandbox Network makes fake data. You need no network account and no credentials.

All requests use this base URL: `https://api.afffast.com`. Replace it with the URL of your API.

## 1. Make a test key

1. Sign up in the dashboard and make a workspace.
2. Switch the dashboard to **test mode**.
3. Open **API keys** and select **Make a key**. Choose the scope `full`, or a narrower scope.
4. Copy the key. The dashboard shows it one time. A test key starts with `sk_test_`.

Only the owner of the workspace can make a key with the scope `full`. An admin can make keys with narrower scopes, for example `read_only` or `sites:read`. When an admin asks for the scope `full`, the API returns 403 with the code `permission_denied`. An admin also cannot rotate a key that has the scope `full`. A key with the scope `full` can export all data of the workspace.

Put the key in an environment variable:

```bash
export AFFFAST_API_KEY="sk_test_..."
```

Send the key in the `Authorization` header of each request. Never put it in the URL. The API refuses a key in the query string (see [`api_key_in_query`](https://docs.afffast.com/errors/api-key-in-query.md)).

## 2. Check the key

```bash
curl https://api.afffast.com/v1/networks/sandbox \
  -H "Authorization: Bearer $AFFFAST_API_KEY"
```

The response is the object of the Sandbox Network. It shows `availability`: the network works in test mode only. If you get a 401 error, the key is not correct. See [`api_key_invalid`](https://docs.afffast.com/errors/api-key-invalid.md).

## 3. Connect the Sandbox Network

The field `seed` is any text. The same seed always gives the same data.

```bash
curl -X POST https://api.afffast.com/v1/connections \
  -H "Authorization: Bearer $AFFFAST_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "network": "sandbox",
    "label": "My sandbox",
    "credentials": { "seed": "my-test-seed" }
  }'
```

The response has the `id` of the connection (`conn_...`). The API starts the first sync and the load of the history at once. Read the progress:

```bash
curl https://api.afffast.com/v1/connections/conn_.../setup \
  -H "Authorization: Bearer $AFFFAST_API_KEY"
```

The Sandbox Network has two sites and about 30 conversions each day for the first site. The first conversions are there in about a minute.

## 4. Read the conversions

```bash
curl "https://api.afffast.com/v1/conversions?limit=3" \
  -H "Authorization: Bearer $AFFFAST_API_KEY"
```

The response is a list. This is a short example:

```json
{
  "object": "list",
  "url": "/v1/conversions",
  "has_more": true,
  "data": [
    {
      "id": "conv_...",
      "object": "conversion",
      "livemode": false,
      "status": "pending",
      "sold_at": "2026-11-21T14:03:10Z",
      "amounts": {
        "source": { "currency": "DKK", "order_amount": "499.0000", "commission": "49.9000" },
        "workspace": { "currency": "EUR", "order_amount": "66.9000", "commission": "6.6900" }
      }
    }
  ]
}
```

`livemode` is `false`: this is test data. Use `starting_after` to get the next page. See [Pagination](https://docs.afffast.com/docs/pagination.md).

## 5. Read the totals

`GET /v1/stats` needs a date range. Use `group_by` to get rows.

```bash
curl -g "https://api.afffast.com/v1/stats?date[gte]=2026-11-01&date[lte]=2026-11-30&group_by=network" \
  -H "Authorization: Bearer $AFFFAST_API_KEY"
```

## Next steps

- [Receive webhooks](https://docs.afffast.com/docs/webhooks.md). Get an event for each new conversion.
- [Track clicks](https://docs.afffast.com/docs/links.md). Make a link and see which page earned a commission.
- [Test mode](https://docs.afffast.com/docs/test-mode.md). Make test conversions and change their status.
- [Connect a real network](https://docs.afffast.com/docs/connect.md).
- The [API reference](/reference) has code samples in curl, Node.js, Python and PHP for each operation.
