# Snippet configuration

> Endpoint that returns the account's identification configuration, read by the snippet when it loads. Only needed if you write your own collector.

Página: https://doc.rapidchargeback.com/en/canais/capture/config-do-snippet/

Returns the account's identification configuration. The [snippet](https://doc.rapidchargeback.com/en/canais/capture/instalar-o-snippet/) calls this endpoint when it loads, before the first event. You only need it if you write your own collector in the browser.

## Endpoint

```
GET https://api.rapidchargeback.com/api/v1/capture/{token}/config
```

## Authentication

None. The publishable token in the URL identifies the merchant.

## URL parameters

| Field | Type | Description |
|---|---|---|
| `token` | string | Merchant's publishable token, generated in the dashboard |

## Validations

| Rule | Response |
|---|---|
| Unknown or inactive token, or token without a merchant | `404 NOT_FOUND` |

## Cache

The response comes with `cache-control: public, max-age=300`. Respect the cache: the configuration rarely changes and the snippet does not need to fetch it on every page.

## Request example

```bash
curl https://api.rapidchargeback.com/api/v1/capture/your_publishable_token/config
```

## Response examples

### Success (200), with Fingerprint active

```json
{
  "data": {
    "fp_public_key": "pk_exemplo_123456",
    "fp_region": "us"
  }
}
```

| Field | Description |
|---|---|
| `fp_public_key` | Fingerprint public key to use in the browser. `null` when identification is not active |
| `fp_region` | Fingerprint region: `us`, `eu` or `ap` |

With the key, the collector loads the Fingerprint agent and gets two values: the visitor identifier and the request identifier. Send them in the `checkout` event as `device_id` and `fp_request_id`, and Rapid validates the pair on the server side. See [The `checkout` event](https://doc.rapidchargeback.com/en/canais/capture/payload/#the-checkout-event).

### Success (200), without Fingerprint active

```json
{
  "data": {
    "fp_public_key": null,
    "fp_region": "us"
  }
}
```

A null `fp_public_key` does not prevent capture. The event is still recorded, just without the validated device identification part.

### Error: unknown token (404)

```json
{ "error": { "code": "NOT_FOUND" } }
```

## Next steps

- [Install the snippet](https://doc.rapidchargeback.com/en/canais/capture/instalar-o-snippet/)
- [Send an event from the browser](https://doc.rapidchargeback.com/en/canais/capture/enviar-evento-navegador/)
