# Support tickets

> Open a ticket with B7R support, read its thread and images, reply, rate it once closed, and mark it read.

Source: https://docs.b7r.app/tickets

> Ids, names and times in the examples are samples. Read the real values from the API.

> A ticket’s text is yours alone: it is never kept in the record of a call, and B7R records every read of a thread by a key. Your keys and the people in the app share the same hourly limits for tickets, replies and ratings.

## List your tickets

`GET /v1/tickets`

Newest activity first, without their text: read one ticket for its thread. At most `limit` (1 to 50, 20 by default) a page; follow `next_cursor` until it is `null`.

Key: A key with the `tickets:read` area.

Query:

- `limit` (string)
- `cursor` (string): 1 to 200.

Answer:

- `data` (array of object, required)
  - `id` (string (uuid), required)
  - `number` (integer, required)
  - `type` (string, required): One of `suggestion`, `problem`, `question`, `order_issue`.
  - `urgency` (string, required): One of `normal`, `urgent`.
  - `status` (string, required): One of `open`, `answered`, `planned`, `done`, `closed`.
  - `order_id` (string or null, required)
  - `image_count` (integer)
  - `rateable` (boolean, required)
  - `created_at` (string, required): UTC, ISO 8601 with milliseconds and Z.
  - `last_activity_at` (string, required): UTC, ISO 8601 with milliseconds and Z.
  - `closed_at` (string or null, required)
- `next_cursor` (string or null, required)

Errors: `unauthorized` (401), `area_forbidden` (403), `account_inactive` (403), `connection_disabled` (403), `https_required` (403), `invalid_request` (400), `rate_limited` (429), `internal_error` (500), `upstream_unavailable` (502), `api_unavailable` (503), `request_expired` (503), `service_unavailable` (503), `upstream_timeout` (504). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl https://api.b7r.app/v1/tickets \
  -H "Authorization: Bearer $B7R_API_KEY"
```

```javascript
const res = await fetch("https://api.b7r.app/v1/tickets", {
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
  },
});
const data = await res.json();
```

```python
import os, requests

res = requests.get(
    "https://api.b7r.app/v1/tickets",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
    },
    timeout=30,
)
data = res.json()
```

Answer (200 OK):

```json
{
  "data": [
    {
      "id": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
      "number": 1042,
      "type": "order_issue",
      "urgency": "normal",
      "status": "answered",
      "order_id": "B00000001042",
      "rateable": false,
      "created_at": "2026-11-25T10:00:00.000Z",
      "last_activity_at": "2026-11-26T10:00:00.000Z",
      "closed_at": null
    }
  ],
  "next_cursor": null
}
```

## Open a ticket

`POST /v1/tickets`

`order_issue` needs `order_id`, one of your orders (`ticket_rejected` with `order_not_found` otherwise). A day holds at most so many tickets (`daily_limit`). The answer is the ticket’s id and state, never its text; a retry with the same `Idempotency-Key` answers the same ticket.

Up to three images: upload each first ([`POST /v1/uploads`](https://docs.b7r.app/files), purpose `ticket_image`, JPEG, PNG or WebP up to 5 MB) and name it in `image_upload_ids`. An upload that cannot be used answers `ticket_rejected` at its index with `upload_not_found`, `upload_not_received`, `upload_type_mismatch` or `upload_size_mismatch`; each upload is used once the ticket is saved.

Key: A key with the `tickets:write` area. Send `Idempotency-Key` and `Content-Type: application/json`.

Body:

- `type` (string, required): One of `suggestion`, `problem`, `question`, `order_issue`.
- `urgency` (string, required): One of `normal`, `urgent`.
- `order_id` (string or null)
- `body` (string, required): 1 to 4000.
- `locale` (string): One of `ar`, `en`.
- `image_upload_ids` (array of string (uuid)): Staged uploads of purpose ticket_image, at most 3; each is used once the message is saved. At most 3 items.

Answer:

- `id` (string (uuid), required)
- `number` (integer, required)
- `status` (string, required): One of `open`, `answered`, `planned`, `done`, `closed`.

Errors: `unauthorized` (401), `area_forbidden` (403), `account_inactive` (403), `connection_disabled` (403), `https_required` (403), `not_found` (404), `invalid_request` (400), `idempotency_key_required` (400), `request_too_large` (413), `unsupported_media_type` (415), `rate_limited` (429), `internal_error` (500), `upstream_unavailable` (502), `api_unavailable` (503), `request_expired` (503), `service_unavailable` (503), `upstream_timeout` (504), `idempotency_mismatch` (409), `idempotency_in_flight` (409), `ticket_rejected` (422). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl -X POST https://api.b7r.app/v1/tickets \
  -H "Authorization: Bearer $B7R_API_KEY" \
  -H "Idempotency-Key: $(uuidgen 2>/dev/null || node -e 'console.log(crypto.randomUUID())')" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "order_issue",
    "urgency": "normal",
    "order_id": "B00000001042",
    "body": "The print on this order is faded."
  }'
```

