# Create a Bre-B key

`POST /v1/bre-b/keys` · [Sandbox · coming soon]

> Base URL: Sandbox `https://sandbox.zulu.com.co/v1`
>
> Not in production yet: it arrives with this same signature. Try it in the sandbox.

Registers an alphanumeric key to receive Bre-B transfers into your COP balance: `@` followed by 1 to 30 letters or digits. Keys starting with `@zulu` and the sandbox test data are reserved. Up to 5 keys per workspace.

## Authentication

`Authorization: Bearer <access_token>` (401 when missing or expired) and `X-API-Key` (403 when missing or not matching).

## Request

### Headers

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | string | optional | Idempotency key (up to 255 characters), valid for 24 hours per workspace. Repeating the call with the same key and body returns the original response with `Idempotent-Replayed: true`; a different body answers 422 and, while the first call is still running, 409. Production ignores it today: every call creates a new resource. max. 255 characters. [Sandbox · coming soon] |

### Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `key` | string | required | The key to register: `@` followed by 1 to 30 letters or digits (`@acmepagos`). `@zulu…` is reserved. min. 1 characters, max. 31 characters. |

## Responses

### 201

Key created.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string (uuid) | required | Key id. |
| `key` | string | required | The key. |
| `status` | string | required | Key status. Values: `ACTIVE` (Active: receives payments.), `ACTIVE_BY_CLIENT` (Active, reactivated by its holder after a suspension: receives payments.), `BLOCKED_BY_ZULU` (Blocked by zulu: does not receive payments.), `BLOCKED_BY_CLIENT` (Suspended by its holder: does not receive payments.). |
| `createdAt` | string (date-time) | required | Creation time (UTC). |

### 400

Invalid request: the body is not JSON, a field has another type or fails its validation.

### 401

The access token is missing, invalid or expired.

### 403

The `X-API-Key` is missing, invalid or does not match the token.

### 409

Conflict with the current state.

### 422

The operation can not be processed; nothing is recorded.

### 429

Too many requests: wait the seconds in `Retry-After`.

### 500

Internal error.

## Errors

| HTTP | error | cause | Description |
| --- | --- | --- | --- |
| 400 | `BadRequestApiError` | `error in struct validation` | One or more fields fail their validation. `values` carries one message per field, keyed by its JSON path, naming the Go validator that failed. |
| 400 | `BadRequestApiError` | `invalid json body: %s` | The body is not valid JSON, or a field has the wrong type (a string where a number goes, for example). Answered before the fields are validated. |
| 401 | — | `Unauthorized` | The `Authorization: Bearer <access_token>` header is missing, or the token is invalid or expired. |
| 403 | — | `Forbidden` | The `X-API-Key` is missing, unknown, revoked or does not belong to the credentials of the token. |
| 409 | `ResourceConflictApiError` | `idempotency key "%s" is still being processed` | Another call with the same `Idempotency-Key` is still running. Retry in a few seconds to receive its response. |
| 409 | `ResourceConflictApiError` | `bre-b key "%s" already exists` | You already registered that key. |
| 422 | `UnprocessableEntityApiError` | `idempotency key "%s" was used with a different request` | The `Idempotency-Key` was already used in the last 24 hours with a different body or operation. Use a new key for every distinct operation. |
| 422 | `UnprocessableEntityApiError` | `the workspace already has %d bre-b keys` | You reached the workspace maximum of keys. Delete one to create another. |
| 422 | `UnprocessableEntityApiError` | `bre-b key "%s" is reserved` | Keys starting with `@zulu` and the sandbox test data are reserved. |
| 429 | — | `Too Many Requests` | You exceeded the request limit of your credentials. Wait the seconds in `Retry-After`. |
| 500 | `InternalServerApiError` | `[code:1] unexpected error` | Internal error. On operations that move money, check the state before retrying so the operation is not duplicated. |

## Examples

### A new key

```bash
curl https://sandbox.zulu.com.co/v1/bre-b/keys \
  -H "Authorization: Bearer $ZULU_ACCESS_TOKEN" \
  -H "X-API-Key: $ZULU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "key": "@acmepagos"
}'
```

**Response 201**

```json
{
  "id": "9b2d7e14-3c5a-4f8e-a1b6-2d4c6e8f0a13",
  "key": "@acmepagos",
  "status": "ACTIVE",
  "createdAt": "2026-11-24T15:04:05.123Z"
}
```

### Key without `@`

```bash
curl https://sandbox.zulu.com.co/v1/bre-b/keys \
  -H "Authorization: Bearer $ZULU_ACCESS_TOKEN" \
  -H "X-API-Key: $ZULU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "key": "acmepagos"
}'
```

**Response 400**

```json
{
  "error": "BadRequestApiError",
  "cause": "error in struct validation",
  "values": {
    "key": "failed validation on the \"startswith\" tag with value required \"@\""
  }
}
```

### Key already registered

```bash
curl https://sandbox.zulu.com.co/v1/bre-b/keys \
  -H "Authorization: Bearer $ZULU_ACCESS_TOKEN" \
  -H "X-API-Key: $ZULU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "key": "@acmepagos"
}'
```

**Response 409**

```json
{
  "error": "ResourceConflictApiError",
  "cause": "bre-b key \"@acmepagos\" already exists"
}
```

### Reserved key

```bash
curl https://sandbox.zulu.com.co/v1/bre-b/keys \
  -H "Authorization: Bearer $ZULU_ACCESS_TOKEN" \
  -H "X-API-Key: $ZULU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "key": "@zulupagos"
}'
```

**Response 422**

```json
{
  "error": "UnprocessableEntityApiError",
  "cause": "bre-b key \"@zulupagos\" is reserved"
}
```
