# Create a Bre-B QR code

`POST /v1/bre-b/qr-codes` · [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.

Creates a Bre-B QR code tied to one of your keys. With `amount` it is dynamic (one payment of that amount, expiring after 60 minutes by default); without `amount` it is static (the payer types the amount and it takes several payments). `payload` is the EMVCo content to render your own image; `imageUrl`, a ready PNG. In the sandbox the QR uses a non-routable GUID and can never be paid for real: simulate the payment with `POST /v1/sandbox/bre-b/qr-codes/{id}/pay`.

## 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 | optional | Your key that receives the payment. Without it, your oldest active key. max. 31 characters. |
| `amount` | integer | optional | COP amount (whole pesos, up to 12,110,000). With an amount the QR is dynamic. > 0. |
| `reference` | string | optional | Your reference (up to 25 characters). max. 25 characters. |
| `expiresInMinutes` | integer | optional | Minutes until it expires (1 to 10,080). Default 60 for a dynamic QR; a static QR without it never expires. ≥ 1, ≤ 10080. |

## Responses

### 201

QR code created.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string (uuid) | required | QR code id. |
| `type` | string | required | QR type. Values: `STATIC` (No amount: the payer types it; takes several payments.), `DYNAMIC` (Fixed amount: a single payment.). |
| `key` | string | required | Key that receives the payment. |
| `amount` | integer \| null | required | Amount (COP); `null` on a static QR. |
| `reference` | string \| null | required | Your reference; the deposit carries it. |
| `payload` | string | required | EMVCo content of the QR (to render your own image). |
| `imageUrl` | string | required | SVG image of the QR code, served on the developers site (public: the id is the key). |
| `status` | string | required | QR status. Values: `ACTIVE` (Takes payments.), `PAID` (Dynamic and already paid.), `EXPIRED` (Expired.). |
| `expiresAt` | string (date-time) \| null | required | Expiry (UTC); `null` when it never expires. |

### 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.

### 404

The resource does not exist.

### 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. |
| 404 | `NotFoundApiError` | `bre-b key "%s" not found` | The key does not exist (in your workspace, or in the Bre-B directory when resolving it). Test data: `@notfound`. |
| 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. |
| 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` | `bre-b key "%s" is blocked` | The key is blocked and does not receive payments. |
| 422 | `UnprocessableEntityApiError` | `the workspace does not have an active bre-b key` | To create a QR without `key`, the workspace needs at least one active key (`POST /v1/bre-b/keys`). |
| 422 | `UnprocessableEntityApiError` | `amount %d is above the bre-b maximum of %d` | Bre-B accepts up to 12,110,000 COP per transfer. |
| 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

### Dynamic QR for 85,000 COP

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

**Response 201**

```json
{
  "id": "3f6c2a9e-8d41-4b7a-9c1e-2f5d7a8b9c0d",
  "type": "DYNAMIC",
  "key": "@acmepagos",
  "amount": 85000,
  "reference": "PED-1093",
  "payload": "00020101021226330015CO.ZULU.SANDBOX0110@acmepagos5204000053031705405850005802CO5912SANDBOX ACME6006BOGOTA62120508PED-1093630427D6",
  "imageUrl": "https://developers.zulu.com.co/qr/3f6c2a9e-8d41-4b7a-9c1e-2f5d7a8b9c0d.svg",
  "status": "ACTIVE",
  "expiresAt": "2026-11-24T16:04:05.123Z"
}
```

### Static QR without amount

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

**Response 201**

```json
{
  "id": "6e1f4a7c-2b9d-4c3e-8f5a-7d0b1c2e3f40",
  "type": "STATIC",
  "key": "@acmepagos",
  "amount": null,
  "reference": null,
  "payload": "00020101021126330015CO.ZULU.SANDBOX0110@acmepagos5204000053031705802CO5912SANDBOX ACME6006BOGOTA63046DFC",
  "imageUrl": "https://developers.zulu.com.co/qr/6e1f4a7c-2b9d-4c3e-8f5a-7d0b1c2e3f40.svg",
  "status": "ACTIVE",
  "expiresAt": null
}
```

### Workspace without active keys

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

**Response 422**

```json
{
  "error": "UnprocessableEntityApiError",
  "cause": "the workspace does not have an active bre-b key"
}
```
