# Errors and warnings

The Display \& Video 360 API can respond with a number of errors and warnings. A healthy API
solution must handle these errors.

## API errors

Requests to the API that fail to do the intended action return an error. Error
responses should be caught and handled.

> [!CAUTION]
> **Caution:** Requests returning errors count against quota. Reduce your error rate to better use your API quota.

An API error response has an HTTP response code, an error message, and a [Google
RPC code](https://cloud.google.com/apis/design/errors#handling_errors) status. It has the following format:

    {
      "error": {
        "code": integer,
        "message": string,
        "status": enum (google.rpc.Code)
      }
    }

The following is a list of common API errors and recommended actions:

> [!NOTE]
> **Note:** If an error persists despite taking action, [contact
> support](https://developers.google.com/display-video/api/support/contact).

| Error codes ||
|---|---|
| `400` | `INVALID_ARGUMENT` There is an issue with your request. Review the message field in the error response and update your request accordingly. |
| `401` | `UNAUTHENTICATED` Your request couldn't be properly authenticated. Verify that you are including valid OAuth credentials in your request. For more information, reference our [Quickstart guide](https://developers.google.com/display-video/api/guides/quickstart/overview). |
| `403` | `PERMISSION_DENIED` You don't have the permissions needed to complete the request. Verify that your user account has the proper permissions for the relevant partner or advertiser. |
| `404` | `NOT_FOUND` The resource you are trying to retrieve can't be found. Verify that the ID you are using is correct and for the resource type being retrieved. |
| `409` | `ABORTED` The resource you are trying to modify is being modified elsewhere. Wait a few seconds and then retry the request. |
| `429` | `RESOURCE_EXHAUSTED` You have exceeded your [rate limit or daily request quota](https://developers.google.com/display-video/api/limits). Use the [Google Cloud console](https://console.developers.google.com/project/_/apiui/apiview/displayvideo.googleapis.com/metrics) to examine your API usage. Update your workflow to perform within the existing quota limits. For more information, see our guide on [Usage Optimization](https://developers.google.com/display-video/api/guides/concepts/optimization/quota). |
| `500` | `INTERNAL` The API experienced an internal error. Wait a few seconds and then retry the request. If the error persists, [contact support](https://developers.google.com/display-video/api/support/contact). |
| `504` | `DEADLINE_EXCEEDED` The API took too long to complete the request. Wait a few seconds and then retry the request. If the error persists, [contact support](https://developers.google.com/display-video/api/support/contact). |

## SDF errors

The Display \& Video 360 API uses long-running tasks to [produce Structured Data Files
(SDFs)](https://developers.google.com/display-video/api/guides/tasks/download-sdf/create-download-task). Errors in **creating** the SDFs are returned in
the finished `operation`. The [`error`](https://developers.google.com/display-video/api/reference/rest/current/sdfdownloadtasks.operations#Operation.FIELDS.error) field will contain the details.
See this truncated example:

    {
      ...
      "done": true,
      "error": {
        "code": 3,
        "message": "We couldn't prepare your CSV files: Invalid filter Ids for Advertiser: 00000000"
      }
    }

If the error message is not clear, we recommend the following:

- Verify that your user has at least a **Standard** user role for the parent [partner](https://developers.google.com/display-video/api/reference/rest/current/sdfdownloadtasks/create#body.request_body.FIELDS.partner_id) or [advertiser](https://developers.google.com/display-video/api/reference/rest/current/sdfdownloadtasks/create#body.request_body.FIELDS.partner_id).
- Confirm that the IDs provided in the [filter](https://developers.google.com/display-video/api/reference/rest/current/sdfdownloadtasks/create#body.request_body.FIELDS.oneof_filtering_option) are accurate. The IDs must correspond to the intended resource type and must be child resources of the [root id](https://developers.google.com/display-video/api/reference/rest/current/sdfdownloadtasks/create#body.request_body.FIELDS.oneof_root_id).
- Make sure that your user has less than twenty concurrent SDF download tasks.

If you are still seeing errors, [contact support](https://developers.google.com/display-video/api/support/contact).

## Non-blocking Warnings

[Non-blocking warnings](https://developers.google.com/display-video/api/reference/rest/current/advertisers.lineItems#LineItemWarningMessage) indicate an issue that may impact a line
item's ad serving. Similar warnings are seen in the UI. These warnings are
passive and listed in the [line item](https://developers.google.com/display-video/api/reference/rest/current/advertisers.lineItems#LineItem.FIELDS.warning_messages).

The root cause of a warning can impact the serving of a line item. In some cases
it could prevent ad serving entirely.

### Prevention

Some non-blocking warnings are caused by the misconfiguration of a line item:

- **Flight** : A line item won't serve ads if its [flight](https://developers.google.com/display-video/api/reference/rest/current/advertisers.lineItems#LineItem.FIELDS.flight) is invalid or if its insertion order's flight is expired. Make sure that a line item has a flight within that of its insertion order.
- **Assigned creatives** : A line item can't serve if a valid [creative](https://developers.google.com/display-video/api/reference/rest/current/advertisers.lineItems#LineItem.FIELDS.creative_ids) isn't assigned to it.
- **Targeting** : A line item's ad serving may be impacted or prevented altogether if its [targeting](https://developers.google.com/display-video/api/reference/rest/current/advertisers.lineItems.targetingTypes.assignedTargetingOptions) isn't assigned correctly.

Make sure that an existing line item isn't generating any warnings before using
its configurations in a new line item.

### Monitoring

Non-blocking warnings can come up while a line item is in flight. Monitor your
active line items for new warnings to make sure that they are serving correctly.
Get line items in bulk with a [`list`](https://developers.google.com/display-video/api/reference/rest/current/advertisers.lineItems/list) request. If a line item returns
an unexpected warning, address the issue as soon as possible to reduce the
impact to serving.

Warnings can be added even if settings or targeting haven't changed. Examples of
this include:

- The insertion order is paused or expires.
- A user list or targeting option is deprecated.