# Error Codes

## Response Body

The response body contains information about the error and typically contains the following three fields, but this may vary depending on the error. An example error response body is shown below.

```javascript
{
    "error": "already exists",
    "code": 409,
    "help": "https://docs.d21s.com/error/#409"
}
```

| Field   | Type     | Description                                    |
| ------- | -------- | ---------------------------------------------- |
| `error` | `string` | A summary of what went wrong.                  |
| `code`  | `int`    | HTTP status code of the response.              |
| `help`  | `string` | Developer documentation link for more details. |

## 400 - Bad Request <a href="#id-400" id="id-400"></a>

This is most likely due to an invalid argument as a part of a path, query parameter, or request body. Please see the error message for more information.

## 401 - Unauthorized <a href="#id-401" id="id-401"></a>

The user or the Service Account can not be authenticated towards our API.

#### Access Tokens

If you are using an Access Token received from our OAuth2 endpoint, please note that these are only valid for *one hour*. For uninterrupted operations using Access Tokens, make sure to get a new one before the previous one expires.&#x20;

See our [Authentication guide](/authentication/oauth2.md) for more details.

## 403 - Forbidden <a href="#id-403" id="id-403"></a>

The user or Service Account does not have access to this resource. Make sure you have a sufficiently elevated role. A list of permissions granted by each role can be found on the [Permissions](/service-accounts/permissions.md) page.

## 404 - Not Found <a href="#id-404" id="id-404"></a>

The resource that you are looking for doesn’t exist.

When executing a method in the form of`/projects/{PROJECT_ID}/devices:transfer`, where the last argument is separated by a `:`, this error indicates that the  PROJECT\_ID cannot be found, not that the devices slated for transfer were not found.

#### Propagation Delay

When creating a resource using our REST API, a few seconds will pass before the resource is available. To avoid a 404 response, implement a short delay of 1 second before requesting the resource.

## 409 - Conflict <a href="#id-409" id="id-409"></a>

The resource that you are trying to create most likely already exists.

You will get this error if you are trying to create a new label with the same name as an existing one, or if you invite a member to an organization or project who is already invited.

It is also possible to get this error if you are trying to change a resource rapidly from different clients at once. If you suspect this, then read out the related resources again, apply any changes, and try to do the operation again.

## 429 - Too many requests <a href="#id-429" id="id-429"></a>

You are sending too many requests to the API too quickly.

When you exceed your rate limit of 75 requests per 10 seconds, you will see this error. This represents a steady state of 7.5 requests per second, but we also allow for shorter bursts, up to the limit of 75 requests per 10 seconds.

#### Retry-After header

When you exceed this limit, this error response will have an attached `Retry-After` header. This header can be used to schedule a retry no earlier than the provided `Retry-After` value in seconds.&#x20;

For example, let us say that you are trying to read-modify-write a specific label on many devices as quickly as possible. After running 75 requests in 1 second, you will get a “429 - Too many requests” error response. In response, you will get a `Retry-After` which will tell you to wait 9 seconds before retrying again.

Please note that while this burst-wait-burst is possible, spreading out requests over time is preferred.

## 500 - Internal server error <a href="#id-500" id="id-500"></a>

There has been an internal error in our services.

This error is usually intermittent, and we recommend you retry the request with an exponential backoff with a minimum 1-second delay.

If the error persists, please check our [Status Page](https://status.disruptive-technologies.com/). If there is no announced downtime, please get in touch with [Support](https://support.disruptive-technologies.com/hc/en-us/articles/360010678499).

## 501 - Method Not Allowed <a href="#id-501" id="id-501"></a>

Indicates that the wrong HTTP verb has been used for the request.

This error can be returned for example if you send a `GET`request when the endpoint requires a `POST`request. Double check the [REST API reference docs](https://developer.disruptive-technologies.com/api) to make sure you're using the correct HTTP verb.

## 503 - Service unavailable <a href="#id-503" id="id-503"></a>

See **500 - Internal Server Error**.

## 504 - Gateway timeout <a href="#id-504" id="id-504"></a>

See **500 - Internal Server Error**, but retry with a minimum 10s delay.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.developer.disruptive-technologies.com/error-codes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
