For the complete documentation index, see llms.txt. This page is also available as Markdown.

Scripts

Scripts are reusable JavaScript functions that extend integration behavior. Use them as hooks in flows, logic in APIs and tools, or prompts in AI agents.

Script schema

List scripts

get
/v1/scripts

Returns all scripts in the account. Response omits content to reduce payload size.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Query parameters
limitinteger · min: 1 · max: 1000Optional

Maximum number of scripts to return per page.

Default: 1000Example: 100
includestringOptional

Comma-separated list of fields to project into each returned record. Triggers summary projection: the response contains a minimal identity set (_id, name, plus resource-specific fields) with the requested fields added on top. Supports dot notation for nested fields. Mutually exclusive with exclude.

Example: _integrationId,disabled,lastModified
excludestringOptional

Comma-separated list of fields to strip from the default response. Unlike include, does not trigger summary projection — returns the full record with the named fields removed. Protected identity fields (e.g. name) cannot be stripped. Mutually exclusive with include.

Example: createdAt,lastModified
Responses
200

Array of script objects.

application/json
get/v1/scripts
GET /v1/scripts HTTP/1.1
Host: api.integrator.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
[
  {
    "_id": "6356f24327114d57ab843e1f",
    "name": "Add Discounts",
    "sandbox": false,
    "postResponseHookToProcessOnChildRecord": false,
    "createdAt": "2022-10-24T20:14:59.070Z",
    "lastModified": "2026-04-18T13:52:49.729Z"
  },
  {
    "_id": "683e20e605d370cc2ec1798c",
    "name": "Order Transform",
    "description": "Transforms order data before import",
    "sandbox": false,
    "postResponseHookToProcessOnChildRecord": false,
    "_sourceId": "6356f24327114d57ab843e1f",
    "createdAt": "2025-06-02T22:08:38.739Z",
    "lastModified": "2025-06-02T22:08:38.819Z"
  }
]

Create a script

post
/v1/scripts

Creates a new script.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Body

Fields for creating or updating a script.

namestring · min: 1 · max: 100Required

Display name for the script.

Example: Order Transform Hook
descriptionstring · max: 1024Optional

Free-text explanation of what the script does.

Example: Adds discount line items to each order before import
contentstringOptional

JavaScript source code. Optional on create — the server initializes omitted content to an empty string. Omitting it on update leaves the stored source unchanged (it is not cleared).

Example: function preSavePage(options) { return { data: options.data, errors: options.errors }; }
postResponseHookToProcessOnChildRecordbooleanOptional

When true, postResponseMap hooks run once per child record in a one-to-many mapping instead of once per parent.

Default: false
_templateIdstring · objectIdOptional

Optional template identifier used to generate or structure script content.

Responses
201

Created script.

application/json

Script resource as returned by the API.

_idstring · objectIdRead-onlyRequired

Unique identifier for the script.

Example: 6356f24327114d57ab843e1f
namestring · max: 100Required

Display name for the script.

Example: Order Transform Hook
descriptionstring · max: 1024Optional

Free-text explanation of what the script does.

Example: Adds discount line items to each order before import
contentstringOptional

JavaScript source code. Only returned on GET-by-ID, omitted from list responses to reduce payload size.

Example: function preSavePage(options) { return { data: options.data, errors: options.errors }; }
postResponseHookToProcessOnChildRecordbooleanOptional

When true, postResponseMap hooks run once per child record in a one-to-many mapping instead of once per parent.

Default: false
debugUntilstring · date-timeRead-onlyOptional

Debug logging is active until this timestamp. Absent or in the past means debug is off. Can only be set via PATCH — ignored on POST and PUT. Maximum 1 hour from the current time.

Example: 2026-05-22T03:30:00.000Z
_sourceIdstring · objectIdRead-onlyOptional

Source script this was cloned from. Present only on scripts created by cloning.

Example: 6356f24327114d57ab843e1f
_templateIdstring · objectIdRead-onlyOptional

