Working with the Custom Scripts API

With the Custom Scripts API, register custom scripts bundle that you've created with the API. Then use those custom scripts on documents by referencing the {SCRIPT_ID} and {SCRIPT_NAME}.

Before you start

In the cURL commands, be sure to:

Register a custom script

Custom script workflow

New custom scripts get registered by making a POST call to the API.

Quickstart

Use this cURL command to register a custom script. Be sure to update the {YOUR_CUSTOM_SCRIPT_ZIP} with the path to your custom script.

curl --request POST \
--url https://indesign.adobe.io/v3/scripts \
--header 'Authorization: Bearer {YOUR_OAUTH_TOKEN}' \
--header 'x-api-key: {YOUR_API_KEY}' \
--header 'Content-Type: multipart/form-data' \
--header 'x-gw-ims-org-id: {YOUR_ORG_ID}' \
--form file=@{YOUR_CUSTOM_SCRIPT_ZIP}

In the response, you'll receive a url which contains {SCRIPT_ID} and {SCRIPT_NAME}.

Example response

{
  "url": "https://indesign.adobe.io/v3/{SCRIPT_ID}/{SCRIPT_NAME}",
  "capability": "sample-execution",
  "version": "1.0.0"
}

Execute a custom script

Status poll script

Assets specified in the execution request are downloaded on the local file system using the specified identifiers. The custom script should be authored to work against locally downloaded assets.

The execution request can include a JSON dictionary as a parameter. The custom script defines the parameters and passes as is to it during execution

The generated output uploads to the target location. If no location is provided, the assets upload to temporary storage.

Each execution request is an asynchronous operation for which the status can be fetched using the Status API. A link with expiry is provided in the execution status.

Quickstart

Use this cURL command to run a custom script on a document.

curl --request POST \
--url https://indesign.adobe.io/v3/{SCRIPT_ID}/{SCRIPT_NAME} \
--header 'Authorization: Bearer {YOUR_OAUTH_TOKEN}' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--header 'x-gw-ims-org-id: {YOUR_ORG_ID}' \
--data-raw '{
  "assets": [
    {
      "source": {
        "url": "{YOUR_PRE-SIGNED_URL}"
      },
      "destination": "sample.indd"
    }
  ],
  "params": {
    "targetDocument": "sample.indd",
    "outputPath": "converted.idml"
  },
}'

The raw data may include three parts:

Consult this skeleton cURL request for more details.

Example response

{ 

"jobId": "9b9d00c5-8659-4766-8430-ed0a1c9bd87d", 

"statusUrl": "https://indesign.adobe.io/v3/status/9b9d00c5-8659-4766-8430-ed0a1c9bd87d" 

}