> For the complete Lynkow documentation index in agent-friendly format, see [llms.txt](/llms.txt).

# SDK Types: Errors

**Published**: 2026-11-30
**Category**: Types

## `ApiErrorDetail`

*Interface*

One entry of an API error body, found in `LynkowError.details`. On a
validation error, each entry describes one invalid field.

| Property | Type | Optional | Description |
| --- | --- | --- | --- |
| `code` | `string` | Yes | The API's stable error code for this entry, independent of the message.<br>The first entry carrying one is also `LynkowError.apiCode`. `undefined`<br>when the API sends none. |
| `field` | `string` | Yes | Request field the entry is about, on a validation error. Use it to show<br>the message next to the form field. `undefined` otherwise. |
| `message` | `string` | No | Readable English message, for logs or display. |
| `meta` | `SubscriptionErrorMeta` | Yes | Subscription context. Storefront responses never carry it. |


---

## `ErrorCode`

*TypeAlias*

The `code` of a `LynkowError`, derived from the HTTP status (`error.status`).
For the API's precise reason, read `error.apiCode`. A few methods throw
`NOT_FOUND` before sending anything, for a slug that cannot name a resource.

| Code | Status | When |
| --- | --- | --- |
| `BAD_REQUEST` | 400 | Malformed request, such as a site ID that is not a UUID |
| `UNAUTHORIZED` | 401 | Missing or invalid publishable key or buyer session |
| `PAYMENT_REQUIRED` | 402 | The site's subscription blocks the operation |
| `FORBIDDEN` | 403 | Refused, such as a request from another domain |
| `NOT_FOUND` | 404 | Unknown or unpublished resource |
| `CONFLICT` | 409 | The resource changed or already exists |
| `VALIDATION_ERROR` | 422 | Invalid input, detailed per field in `details` |
| `TOO_MANY_REQUESTS` | 429 | Rate limited, after the SDK's retries on reads |
| `SERVICE_UNAVAILABLE` | 503 | API temporarily unavailable, after retries |
| `INTERNAL_ERROR` | 500 and others | Any other failing status |
| `NETWORK_ERROR` | 0 | No response: offline, DNS failure or aborted request |


The SDK's services never throw `RATE_LIMITED`, `TIMEOUT` or `UNKNOWN`: only
LynkowError.fromResponse and LynkowError.fromNetworkError
build them.

```typescript
type ErrorCode = "BAD_REQUEST" | "VALIDATION_ERROR" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "CONFLICT" | "RATE_LIMITED" | "TOO_MANY_REQUESTS" | "TIMEOUT" | "NETWORK_ERROR" | "INTERNAL_ERROR" | "SERVICE_UNAVAILABLE" | "UNKNOWN"
```

---

## `SubscriptionErrorMeta`

*Interface*

Subscription quota context of an API error. Storefront responses never
carry it.

| Property | Type | Optional | Description |
| --- | --- | --- | --- |
| `current` | `number` | Yes | Current measured usage for the quota, when it is safe to disclose. |
| `limit` | `number \| "unlimited"` | Yes | Configured quota ceiling, or `unlimited` when no finite ceiling applies. |
| `quota` | `string` | Yes | Subscription quota that rejected the operation, when quota enforcement applies. |
| `requiredPlan` | `string` | Yes | Lowest plan slug that supports the requested capacity or feature. |