The template (templates resource) this script was generated from. Present only on scripts created from a template; omitted otherwise.

Example: 64a1b2c3d4e5f6a7b8c9d0e1
createdAtstring · date-timeRead-onlyRequired

Timestamp when the script was created.

Example: 2022-10-24T20:14:59.070Z
lastModifiedstring · date-timeRead-onlyRequired

Timestamp when the script was last updated.

Example: 2026-04-18T13:52:49.729Z
post/v1/scripts
POST /v1/scripts HTTP/1.1
Host: api.integrator.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 123

{
  "name": "My Hook",
  "content": "function preSavePage(options) {\n  return { data: options.data, errors: options.errors };\n}"
}
{
  "_id": "683e20e605d370cc2ec1798c",
  "name": "Order Transform",
  "sandbox": false,
  "postResponseHookToProcessOnChildRecord": false,
  "createdAt": "2025-06-02T22:08:38.739Z",
  "lastModified": "2025-06-02T22:08:38.819Z"
}

Get a script

get
/v1/scripts/{_id}

Returns a single script by ID, including the full content field.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
_idstring · objectIdRequired

Script ID.

Responses
200

Script object.

application/json

Script resource as returned by the API.

_idstring · objectIdRead-onlyRequired

Unique identifier for the script.

Example: 6356f24327114d57ab843e1f
namestring · max: 100Required

Display name for the script.

Example: Order Transform Hook
descriptionstring · max: 1024Optional

Free-text explanation of what the script does.

Example: Adds discount line items to each order before import
contentstringOptional

JavaScript source code. Only returned on GET-by-ID, omitted from list responses to reduce payload size.

Example: function preSavePage(options) { return { data: options.data, errors: options.errors }; }
postResponseHookToProcessOnChildRecordbooleanOptional

When true, postResponseMap hooks run once per child record in a one-to-many mapping instead of once per parent.

Default: false
debugUntilstring · date-timeRead-onlyOptional

Debug logging is active until this timestamp. Absent or in the past means debug is off. Can only be set via PATCH — ignored on POST and PUT. Maximum 1 hour from the current time.

Example: 2026-05-22T03:30:00.000Z
_sourceIdstring · objectIdRead-onlyOptional

Source script this was cloned from. Present only on scripts created by cloning.

Example: 6356f24327114d57ab843e1f
_templateIdstring · objectIdRead-onlyOptional

The template (templates resource) this script was generated from. Present only on scripts created from a template; omitted otherwise.

Example: 64a1b2c3d4e5f6a7b8c9d0e1
createdAtstring · date-timeRead-onlyRequired

Timestamp when the script was created.

Example: 2022-10-24T20:14:59.070Z
lastModifiedstring · date-timeRead-onlyRequired

Timestamp when the script was last updated.

Example: 2026-04-18T13:52:49.729Z
get/v1/scripts/{_id}
GET /v1/scripts/{_id} HTTP/1.1
Host: api.integrator.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "_id": "6356f24327114d57ab843e1f",
  "name": "Add Discounts",
  "sandbox": false,
  "postResponseHookToProcessOnChildRecord": false,
  "content": "function preSavePage(options) {\n  return { data: options.data, errors: options.errors };\n}",
  "createdAt": "2022-10-24T20:14:59.070Z",
  "lastModified": "2026-04-18T13:52:49.729Z"
}

Update a script

put
/v1/scripts/{_id}

Replaces a script's mutable fields.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
_idstring · objectIdRequired

Script ID.

Body

Fields for creating or updating a script.

namestring · min: 1 · max: 100Required

Display name for the script.

Example: Order Transform Hook
descriptionstring · max: 1024Optional

Free-text explanation of what the script does.

Example: Adds discount line items to each order before import
contentstringOptional

JavaScript source code. Optional on create — the server initializes omitted content to an empty string. Omitting it on update leaves the stored source unchanged (it is not cleared).

Example: function preSavePage(options) { return { data: options.data, errors: options.errors }; }
postResponseHookToProcessOnChildRecordbooleanOptional