```javascript
const res = await fetch("https://api.b7r.app/v1/tickets", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "type": "order_issue",
    "urgency": "normal",
    "order_id": "B00000001042",
    "body": "The print on this order is faded."
  }),
});
const data = await res.json();
```

```python
import os, requests, uuid

res = requests.post(
    "https://api.b7r.app/v1/tickets",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "type": "order_issue",
        "urgency": "normal",
        "order_id": "B00000001042",
        "body": "The print on this order is faded."
    },
    timeout=30,
)
data = res.json()
```

Answer (201 Created):

```json
{
  "id": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
  "number": 1042,
  "status": "open"
}
```

## Read a ticket

`GET /v1/tickets/{id}`

The thread oldest first: your messages, B7R’s (`b7r`) and the events (`system`). Each image is read with [`GET /v1/ticket-images/{id}`](#read-a-ticket-image); `deleted` once B7R no longer keeps it. Another account’s ticket answers `not_found`.

Key: A key with the `tickets:read` area.

Path:

- `id` (string (uuid), required)

Answer:

- `id` (string (uuid), required)
- `number` (integer, required)
- `type` (string, required): One of `suggestion`, `problem`, `question`, `order_issue`.
- `urgency` (string, required): One of `normal`, `urgent`.
- `status` (string, required): One of `open`, `answered`, `planned`, `done`, `closed`.
- `order_id` (string or null, required)
- `image_count` (integer)
- `rateable` (boolean, required)
- `created_at` (string, required): UTC, ISO 8601 with milliseconds and Z.
- `last_activity_at` (string, required): UTC, ISO 8601 with milliseconds and Z.
- `closed_at` (string or null, required)
- `messages` (array of object, required)
  - `id` (string (uuid), required)
  - `kind` (string, required): One of `message`, `event`.
  - `author` (string, required): One of `merchant`, `b7r`, `system`.
  - `body` (string or null, required)
  - `event` (string or null, required)
  - `created_at` (string, required): UTC, ISO 8601 with milliseconds and Z.
  - `images` (array of object, required)
    - `id` (string (uuid), required): Read it with GET /v1/ticket-images/{id}.
    - `width` (integer, required)
    - `height` (integer, required)
    - `deleted` (boolean, required): B7R no longer keeps the image (its retention passed).
- `rating` (object or null, required)
  - `stars` (integer, required): 1 to 5.
  - `comment` (string or null, required)
  - `created_at` (string, required): UTC, ISO 8601 with milliseconds and Z.

Errors: `unauthorized` (401), `area_forbidden` (403), `account_inactive` (403), `connection_disabled` (403), `https_required` (403), `not_found` (404), `invalid_request` (400), `rate_limited` (429), `internal_error` (500), `upstream_unavailable` (502), `api_unavailable` (503), `request_expired` (503), `service_unavailable` (503), `upstream_timeout` (504). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl https://api.b7r.app/v1/tickets/9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d \
  -H "Authorization: Bearer $B7R_API_KEY"
```

```javascript
const res = await fetch("https://api.b7r.app/v1/tickets/9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d", {
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
  },
});
const data = await res.json();
```

```python
import os, requests

