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

> [accordion] bad\_request
>
> 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.

> [accordion] unauthorized
>
> 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).

> [accordion] forbidden
>
> 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.

> [accordion] exceeded\_limit
>
> 403
>
> * **Problem:** The request exceeds a limit of your workspace's plan.
> * **Solution:** Upgrade your plan or wait for the usage limit to reset.

> [accordion] not\_found
>
> 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.

> [accordion] conflict
>
> 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.

> [accordion] invite\_pending
>
> 409
>
> * **Problem:** An invitation for this email address is already pending.
> * **Solution:** Resend or revoke the existing invitation.

> [accordion] invite\_expired
>
> 410
>
> * **Problem:** The invitation has expired.
> * **Solution:** Send a new invitation.

> [accordion] unprocessable\_entity
>
> 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.

> [accordion] rate\_limit\_exceeded
>
> 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).

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

> [accordion] service\_unavailable
>
> 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.