When true, postResponseMap hooks run once per child record in a one-to-many mapping instead of once per parent.

Default: false
_templateIdstring · objectIdOptional

Optional template identifier used to generate or structure script content.

Responses
200

Updated script.

application/json

Script resource as returned by the API.

_idstring · objectIdRead-onlyRequired

Unique identifier for the script.

Example: 6356f24327114d57ab843e1f
namestring · max: 100Required

Display name for the script.

Example: Order Transform Hook
descriptionstring · max: 1024Optional

Free-text explanation of what the script does.

Example: Adds discount line items to each order before import
contentstringOptional

JavaScript source code. Only returned on GET-by-ID, omitted from list responses to reduce payload size.

Example: function preSavePage(options) { return { data: options.data, errors: options.errors }; }
postResponseHookToProcessOnChildRecordbooleanOptional

When true, postResponseMap hooks run once per child record in a one-to-many mapping instead of once per parent.

Default: false
debugUntilstring · date-timeRead-onlyOptional

Debug logging is active until this timestamp. Absent or in the past means debug is off. Can only be set via PATCH — ignored on POST and PUT. Maximum 1 hour from the current time.

Example: 2026-05-22T03:30:00.000Z
_sourceIdstring · objectIdRead-onlyOptional

Source script this was cloned from. Present only on scripts created by cloning.

Example: 6356f24327114d57ab843e1f
_templateIdstring · objectIdRead-onlyOptional

The template (templates resource) this script was generated from. Present only on scripts created from a template; omitted otherwise.

Example: 64a1b2c3d4e5f6a7b8c9d0e1
createdAtstring · date-timeRead-onlyRequired

Timestamp when the script was created.

Example: 2022-10-24T20:14:59.070Z
lastModifiedstring · date-timeRead-onlyRequired

Timestamp when the script was last updated.

Example: 2026-04-18T13:52:49.729Z
put/v1/scripts/{_id}
PUT /v1/scripts/{_id} HTTP/1.1
Host: api.integrator.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 132

{
  "name": "Add Discounts v2",
  "content": "function preSavePage(options) {\n  return { data: options.data, errors: options.errors };\n}"
}
{
  "_id": "6356f24327114d57ab843e1f",
  "name": "Add Discounts v2",
  "sandbox": false,
  "postResponseHookToProcessOnChildRecord": false,
  "content": "function preSavePage(options) {\n  return { data: options.data, errors: options.errors };\n}",
  "createdAt": "2022-10-24T20:14:59.070Z",
  "lastModified": "2026-04-21T09:05:11.342Z"
}

Delete a script

delete
/v1/scripts/{_id}

Deletes a script. Soft-deleted and retained in the recycle bin for 30 days.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
_idstring · objectIdRequired

Script ID.

Responses
204

Script deleted.

No content

delete/v1/scripts/{_id}
DELETE /v1/scripts/{_id} HTTP/1.1
Host: api.integrator.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*

No content

Patch a script

patch
/v1/scripts/{_id}

Partially updates a script using JSON Patch (RFC 6902). Only /debugUntil is a supported path — all others are rejected with 422. Supported operations: replace, add, remove. The value must be an ISO-8601 timestamp no more than 1 hour in the future.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
_idstring · objectIdRequired

Script ID.

Bodyobject[]
opstring · enumRequired

The operation to perform.

Possible values:
pathstring · enumRequired

JSON Pointer to the field to patch.

Possible values:
valuestring · date-timeOptional

ISO-8601 timestamp. Required for replace and add, omit for remove.

Example: 2026-05-02T16:00:00.000Z
Responses
204

Script patched.

No content

patch/v1/scripts/{_id}
PATCH /v1/scripts/{_id} HTTP/1.1
Host: api.integrator.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 74

[
  {
    "op": "replace",
    "path": "/debugUntil",
    "value": "2026-05-02T16:00:00.000Z"
  }
]

No content

Get debug logs for a script

