# Method: adPlays.createWithExternalIds

- [HTTP request](https://developers.google.com/display-video/out-of-home-seller/reference/rest/v1beta1/adPlays/createWithExternalIds#body.HTTP_TEMPLATE)
- [Request body](https://developers.google.com/display-video/out-of-home-seller/reference/rest/v1beta1/adPlays/createWithExternalIds#body.request_body)
  - [JSON representation](https://developers.google.com/display-video/out-of-home-seller/reference/rest/v1beta1/adPlays/createWithExternalIds#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://developers.google.com/display-video/out-of-home-seller/reference/rest/v1beta1/adPlays/createWithExternalIds#body.response_body)
- [Authorization Scopes](https://developers.google.com/display-video/out-of-home-seller/reference/rest/v1beta1/adPlays/createWithExternalIds#body.aspect)
- [Examples](https://developers.google.com/display-video/out-of-home-seller/reference/rest/v1beta1/adPlays/createWithExternalIds#examples)

Creates an ad play with external ids.

- Returns the newly created ad play if successful.
- Returns error code `INVALID_ARGUMENT` if invalid ad unit external id, order external id, line external id, or creative asset external id are specified.
- Returns error code `INVALID_ARGUMENT` if an ad play for the same ad unit, order, line, and creative with the same startTime already exists.
- Returns error code `NOT_FOUND` if no matching ad unit external id, order external id, line external id, or creative asset external id found.

### HTTP request

`POST https://dv360outofhomeseller.googleapis.com/v1beta1/adPlays:createWithExternalIds`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "lineExternalId": string, "orderExternalId": string, "adUnitExternalId": string, "creativeAssetExternalId": string, "startTime": string, "endTime": string, "recordTime": string, "impressions": number } ``` |

| Fields ||
|---|---|
| `lineExternalId` | `string` Required. The external id of the line this ad play belongs to. Format: `123`. |
| `orderExternalId` | `string` Required. The external id of the order this ad play belongs to. Format: `456`. |
| `adUnitExternalId` | `string` Required. The external id of the ad unit this ad play was served on. Format: `789`. |
| `creativeAssetExternalId` | `string` Required. The external id of the creative this ad play served. Format: `3210`. |
| `startTime` | ``string (`https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp` format)`` Required. Time the ad started to play (inclusive). Should be in the past and within the last 3 days. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: `"2014-10-02T15:01:23Z"` and `"2014-10-02T15:01:23.045123456Z"`. |
| `endTime` | ``string (`https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp` format)`` Required. Time the ad play ended (exclusive). Should be in the past and after start time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: `"2014-10-02T15:01:23Z"` and `"2014-10-02T15:01:23.045123456Z"`. |
| `recordTime` | ``string (`https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp` format)`` Optional. Time this ad play was recorded. Should be in the past and after end time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: `"2014-10-02T15:01:23Z"` and `"2014-10-02T15:01:23.045123456Z"`. |
| `impressions` | `number` Required. Total number of impressions. |

### Response body

If successful, the response body contains an instance of `https://developers.google.com/display-video/out-of-home-seller/reference/rest/v1beta1/adPlays#AdPlay`.

### Authorization Scopes

Requires the following OAuth scope:

- `https://www.googleapis.com/auth/doubleclickbidmanager`

For more information, see the [OAuth 2.0 Overview](https://developers.google.com/identity/protocols/OAuth2).