# REST Resource: customBiddingAlgorithms.scripts

- [Resource: CustomBiddingScript](https://developers.google.com/display-video/api/reference/rest/v4/customBiddingAlgorithms.scripts#CustomBiddingScript)
  - [JSON representation](https://developers.google.com/display-video/api/reference/rest/v4/customBiddingAlgorithms.scripts#CustomBiddingScript.SCHEMA_REPRESENTATION)
- [State](https://developers.google.com/display-video/api/reference/rest/v4/customBiddingAlgorithms.scripts#State)
- [ScriptError](https://developers.google.com/display-video/api/reference/rest/v4/customBiddingAlgorithms.scripts#ScriptError)
  - [JSON representation](https://developers.google.com/display-video/api/reference/rest/v4/customBiddingAlgorithms.scripts#ScriptError.SCHEMA_REPRESENTATION)
- [ErrorCode](https://developers.google.com/display-video/api/reference/rest/v4/customBiddingAlgorithms.scripts#ErrorCode)
- [CustomBiddingScriptRef](https://developers.google.com/display-video/api/reference/rest/v4/customBiddingAlgorithms.scripts#CustomBiddingScriptRef)
  - [JSON representation](https://developers.google.com/display-video/api/reference/rest/v4/customBiddingAlgorithms.scripts#CustomBiddingScriptRef.SCHEMA_REPRESENTATION)
- [Methods](https://developers.google.com/display-video/api/reference/rest/v4/customBiddingAlgorithms.scripts#METHODS_SUMMARY)

## Resource: CustomBiddingScript

A single custom bidding script.

| JSON representation |
|---|
| ``` { "name": string, "customBiddingAlgorithmId": string, "customBiddingScriptId": string, "createTime": string, "active": boolean, "state": enum (`https://developers.google.com/display-video/api/reference/rest/v4/customBiddingAlgorithms.scripts#State`), "errors": [ { object (`https://developers.google.com/display-video/api/reference/rest/v4/customBiddingAlgorithms.scripts#ScriptError`) } ], "script": { object (`https://developers.google.com/display-video/api/reference/rest/v4/customBiddingAlgorithms.scripts#CustomBiddingScriptRef`) } } ``` |

| Fields ||
|---|---|
| `name` | `string` Output only. The resource name of the custom bidding script. |
| `customBiddingAlgorithmId` | `string (https://developers.google.com/discovery/v1/type-format format)` Output only. The unique ID of the custom bidding algorithm the script belongs to. |
| `customBiddingScriptId` | `string (https://developers.google.com/discovery/v1/type-format format)` Output only. The unique ID of the custom bidding script. |
| `createTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. The time when the script was created. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `active` | `boolean` Output only. Whether the script is currently being used for scoring by the parent algorithm. |
| `state` | ``enum (`https://developers.google.com/display-video/api/reference/rest/v4/customBiddingAlgorithms.scripts#State`)`` Output only. The state of the custom bidding script. |
| `errors[]` | ``object (`https://developers.google.com/display-video/api/reference/rest/v4/customBiddingAlgorithms.scripts#ScriptError`)`` Output only. Error details of a rejected custom bidding script. This field will only be populated when `https://developers.google.com/display-video/api/reference/rest/v4/customBiddingAlgorithms.scripts#CustomBiddingScript.FIELDS.state` is REJECTED. |
| `script` | ``object (`https://developers.google.com/display-video/api/reference/rest/v4/customBiddingAlgorithms.scripts#CustomBiddingScriptRef`)`` The reference to the uploaded script file. |

## State

Possible states of a custom bidding script.

| Enums ||
|---|---|
| `STATE_UNSPECIFIED` | The script state is not specified or is unknown in this version. |
| `ACCEPTED` | The script has been accepted for scoring impressions. |
| `REJECTED` | The script has been rejected by backend pipelines. It may have errors. |
| `PENDING` | The script is being processed for backend pipelines. |

## ScriptError

An error message for a custom bidding script.

| JSON representation |
|---|
| ``` { "errorCode": enum (`https://developers.google.com/display-video/api/reference/rest/v4/customBiddingAlgorithms.scripts#ErrorCode`), "line": string, "column": string, "errorMessage": string } ``` |

| Fields ||
|---|---|
| `errorCode` | ``enum (`https://developers.google.com/display-video/api/reference/rest/v4/customBiddingAlgorithms.scripts#ErrorCode`)`` The type of error. |
| `line` | `string (https://developers.google.com/discovery/v1/type-format format)` The line number in the script where the error was thrown. |
| `column` | `string (https://developers.google.com/discovery/v1/type-format format)` The column number in the script where the error was thrown. |
| `errorMessage` | `string` The detailed error message. |

## ErrorCode

Possible error codes of a custom bidding script error.

| Enums ||
|---|---|
| `ERROR_CODE_UNSPECIFIED` | The script error is not specified or is unknown in this version. |
| `SYNTAX_ERROR` | The script has a syntax error. |
| `DEPRECATED_SYNTAX` | The script uses deprecated syntax. |
| `INTERNAL_ERROR` | Internal errors were thrown while processing the script. |

## CustomBiddingScriptRef

The reference to the uploaded custom bidding script file.

| JSON representation |
|---|
| ``` { "resourceName": string } ``` |

| Fields ||
|---|---|
| `resourceName` | `string` A resource name to be used in `https://developers.google.com/display-video/api/reference/rest/v4/media/download#google.bytestream.RestByteStream.GetMedia` to Download the script files. Or `https://developers.google.com/display-video/api/reference/rest/v4/media/upload#google.bytestream.RestByteStream.UpdateMedia` to Upload the script files. Resource names have the format `customBiddingAlgorithms/{customBiddingAlgorithmId}/scriptRef/{ref_id}`. |

| ## Methods ||
|---|---|
| ### `https://developers.google.com/display-video/api/reference/rest/v4/customBiddingAlgorithms.scripts/create` | Creates a new custom bidding script. |
| ### `https://developers.google.com/display-video/api/reference/rest/v4/customBiddingAlgorithms.scripts/get` | Gets a custom bidding script. |
| ### `https://developers.google.com/display-video/api/reference/rest/v4/customBiddingAlgorithms.scripts/list` | Lists custom bidding scripts that belong to the given algorithm. |