> ## Documentation Index
> Fetch the complete documentation index at: https://dub.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Errors

> Learn about the error codes the Dub API returns and how to fix them.

When a request fails, the Dub API returns an HTTP status code and a JSON body with a machine-readable error code, a human-readable message and a link to this page:

```json theme={null}
{
  "error": {
    "code": "not_found",
    "message": "The requested resource was not found.",
    "doc_url": "https://dub.co/docs/api-reference/errors#not-found"
  }
}
```

## Error codes

### `bad_request`

* **Status:** 400
* **Problem:** The request is malformed. For example, the body is not valid JSON or a required header is missing.
* **Solution:** Check that the request is properly formatted.

### `unauthorized`

* **Status:** 401
* **Problem:** The request does not include valid authentication credentials.
* **Solution:** Make sure you are using a valid API key or access token. See [Authentication](https://dub.co/docs/api-reference/authentication.md).

### `forbidden`

* **Status:** 403
* **Problem:** The credentials are valid, but they don't have permission to perform this action.
* **Solution:** Check the API key's scopes and your role in the workspace.

### `exceeded_limit`

* **Status:** 403
* **Problem:** The request exceeds a limit of your workspace's plan.
* **Solution:** Upgrade your plan or wait for the usage limit to reset.

### `not_found`

* **Status:** 404
* **Problem:** The requested resource does not exist, or it doesn't belong to your workspace.
* **Solution:** Check the ID in the request and make sure the resource exists.

### `conflict`

* **Status:** 409
* **Problem:** Another resource already uses the same unique value. For example, a link with the same domain and key already exists.
* **Solution:** Use a unique value.

### `invite_pending`

* **Status:** 409
* **Problem:** An invitation for this email address is already pending.
* **Solution:** Resend or revoke the existing invitation.

### `invite_expired`

* **Status:** 410
* **Problem:** The invitation has expired.
* **Solution:** Send a new invitation.

### `unprocessable_entity`

* **Status:** 422
* **Problem:** The request failed validation. For example, a field has the wrong type or a value is out of range.
* **Solution:** Read the error message, which names the invalid field, and fix that value.

### `rate_limit_exceeded`

* **Status:** 429
* **Problem:** You have sent too many requests in a given amount of time.
* **Solution:** Wait for the number of seconds in the `Retry-After` header, then try again. See [Rate limits](https://dub.co/docs/api-reference/rate-limits.md).

### `internal_server_error`

* **Status:** 500
* **Problem:** Something went wrong on Dub's side.
* **Solution:** Try again later. If the problem persists, [contact support](https://dub.co/contact/support).

### `service_unavailable`

* **Status:** 503
* **Problem:** A service Dub depends on is temporarily unavailable.
* **Solution:** Try again later.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.