# Support endpoints

Every path starts at your [API URL](https://docs.qualithm.com/api.md#find-your-api-url). Every response is JSON, and an error has the [error body](https://docs.qualithm.com/api.md#errors).

## List known problems

`GET /v1/known-problems`

Newest first, by `createdAt` then `id`. Pass `errorCode` to check an error you hit before opening a ticket; subscribe your team to a match instead of filing.

Needs no credential.

**Parameters**

| Name | In | Type | Required | Description |
| ---- | -- | ---- | -------- | ----------- |
| `status` | query | one of `"open"`, `"resolved"` | No |  |
| `errorCode` | query | string | No | Only known problems that explain this error code |
| `limit` | query | integer | No | Items per page, 1 to 100. Default 50. |
| `cursor` | query | string | No | A previous page's `nextCursor`, to read the page after it |

**Response:** `200` with [KnownProblemPage](#knownproblempage) in `data`.

**[Errors](https://docs.qualithm.com/api.md#errors):** `400`, `429`, `500`, `503`

```bash
curl "<your-api-url>/v1/known-problems"
```

## Subscribe the team to a known problem

`POST /v1/teams/{teamId}/support/known-problems/{knownProblemId}/subscription`

Counts as the team's +1 instead of a ticket, and you get an email when the fix is deployed. Subscribing again changes nothing.

Needs an [API token](https://docs.qualithm.com/api.md#authenticate) with the `support.write` permission, which the owner, manager and viewer roles hold.

**Parameters**

| Name | In | Type | Required | Description |
| ---- | -- | ---- | -------- | ----------- |
| `teamId` | path | string | Yes | A team ID: `tem_…`; also accepts the legacy `tm_…` |
| `knownProblemId` | path | string | Yes | A known problem ID: `kpb_…` |
| `Idempotency-Key` | header | string | No | A unique key for this request. A retry with the same key and body returns the first response instead of acting again; keys last 24 hours. |

**Response:** `201` with [KnownProblemSubscription](#knownproblemsubscription) in `data`.

**[Errors](https://docs.qualithm.com/api.md#errors):** `400`, `401`, `403`, `404`, `409`, `429`, `500`, `503`

```bash
curl -X POST "<your-api-url>/v1/teams/<team-id>/support/known-problems/<known-problem-id>/subscription" \
  -H "Authorization: Bearer <your-api-token>"
```

## Unsubscribe the team from a known problem

`DELETE /v1/teams/{teamId}/support/known-problems/{knownProblemId}/subscription`

Unsubscribing a team that isn't subscribed changes nothing.

Needs an [API token](https://docs.qualithm.com/api.md#authenticate) with the `support.write` permission, which the owner, manager and viewer roles hold.

**Parameters**

| Name | In | Type | Required | Description |
| ---- | -- | ---- | -------- | ----------- |
| `teamId` | path | string | Yes | A team ID: `tem_…`; also accepts the legacy `tm_…` |
| `knownProblemId` | path | string | Yes | A known problem ID: `kpb_…` |

**Response:** `204` with no body.

**[Errors](https://docs.qualithm.com/api.md#errors):** `400`, `401`, `403`, `404`, `429`, `500`, `503`

```bash
curl -X DELETE "<your-api-url>/v1/teams/<team-id>/support/known-problems/<known-problem-id>/subscription" \
  -H "Authorization: Bearer <your-api-token>"
```

## List the team's support tickets

`GET /v1/teams/{teamId}/support/tickets`

Newest first, by `createdAt` then `id`. Every page carries the team's ticket allowance for the month.

Needs an [API token](https://docs.qualithm.com/api.md#authenticate) with the `support.read` permission, which the owner, manager and viewer roles hold.

**Parameters**

| Name | In | Type | Required | Description |
| ---- | -- | ---- | -------- | ----------- |
| `teamId` | path | string | Yes | A team ID: `tem_…`; also accepts the legacy `tm_…` |
| `status` | query | one of `"open"`, `"pending"`, `"closed"` | No | Tickets in this status; repeat `status` to list tickets in any of several |
| `limit` | query | integer | No | Items per page, 1 to 100. Default 50. |
| `cursor` | query | string | No | A previous page's `nextCursor`, to read the page after it |

**Response:** `200` with [SupportTicketPage](#supportticketpage) in `data`.

**[Errors](https://docs.qualithm.com/api.md#errors):** `400`, `401`, `403`, `404`, `429`, `500`, `503`

```bash
curl "<your-api-url>/v1/teams/<team-id>/support/tickets" \
  -H "Authorization: Bearer <your-api-token>"
```

## Open a support ticket

`POST /v1/teams/{teamId}/support/tickets`

Attach the error codes and request IDs you hit: known error codes set the severity, and a ticket whose error codes match one of the team's open tickets joins it as a +1 instead of opening another. A ticket past the month's allowance is still opened, and answered at best effort; account access, billing, security, data protection and outage tickets never count against it.

Needs an [API token](https://docs.qualithm.com/api.md#authenticate) with the `support.write` permission, which the owner, manager and viewer roles hold.

**Parameters**

| Name | In | Type | Required | Description |
| ---- | -- | ---- | -------- | ----------- |
| `teamId` | path | string | Yes | A team ID: `tem_…`; also accepts the legacy `tm_…` |
| `Idempotency-Key` | header | string | No | A unique key for this request. A retry with the same key and body returns the first response instead of acting again; keys last 24 hours. |

**Request body:** [OpenSupportTicketRequest](#opensupportticketrequest)

**Response:** `201` with [OpenSupportTicketResult](#opensupportticketresult) in `data`.

**[Errors](https://docs.qualithm.com/api.md#errors):** `400`, `401`, `403`, `404`, `409`, `413`, `415`, `429`, `500`, `503`

```bash
curl -X POST "<your-api-url>/v1/teams/<team-id>/support/tickets" \
  -H "Authorization: Bearer <your-api-token>" \
  -H "Content-Type: application/json" \
  -d '{"subject":"<subject>","message":"<message>"}'
```

## Read a support ticket and its messages

`GET /v1/teams/{teamId}/support/tickets/{ticketId}`

Needs an [API token](https://docs.qualithm.com/api.md#authenticate) with the `support.read` permission, which the owner, manager and viewer roles hold.

**Parameters**

| Name | In | Type | Required | Description |
| ---- | -- | ---- | -------- | ----------- |
| `teamId` | path | string | Yes | A team ID: `tem_…`; also accepts the legacy `tm_…` |
| `ticketId` | path | string | Yes | A support ticket ID: `tkt_…` |

**Response:** `200` with [SupportTicketThread](#supportticketthread) in `data`.

**[Errors](https://docs.qualithm.com/api.md#errors):** `400`, `401`, `403`, `404`, `429`, `500`, `503`

```bash
curl "<your-api-url>/v1/teams/<team-id>/support/tickets/<ticket-id>" \
  -H "Authorization: Bearer <your-api-token>"
```

## Close a support ticket

`POST /v1/teams/{teamId}/support/tickets/{ticketId}/close`

Closing a closed ticket changes nothing. A new message reopens it.

Needs an [API token](https://docs.qualithm.com/api.md#authenticate) with the `support.write` permission, which the owner, manager and viewer roles hold.

**Parameters**

| Name | In | Type | Required | Description |
| ---- | -- | ---- | -------- | ----------- |
| `teamId` | path | string | Yes | A team ID: `tem_…`; also accepts the legacy `tm_…` |
| `ticketId` | path | string | Yes | A support ticket ID: `tkt_…` |
| `Idempotency-Key` | header | string | No | A unique key for this request. A retry with the same key and body returns the first response instead of acting again; keys last 24 hours. |

**Response:** `200` with [SupportTicketThread](#supportticketthread) in `data`.

**[Errors](https://docs.qualithm.com/api.md#errors):** `400`, `401`, `403`, `404`, `409`, `429`, `500`, `503`

```bash
curl -X POST "<your-api-url>/v1/teams/<team-id>/support/tickets/<ticket-id>/close" \
  -H "Authorization: Bearer <your-api-token>"
```

## Add a message to a support ticket

`POST /v1/teams/{teamId}/support/tickets/{ticketId}/messages`

A message on a pending or closed ticket reopens it, and ends its link to a known problem whose fix is deployed.

Needs an [API token](https://docs.qualithm.com/api.md#authenticate) with the `support.write` permission, which the owner, manager and viewer roles hold.

**Parameters**

| Name | In | Type | Required | Description |
| ---- | -- | ---- | -------- | ----------- |
| `teamId` | path | string | Yes | A team ID: `tem_…`; also accepts the legacy `tm_…` |
| `ticketId` | path | string | Yes | A support ticket ID: `tkt_…` |
| `Idempotency-Key` | header | string | No | A unique key for this request. A retry with the same key and body returns the first response instead of acting again; keys last 24 hours. |

**Request body:** [AddSupportTicketMessageRequest](#addsupportticketmessagerequest)

**Response:** `201` with [SupportTicketThread](#supportticketthread) in `data`.

**[Errors](https://docs.qualithm.com/api.md#errors):** `400`, `401`, `403`, `404`, `409`, `413`, `415`, `429`, `500`, `503`

```bash
curl -X POST "<your-api-url>/v1/teams/<team-id>/support/tickets/<ticket-id>/messages" \
  -H "Authorization: Bearer <your-api-token>" \
  -H "Content-Type: application/json" \
  -d '{"message":"<message>"}'
```

## Types

### KnownProblemPage

| Field | Type | Required | Description |
| ----- | ---- | -------- | ----------- |
| `items` | array of [KnownProblem](#knownproblem) | Yes |  |
| `nextCursor` | string or null | Yes | Pass as `cursor` to read the next page; `null` on the last page |

### KnownProblem

| Field | Type | Required | Description |
| ----- | ---- | -------- | ----------- |
| `id` | string | Yes | A known problem ID: `kpb_…` |
| `title` | string | Yes |  |
| `summary` | string | Yes | What fails and for whom, in plain terms |
| `workaround` | string or null | Yes | What to do until the fix is deployed; null when there is nothing |
| `status` | one of `"open"`, `"resolved"` | Yes | `resolved` once the fix is deployed |
| `errorCodes` | array of string | Yes | The API error codes it explains |
| `resolvedAt` | string (date-time) or null | Yes |  |
| `createdAt` | string (date-time) | Yes | UTC time, RFC 3339 |
| `updatedAt` | string (date-time) | Yes | UTC time, RFC 3339 |

### KnownProblemSubscription

| Field | Type | Required | Description |
| ----- | ---- | -------- | ----------- |
| `knownProblemId` | string | Yes | A known problem ID: `kpb_…` |
| `createdAt` | string (date-time) | Yes | UTC time, RFC 3339 |

### SupportTicketPage

| Field | Type | Required | Description |
| ----- | ---- | -------- | ----------- |
| `items` | array of [SupportTicket](#supportticket) | Yes |  |
| `nextCursor` | string or null | Yes | Pass as `cursor` to read the next page; `null` on the last page |
| `allowance` | [SupportTicketAllowance](#supportticketallowance) | Yes |  |

### SupportTicket

| Field | Type | Required | Description |
| ----- | ---- | -------- | ----------- |
| `id` | string | Yes | A support ticket ID: `tkt_…` |
| `teamId` | string | Yes | A team ID: `tem_…`; also accepts the legacy `tm_…` |
| `subject` | string | Yes |  |
| `status` | one of `"open"`, `"pending"`, `"closed"` | Yes | `pending` while it waits on the team; a new message from the team reopens it |
| `channel` | one of `"api"`, `"app"`, `"email"`, `"cli"`, `"mcp"` | Yes |  |
| `category` | one of `"account_access"`, `"billing"`, `"security"`, `"data_protection"`, `"outage"`, `"technical"`, `"other"` | Yes |  |
| `severity` | one of `"production_down"`, `"blocked"`, `"degraded"`, `"question"` | Yes |  |
| `severityInferred` | boolean | Yes | True when the attached error codes set the severity |
| `planTier` | one of `"free"`, `"plus"`, `"pro"`, `"max"` | Yes | The team's plan when the ticket was opened |
| `bestEffort` | boolean | Yes | Opened past the month's ticket allowance, so answered at best effort |
| `plusOnes` | integer (int64) | Yes | Repeats of the same failure from the team that joined this ticket |
| `knownProblemId` | string or null | Yes | The known problem this ticket is grouped under; the ticket closes when its fix is deployed |
| `diagnostics` | [SupportTicketDiagnostics](#supportticketdiagnostics) | Yes |  |
| `dueAt` | string (date-time) or null | Yes | A published deadline the reply must meet |
| `closedAt` | string (date-time) or null | Yes |  |
| `createdAt` | string (date-time) | Yes | UTC time, RFC 3339 |
| `updatedAt` | string (date-time) | Yes | UTC time, RFC 3339 |

### SupportTicketDiagnostics

| Field | Type | Required | Description |
| ----- | ---- | -------- | ----------- |
| `errorCodes` | array of string | No | The API error codes the caller hit, most recent first. They set the severity and find an open ticket to join |
| `requestIds` | array of string | No |  |
| `sdkVersion` | string | No |  |
| `firmwareVersion` | string | No |  |

### SupportTicketAllowance

| Field | Type | Required | Description |
| ----- | ---- | -------- | ----------- |
| `limit` | integer (int64) or null | Yes | Tickets the plan includes this calendar month, UTC; `null` for fair use |
| `used` | integer (int64) | Yes | Tickets opened this month that count: account access, billing, security, data protection and outage tickets don't, nor tickets marked a Qualithm fault |
| `remaining` | integer (int64) or null | Yes | Tickets left this month; past the allowance a ticket is still opened, and answered at best effort. `null` for fair use |
| `resetsAt` | string (date-time) | Yes | The 1st of next month, UTC |

### OpenSupportTicketRequest

| Field | Type | Required | Description |
| ----- | ---- | -------- | ----------- |
| `subject` | string | Yes |  |
| `message` | string | Yes |  |
| `category` | one of `"account_access"`, `"billing"`, `"security"`, `"data_protection"`, `"outage"`, `"technical"`, `"other"` | No | What the ticket is about; `other` when absent |
| `severity` | one of `"production_down"`, `"blocked"`, `"degraded"`, `"question"` | No | How bad it is; `question` when absent. Known error codes in `diagnostics` set it instead |
| `channel` | one of `"api"`, `"app"`, `"cli"`, `"mcp"` | No | Where it was filed from; `api` when absent |
| `diagnostics` | [SupportTicketDiagnostics](#supportticketdiagnostics) | No |  |

### OpenSupportTicketResult

| Field | Type | Required | Description |
| ----- | ---- | -------- | ----------- |
| `ticket` | [SupportTicket](#supportticket) | Yes |  |
| `joined` | boolean | Yes | True when the ticket repeats an open ticket's failure, so the message joined that ticket as a +1 |

### SupportTicketThread

| Field | Type | Required | Description |
| ----- | ---- | -------- | ----------- |
| `ticket` | [SupportTicket](#supportticket) | Yes |  |
| `messages` | array of [SupportTicketMessage](#supportticketmessage) | Yes | Oldest first |

### SupportTicketMessage

| Field | Type | Required | Description |
| ----- | ---- | -------- | ----------- |
| `id` | string | Yes | A support ticket message ID: `tkm_…` |
| `ticketId` | string | Yes | A support ticket ID: `tkt_…` |
| `authorKind` | one of `"customer"`, `"staff"`, `"system"` | Yes |  |
| `authorName` | string or null | Yes | Who wrote it: the team member, the person who mailed the ticket in, or Qualithm Support; null when unknown |
| `body` | string | Yes |  |
| `createdAt` | string (date-time) | Yes | UTC time, RFC 3339 |

### AddSupportTicketMessageRequest

| Field | Type | Required | Description |
| ----- | ---- | -------- | ----------- |
| `message` | string | Yes |  |