res = requests.get(
    "https://api.b7r.app/v1/tickets/9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
    },
    timeout=30,
)
data = res.json()
```

Answer (200 OK):

```json
{
  "id": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
  "number": 1042,
  "type": "order_issue",
  "urgency": "normal",
  "status": "answered",
  "order_id": "B00000001042",
  "rateable": false,
  "created_at": "2026-11-25T10:00:00.000Z",
  "last_activity_at": "2026-11-26T10:00:00.000Z",
  "closed_at": null,
  "image_count": 1,
  "messages": [
    {
      "id": "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e",
      "kind": "message",
      "author": "merchant",
      "body": "The print on this order is faded.",
      "event": null,
      "created_at": "2026-11-25T10:00:00.000Z",
      "images": [
        {
          "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
          "width": 1200,
          "height": 900,
          "deleted": false
        }
      ]
    }
  ],
  "rating": null
}
```

## Reply to a ticket

`POST /v1/tickets/{id}/reply`

A reply on an answered, closed or done ticket opens it again, and takes `image_upload_ids` as opening a ticket does. The answer is the message’s id and the ticket’s state after it; a retry with the same `Idempotency-Key` answers the same message.

Key: A key with the `tickets:write` area. Send `Idempotency-Key` and `Content-Type: application/json`.

Path:

- `id` (string (uuid), required)

Body:

- `body` (string, required): 1 to 4000.
- `image_upload_ids` (array of string (uuid)): Staged uploads of purpose ticket_image, at most 3; each is used once the message is saved. At most 3 items.

Answer:

- `message_id` (string (uuid), required)
- `status` (string, required): One of `open`, `answered`, `planned`, `done`, `closed`.

Errors: `unauthorized` (401), `area_forbidden` (403), `account_inactive` (403), `connection_disabled` (403), `https_required` (403), `not_found` (404), `invalid_request` (400), `idempotency_key_required` (400), `request_too_large` (413), `unsupported_media_type` (415), `rate_limited` (429), `internal_error` (500), `upstream_unavailable` (502), `api_unavailable` (503), `request_expired` (503), `service_unavailable` (503), `upstream_timeout` (504), `idempotency_mismatch` (409), `idempotency_in_flight` (409), `ticket_rejected` (422). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl -X POST https://api.b7r.app/v1/tickets/9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d/reply \
  -H "Authorization: Bearer $B7R_API_KEY" \
  -H "Idempotency-Key: $(uuidgen 2>/dev/null || node -e 'console.log(crypto.randomUUID())')" \
  -H "Content-Type: application/json" \
  -d '{
    "body": "Here is the order again."
  }'
```

```javascript
const res = await fetch("https://api.b7r.app/v1/tickets/9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d/reply", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "body": "Here is the order again."
  }),
});
const data = await res.json();
```

```python
import os, requests, uuid

res = requests.post(
    "https://api.b7r.app/v1/tickets/9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d/reply",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "body": "Here is the order again."
    },
    timeout=30,
)
data = res.json()
```

Answer (200 OK):

```json
{
  "message_id": "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e",
  "status": "open"
}
```

## Rate a closed ticket

`POST /v1/tickets/{id}/rate`

Once, while the ticket is closed and its rating time lasts (`rateable` in the list): `not_rateable` or `already_rated` otherwise.

Key: A key with the `tickets:write` area. Send `Idempotency-Key` and `Content-Type: application/json`.

Path:

- `id` (string (uuid), required)

Body:

- `stars` (integer, required): 1 to 5.
- `comment` (string or null)

Answer:

- `stars` (integer, required)