get
/v1/scripts/{_id}/logs

Returns console output captured while debug is enabled on the script (debugUntil set to a future timestamp).

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
_idstring · objectIdRequired

Script ID.

Responses
200

Log entries for the script.

application/json
get/v1/scripts/{_id}/logs
GET /v1/scripts/{_id}/logs HTTP/1.1
Host: api.integrator.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "logs": [
    {
      "time": "2026-05-22 01:24:38.697",
      "functionType": "preSavePage",
      "_resourceId": "6843b67b35b64c0bcba2fd69",
      "logLevel": "WARN",
      "message": "test warning from preSavePage"
    },
    {
      "time": "2026-05-22 01:24:38.697",
      "functionType": "preSavePage",
      "_resourceId": "6843b67b35b64c0bcba2fd69",
      "logLevel": "INFO",
      "message": "test log message from preSavePage"
    }
  ]
}

Delete debug logs for a script

delete
/v1/scripts/{_id}/logs

Deletes all debug logs for the specified script. Synchronous and idempotent — works even if the script has no logs.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
_idstring · objectIdRequired

Script ID.

Responses
204

Logs deleted.

No content

delete/v1/scripts/{_id}/logs
DELETE /v1/scripts/{_id}/logs HTTP/1.1
Host: api.integrator.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*

No content

Get audit log for a script

get
/v1/scripts/{_id}/audit

Returns the change history for a script. Each entry records a mutation event with who made the change, when, and which fields were affected.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
_idstring · objectIdRequired

Script ID.

Example: 6356f24327114d57ab843e1f
Query parameters
limitinteger · min: 1 · max: 1000Optional

Maximum number of audit entries to return per page.

Default: 1000Example: 100
afterstringOptional

Opaque pagination cursor for the next page. Take it from the after value in the Link response header's rel="next" URL rather than constructing it.

Example: W3siJGRhdGUiOiIyMDI2LTA1LTAxVDAwOjAwOjAwLjAwMFoifSwiNjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwIl0
fromstring · date-timeOptional

Only return entries at or after this timestamp.

Example: 2026-05-01T00:00:00.000Z
tostring · date-timeOptional

Only return entries at or before this timestamp.

Example: 2026-05-31T23:59:59.999Z
actionstring · enumOptional

Filter by the change type. Maps to the event field on each entry.

Example: updatePossible values:
sourcestring · enumOptional

Filter by how the change was initiated.

Example: uiPossible values:
_byUserIdstring · objectIdOptional

Filter to changes performed by a single user.

Example: 624cb0346309dc3a543733a2
Responses
200

Array of audit entries, newest first.

application/json
get/v1/scripts/{_id}/audit
GET /v1/scripts/{_id}/audit HTTP/1.1
Host: api.integrator.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
[
  {
    "_id": "69e38cb1a749d34a9732a270",
    "resourceType": "script",
    "_resourceId": "6356f24327114d57ab843e1f",
    "source": "api",
    "event": "update",
    "time": "2026-04-18T13:52:49.729Z",
    "byUser": {
      "_id": "624cb0346309dc3a543733a2",
      "email": "user@example.com",
      "name": "Tyler Lamparter"
    },
    "fieldChanges": [
      {
        "fieldPath": "debugUntil",
        "oldValue": "2026-04-18T14:52:43.041Z"
      }
    ]
  }
]

List dependencies of a script

get
/v1/scripts/{_id}/dependencies

Returns the set of resources that depend on the specified script.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
_idstring · objectIdRequired

Script ID.

Responses
200

Dependency map. Keys are resource-type strings; values are arrays of dependency entries. Returns {} when no dependents exist.

application/json

Map of dependent-resource types to arrays of dependency entries. Keys are plural resource type strings (e.g. flows, imports, connections). An empty object {} means no dependents.

get/v1/scripts/{_id}/dependencies
GET /v1/scripts/{_id}/dependencies HTTP/1.1
Host: api.integrator.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{}

Last updated

Was this helpful?