Initiate a script execution#
Description#
Starts the process to execute a script. This is a long-running operation.
The response includes a Location header (and an operationLocation field in the response body) that points to the operation polling endpoint. For more details on long-running job polling, see Operations endpoint.
When the operation completes successfully, its resourceUrl points to the script run at /scripts/{scriptId}/runs/{runId}.
POST /scripts/{scriptId}/execution
Required OAuth Scopes
file:write
Parameters#
Parameter |
In |
Type |
Required |
Description |
|---|---|---|---|---|
X-Version |
header |
string |
true |
Version of the API (2026-09-01.scripting.preview) |
scriptId |
path |
string |
true |
The unique identifier of the script |
X-Scripting-Nonce |
header |
string |
false |
A client-generated idempotency key. If a request with the same nonce was already processed for this script, the original run is returned instead of starting a new one. |
body |
body |
true |
The environment variables with which to start a run |
Body parameter example#
{
"SpreadsheetId": "9ba1b5dfbd3b4c8997f309fa61180b87",
"apiKey": "Az86pm34xyz",
"has-changed": "true",
"row_number": "27"
}
Code Samples#
curl -X POST https://api.app.wdesk.com/scripts/{scriptId}/execution \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'X-Scripting-Nonce: string' \
-H 'Authorization: Bearer {access-token}' \
-H 'X-Version: 2026-09-01.scripting.preview'
http POST https://api.app.wdesk.com/scripts/{scriptId}/execution \
X-Version:2026-09-01.scripting.preview \
Content-Type:application/json \
Accept:application/json \
X-Scripting-Nonce:string \
Authorization:"Bearer {access-token}"
wget --method=POST "https://api.app.wdesk.com/scripts/{scriptId}/execution" \
--output-document - \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'X-Scripting-Nonce: string' \
--header 'Authorization: Bearer {access-token}' \
--header 'X-Version: 2026-09-01.scripting.preview'
import requests
headers = {
'X-Version': '2026-09-01.scripting.preview',
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-Scripting-Nonce': 'string',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.app.wdesk.com/scripts/{scriptId}/execution', headers = headers)
print(r.headers['Location'])
Returns#
202 - Accepted#
Response body for asynchronous operations. Contains an operationLocation field that specifies the URL to poll for the operation result. This URL can also be found in the Location header on the response.
Header |
Description |
|---|---|
Location |
The location to poll for the operation result. |
Retry-After |
The number of seconds to wait before polling for a result and between polling attempts. |
400 - Bad Request#
Error response that indicates that the service is not able to process the incoming request. The reason is provided in the error message.
403 - Forbidden#
Error response that indicates that the service is not able to process the incoming request. The reason is provided in the error message.
404 - Not Found#
Error response that indicates that the service is not able to process the incoming request. The reason is provided in the error message.
429 - Too Many Requests#
Error response that indicates that the service is not able to process the incoming request. The reason is provided in the error message.
500 - Internal Server Error#
Error response that indicates that the service is not able to process the incoming request. The reason is provided in the error message.
Example Responses#
{
"operationLocation": "https://api.app.wdesk.com/operations/128f274395254cf17eda6b3eb3d021b9"
}
{
"code": "400BadRequest",
"message": "The request was unacceptable, often due to a missing or invalid parameter"
}
{
"code": "401Unauthorized",
"message": "No valid API token provided"
}
{
"code": "403Forbidden",
"message": "The API token does not have permissions to perform the request"
}
{
"code": "404NotFound",
"message": "The requested resource could not be found"
}
{
"code": "429TooManyRequests",
"message": "Too many requests have been made against the API in too short a time"
}
{
"code": "500InternalServerError",
"message": "The server encountered an unexpected condition that prevented it from fulfilling the request"
}
{
"code": "503ServiceUnavailable",
"message": "The server cannot handle the request due to a temporary overload or scheduled maintenance"
}