Errors: `unauthorized` (401), `area_forbidden` (403), `account_inactive` (403), `connection_disabled` (403), `https_required` (403), `not_found` (404), `invalid_request` (400), `idempotency_key_required` (400), `request_too_large` (413), `unsupported_media_type` (415), `rate_limited` (429), `internal_error` (500), `upstream_unavailable` (502), `api_unavailable` (503), `request_expired` (503), `service_unavailable` (503), `upstream_timeout` (504), `idempotency_mismatch` (409), `idempotency_in_flight` (409), `ticket_rejected` (422). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl -X POST https://api.b7r.app/v1/tickets/9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d/rate \
  -H "Authorization: Bearer $B7R_API_KEY" \
  -H "Idempotency-Key: $(uuidgen 2>/dev/null || node -e 'console.log(crypto.randomUUID())')" \
  -H "Content-Type: application/json" \
  -d '{
    "stars": 5,
    "comment": "Fixed fast."
  }'
```

```javascript
const res = await fetch("https://api.b7r.app/v1/tickets/9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d/rate", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "stars": 5,
    "comment": "Fixed fast."
  }),
});
const data = await res.json();
```

```python
import os, requests, uuid

res = requests.post(
    "https://api.b7r.app/v1/tickets/9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d/rate",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "stars": 5,
        "comment": "Fixed fast."
    },
    timeout=30,
)
data = res.json()
```

Answer (200 OK):

```json
{
  "stars": 5
}
```

## Mark a ticket read

`POST /v1/tickets/{id}/read`

Its unread notifications become read; `marked` is how many.

Key: A key with the `tickets:write` area. Send `Idempotency-Key`.

Path:

- `id` (string (uuid), required)

Answer:

- `marked` (integer, required): How many unread notifications of the ticket are read now.

Errors: `unauthorized` (401), `area_forbidden` (403), `account_inactive` (403), `connection_disabled` (403), `https_required` (403), `not_found` (404), `invalid_request` (400), `idempotency_key_required` (400), `request_too_large` (413), `unsupported_media_type` (415), `rate_limited` (429), `internal_error` (500), `upstream_unavailable` (502), `api_unavailable` (503), `request_expired` (503), `service_unavailable` (503), `upstream_timeout` (504), `idempotency_mismatch` (409), `idempotency_in_flight` (409). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl -X POST https://api.b7r.app/v1/tickets/9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d/read \
  -H "Authorization: Bearer $B7R_API_KEY" \
  -H "Idempotency-Key: $(uuidgen 2>/dev/null || node -e 'console.log(crypto.randomUUID())')"
```

```javascript
const res = await fetch("https://api.b7r.app/v1/tickets/9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d/read", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
  },
});
const data = await res.json();
```

```python
import os, requests, uuid

res = requests.post(
    "https://api.b7r.app/v1/tickets/9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d/read",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    timeout=30,
)
data = res.json()
```

Answer (200 OK):

```json
{
  "marked": 1
}
```

## Read a ticket image

`GET /v1/ticket-images/{id}`

The image as B7R keeps it, a JPEG. An image of another account’s ticket, or one no longer kept, answers `not_found`.

Key: A key with the `tickets:read` area.

Path:

- `id` (string (uuid), required)

Answer:



Errors: `unauthorized` (401), `area_forbidden` (403), `account_inactive` (403), `connection_disabled` (403), `https_required` (403), `not_found` (404), `invalid_request` (400), `rate_limited` (429), `internal_error` (500), `upstream_unavailable` (502), `api_unavailable` (503), `request_expired` (503), `service_unavailable` (503), `upstream_timeout` (504). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl https://api.b7r.app/v1/ticket-images/2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f \
  -H "Authorization: Bearer $B7R_API_KEY"
```

```javascript
const res = await fetch("https://api.b7r.app/v1/ticket-images/2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f", {
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
  },
});
const data = await res.json();
```

```python
import os, requests

res = requests.get(
    "https://api.b7r.app/v1/ticket-images/2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
    },
    timeout=30,
)
data = res.json()
```

Answer (200 OK): the file, byte for byte, as `image/jpeg`.
