> For the complete documentation index, see [llms.txt](https://developer.celigo.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.celigo.com/api/api-reference/scripts-and-stacks/scripts.md).

# 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

## The Script object

```json
{"openapi":"3.2.0","info":{"title":"Scripts","version":"1.0.0"},"components":{"schemas":{"Script":{"type":"object","description":"Script resource as returned by the API.","required":["_id","name","createdAt","lastModified"],"properties":{"_id":{"type":"string","format":"objectId","readOnly":true,"description":"Unique identifier for the script."},"name":{"type":"string","maxLength":100,"description":"Display name for the script."},"description":{"type":"string","maxLength":1024,"description":"Free-text explanation of what the script does."},"content":{"type":"string","description":"JavaScript source code. Only returned by a GET of one script; list,\ncreate and update responses omit it."},"postResponseHookToProcessOnChildRecord":{"type":"boolean","default":false,"description":"When true, postResponseMap hooks run once per child record in a one-to-many mapping instead of once per parent."},"debugUntil":{"type":"string","format":"date-time","readOnly":true,"description":"Debug logging is active until this timestamp. Absent or in the past\nmeans debug is off. Can only be set via PATCH — ignored on POST and PUT.\nMaximum 1 hour from the current time."},"_sourceId":{"type":"string","format":"objectId","readOnly":true,"description":"Source script this was cloned from. Present only on scripts created by cloning."},"_templateId":{"type":"string","format":"objectId","readOnly":true,"description":"The template (`templates` resource) this script was generated from. Present only on scripts created from a template; omitted otherwise."},"createdAt":{"type":"string","format":"date-time","readOnly":true,"description":"Timestamp when the script was created."},"lastModified":{"type":"string","format":"date-time","readOnly":true,"description":"Timestamp when the script was last updated."}}}}}}
```

## List scripts

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

```json
{"openapi":"3.2.0","info":{"title":"Scripts","version":"1.0.0"},"tags":[{"name":"Scripts","description":"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.\n\n## Script schema\n\n{% openapi-schemas spec=\"script\" schemas=\"Script\" grouped=\"true\" %}"}],"servers":[{"url":"https://api.integrator.io","description":"Production (US / default region)"},{"url":"https://api.eu.integrator.io","description":"Production (EU region)"},{"url":"https://api.au.integrator.io","description":"Production (AU region)"},{"url":"https://api.ca.integrator.io","description":"Production (CA region)"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}},"parameters":{"Include":{"name":"include","in":"query","required":false,"description":"Comma-separated list of fields to project into each returned record.\nTriggers summary projection: the response contains a minimal identity\nset (`_id`, `name`, plus resource-specific fields) with the requested\nfields added on top. Supports dot notation for nested fields.\nMutually exclusive with `exclude`.","schema":{"type":"string"}},"Exclude":{"name":"exclude","in":"query","required":false,"description":"Comma-separated list of fields to strip from the default response.\nUnlike `include`, does not trigger summary projection — returns the\nfull record with the named fields removed. Protected identity fields\n(e.g. `name`) cannot be stripped. Mutually exclusive with `include`.","schema":{"type":"string"}}},"schemas":{"Script":{"type":"object","description":"Script resource as returned by the API.","required":["_id","name","createdAt","lastModified"],"properties":{"_id":{"type":"string","format":"objectId","readOnly":true,"description":"Unique identifier for the script."},"name":{"type":"string","maxLength":100,"description":"Display name for the script."},"description":{"type":"string","maxLength":1024,"description":"Free-text explanation of what the script does."},"content":{"type":"string","description":"JavaScript source code. Only returned by a GET of one script; list,\ncreate and update responses omit it."},"postResponseHookToProcessOnChildRecord":{"type":"boolean","default":false,"description":"When true, postResponseMap hooks run once per child record in a one-to-many mapping instead of once per parent."},"debugUntil":{"type":"string","format":"date-time","readOnly":true,"description":"Debug logging is active until this timestamp. Absent or in the past\nmeans debug is off. Can only be set via PATCH — ignored on POST and PUT.\nMaximum 1 hour from the current time."},"_sourceId":{"type":"string","format":"objectId","readOnly":true,"description":"Source script this was cloned from. Present only on scripts created by cloning."},"_templateId":{"type":"string","format":"objectId","readOnly":true,"description":"The template (`templates` resource) this script was generated from. Present only on scripts created from a template; omitted otherwise."},"createdAt":{"type":"string","format":"date-time","readOnly":true,"description":"Timestamp when the script was created."},"lastModified":{"type":"string","format":"date-time","readOnly":true,"description":"Timestamp when the script was last updated."}}}},"responses":{"401-unauthorized":{"description":"Unauthorized. The request lacks a valid bearer token, or the provided token\nfailed to authenticate.\n\nNote: the 401 response is produced by the auth middleware **before** the\nrequest reaches the endpoint handler, so it does **not** follow the\nstandard `{errors: [...]}` envelope. Instead the body is a bare\n`{message: string}` object with no `code`, no `errors` array. Callers\nhandling 401s should key off the HTTP status and the `message` string,\nnot try to destructure an `errors[]`.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Human-readable description of the auth failure. Known values:\n- `\"Unauthorized\"` — no `Authorization` header on the request.\n- `\"Bearer Authentication Failed\"` — header present but token\n  is invalid, revoked, or expired."}},"required":["message"]}}}}}},"paths":{"/v1/scripts":{"get":{"summary":"List scripts","description":"Returns all scripts in the account. Response omits `content` to reduce payload size.","tags":["Scripts"],"operationId":"listScripts","parameters":[{"name":"limit","in":"query","required":false,"description":"Maximum number of scripts to return per page.","schema":{"type":"integer","minimum":1,"maximum":1000,"default":1000}},{"$ref":"#/components/parameters/Include"},{"$ref":"#/components/parameters/Exclude"}],"responses":{"200":{"description":"Array of script objects.","headers":{"Link":{"description":"RFC 5988 pagination links. Includes `<...>; rel=\"next\"` when more\npages remain; absent on the final page.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Script"}}}}},"204":{"description":"No scripts exist in the account."},"401":{"$ref":"#/components/responses/401-unauthorized"}}}}}}
```

## Create a script

> Creates a new script.

```json
{"openapi":"3.2.0","info":{"title":"Scripts","version":"1.0.0"},"tags":[{"name":"Scripts","description":"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.\n\n## Script schema\n\n{% openapi-schemas spec=\"script\" schemas=\"Script\" grouped=\"true\" %}"}],"servers":[{"url":"https://api.integrator.io","description":"Production (US / default region)"},{"url":"https://api.eu.integrator.io","description":"Production (EU region)"},{"url":"https://api.au.integrator.io","description":"Production (AU region)"},{"url":"https://api.ca.integrator.io","description":"Production (CA region)"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"Request":{"type":"object","description":"Fields for creating or updating a script.","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":100,"description":"Display name for the script."},"description":{"type":"string","maxLength":1024,"description":"Free-text explanation of what the script does."},"content":{"type":"string","description":"JavaScript source code. Optional on create — the server initializes\nomitted content to an empty string. Omitting it on update leaves the\nstored source unchanged (it is not cleared)."},"postResponseHookToProcessOnChildRecord":{"type":"boolean","default":false,"description":"When true, postResponseMap hooks run once per child record in a one-to-many mapping instead of once per parent."},"_templateId":{"type":"string","format":"objectId","description":"Optional template identifier used to generate or structure script content."}}},"Script":{"type":"object","description":"Script resource as returned by the API.","required":["_id","name","createdAt","lastModified"],"properties":{"_id":{"type":"string","format":"objectId","readOnly":true,"description":"Unique identifier for the script."},"name":{"type":"string","maxLength":100,"description":"Display name for the script."},"description":{"type":"string","maxLength":1024,"description":"Free-text explanation of what the script does."},"content":{"type":"string","description":"JavaScript source code. Only returned by a GET of one script; list,\ncreate and update responses omit it."},"postResponseHookToProcessOnChildRecord":{"type":"boolean","default":false,"description":"When true, postResponseMap hooks run once per child record in a one-to-many mapping instead of once per parent."},"debugUntil":{"type":"string","format":"date-time","readOnly":true,"description":"Debug logging is active until this timestamp. Absent or in the past\nmeans debug is off. Can only be set via PATCH — ignored on POST and PUT.\nMaximum 1 hour from the current time."},"_sourceId":{"type":"string","format":"objectId","readOnly":true,"description":"Source script this was cloned from. Present only on scripts created by cloning."},"_templateId":{"type":"string","format":"objectId","readOnly":true,"description":"The template (`templates` resource) this script was generated from. Present only on scripts created from a template; omitted otherwise."},"createdAt":{"type":"string","format":"date-time","readOnly":true,"description":"Timestamp when the script was created."},"lastModified":{"type":"string","format":"date-time","readOnly":true,"description":"Timestamp when the script was last updated."}}},"Error":{"type":"object","description":"Standard error response envelope returned by integrator.io APIs.","properties":{"errors":{"type":"array","description":"List of errors that occurred while processing the request.","items":{"type":"object","properties":{"code":{"oneOf":[{"type":"string"},{"type":"integer"}],"description":"Machine-readable error code. Usually a string like\n`invalid_ref`, `missing_required_field`, or `unauthorized`;\nmay be an **integer** when the error mirrors an upstream HTTP\nstatus (e.g. `500`) — most commonly returned by connection-ping\nand adaptor-proxy responses."},"message":{"type":"string","description":"Human-readable description of the error."},"field":{"type":"string","description":"Optional pointer to the document field that caused the error.\nUsed by structural validation errors (`missing_required_field`,\n`invalid_ref`) to indicate which field is at fault\n(e.g. `_id`, `type`, `http.baseURI`)."},"source":{"type":"string","description":"Optional origin layer for the error — e.g. `application` when\nthe error came from the remote system the adaptor called,\n`connector` when the adaptor itself rejected the request."}},"required":["message"]}}},"required":["errors"]}},"responses":{"400-bad-request":{"description":"Bad request. The server could not understand the request because of malformed syntax or invalid parameters.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401-unauthorized":{"description":"Unauthorized. The request lacks a valid bearer token, or the provided token\nfailed to authenticate.\n\nNote: the 401 response is produced by the auth middleware **before** the\nrequest reaches the endpoint handler, so it does **not** follow the\nstandard `{errors: [...]}` envelope. Instead the body is a bare\n`{message: string}` object with no `code`, no `errors` array. Callers\nhandling 401s should key off the HTTP status and the `message` string,\nnot try to destructure an `errors[]`.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Human-readable description of the auth failure. Known values:\n- `\"Unauthorized\"` — no `Authorization` header on the request.\n- `\"Bearer Authentication Failed\"` — header present but token\n  is invalid, revoked, or expired."}},"required":["message"]}}}},"422-unprocessable-entity":{"description":"Unprocessable entity. The request was well-formed but was unable to be followed due to semantic errors.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/v1/scripts":{"post":{"summary":"Create a script","description":"Creates a new script.","tags":["Scripts"],"operationId":"createScript","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Request"}}},"description":"Script object to create"},"responses":{"201":{"description":"Created script.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Script"}}}},"400":{"$ref":"#/components/responses/400-bad-request"},"401":{"$ref":"#/components/responses/401-unauthorized"},"422":{"$ref":"#/components/responses/422-unprocessable-entity"}}}}}}
```

## Get a script

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

```json
{"openapi":"3.2.0","info":{"title":"Scripts","version":"1.0.0"},"tags":[{"name":"Scripts","description":"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.\n\n## Script schema\n\n{% openapi-schemas spec=\"script\" schemas=\"Script\" grouped=\"true\" %}"}],"servers":[{"url":"https://api.integrator.io","description":"Production (US / default region)"},{"url":"https://api.eu.integrator.io","description":"Production (EU region)"},{"url":"https://api.au.integrator.io","description":"Production (AU region)"},{"url":"https://api.ca.integrator.io","description":"Production (CA region)"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"Script":{"type":"object","description":"Script resource as returned by the API.","required":["_id","name","createdAt","lastModified"],"properties":{"_id":{"type":"string","format":"objectId","readOnly":true,"description":"Unique identifier for the script."},"name":{"type":"string","maxLength":100,"description":"Display name for the script."},"description":{"type":"string","maxLength":1024,"description":"Free-text explanation of what the script does."},"content":{"type":"string","description":"JavaScript source code. Only returned by a GET of one script; list,\ncreate and update responses omit it."},"postResponseHookToProcessOnChildRecord":{"type":"boolean","default":false,"description":"When true, postResponseMap hooks run once per child record in a one-to-many mapping instead of once per parent."},"debugUntil":{"type":"string","format":"date-time","readOnly":true,"description":"Debug logging is active until this timestamp. Absent or in the past\nmeans debug is off. Can only be set via PATCH — ignored on POST and PUT.\nMaximum 1 hour from the current time."},"_sourceId":{"type":"string","format":"objectId","readOnly":true,"description":"Source script this was cloned from. Present only on scripts created by cloning."},"_templateId":{"type":"string","format":"objectId","readOnly":true,"description":"The template (`templates` resource) this script was generated from. Present only on scripts created from a template; omitted otherwise."},"createdAt":{"type":"string","format":"date-time","readOnly":true,"description":"Timestamp when the script was created."},"lastModified":{"type":"string","format":"date-time","readOnly":true,"description":"Timestamp when the script was last updated."}}},"Error":{"type":"object","description":"Standard error response envelope returned by integrator.io APIs.","properties":{"errors":{"type":"array","description":"List of errors that occurred while processing the request.","items":{"type":"object","properties":{"code":{"oneOf":[{"type":"string"},{"type":"integer"}],"description":"Machine-readable error code. Usually a string like\n`invalid_ref`, `missing_required_field`, or `unauthorized`;\nmay be an **integer** when the error mirrors an upstream HTTP\nstatus (e.g. `500`) — most commonly returned by connection-ping\nand adaptor-proxy responses."},"message":{"type":"string","description":"Human-readable description of the error."},"field":{"type":"string","description":"Optional pointer to the document field that caused the error.\nUsed by structural validation errors (`missing_required_field`,\n`invalid_ref`) to indicate which field is at fault\n(e.g. `_id`, `type`, `http.baseURI`)."},"source":{"type":"string","description":"Optional origin layer for the error — e.g. `application` when\nthe error came from the remote system the adaptor called,\n`connector` when the adaptor itself rejected the request."}},"required":["message"]}}},"required":["errors"]}},"responses":{"401-unauthorized":{"description":"Unauthorized. The request lacks a valid bearer token, or the provided token\nfailed to authenticate.\n\nNote: the 401 response is produced by the auth middleware **before** the\nrequest reaches the endpoint handler, so it does **not** follow the\nstandard `{errors: [...]}` envelope. Instead the body is a bare\n`{message: string}` object with no `code`, no `errors` array. Callers\nhandling 401s should key off the HTTP status and the `message` string,\nnot try to destructure an `errors[]`.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Human-readable description of the auth failure. Known values:\n- `\"Unauthorized\"` — no `Authorization` header on the request.\n- `\"Bearer Authentication Failed\"` — header present but token\n  is invalid, revoked, or expired."}},"required":["message"]}}}},"404-not-found":{"description":"Not found. The requested resource does not exist or is not visible to the caller.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/v1/scripts/{_id}":{"get":{"summary":"Get a script","description":"Returns a single script by ID, including the full `content` field.","tags":["Scripts"],"operationId":"getScriptById","parameters":[{"name":"_id","in":"path","description":"Script ID.","required":true,"schema":{"type":"string","format":"objectId"}}],"responses":{"200":{"description":"Script object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Script"}}}},"401":{"$ref":"#/components/responses/401-unauthorized"},"404":{"$ref":"#/components/responses/404-not-found"}}}}}}
```

## Update a script

> Replaces a script's mutable fields.

```json
{"openapi":"3.2.0","info":{"title":"Scripts","version":"1.0.0"},"tags":[{"name":"Scripts","description":"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.\n\n## Script schema\n\n{% openapi-schemas spec=\"script\" schemas=\"Script\" grouped=\"true\" %}"}],"servers":[{"url":"https://api.integrator.io","description":"Production (US / default region)"},{"url":"https://api.eu.integrator.io","description":"Production (EU region)"},{"url":"https://api.au.integrator.io","description":"Production (AU region)"},{"url":"https://api.ca.integrator.io","description":"Production (CA region)"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"Request":{"type":"object","description":"Fields for creating or updating a script.","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":100,"description":"Display name for the script."},"description":{"type":"string","maxLength":1024,"description":"Free-text explanation of what the script does."},"content":{"type":"string","description":"JavaScript source code. Optional on create — the server initializes\nomitted content to an empty string. Omitting it on update leaves the\nstored source unchanged (it is not cleared)."},"postResponseHookToProcessOnChildRecord":{"type":"boolean","default":false,"description":"When true, postResponseMap hooks run once per child record in a one-to-many mapping instead of once per parent."},"_templateId":{"type":"string","format":"objectId","description":"Optional template identifier used to generate or structure script content."}}},"Script":{"type":"object","description":"Script resource as returned by the API.","required":["_id","name","createdAt","lastModified"],"properties":{"_id":{"type":"string","format":"objectId","readOnly":true,"description":"Unique identifier for the script."},"name":{"type":"string","maxLength":100,"description":"Display name for the script."},"description":{"type":"string","maxLength":1024,"description":"Free-text explanation of what the script does."},"content":{"type":"string","description":"JavaScript source code. Only returned by a GET of one script; list,\ncreate and update responses omit it."},"postResponseHookToProcessOnChildRecord":{"type":"boolean","default":false,"description":"When true, postResponseMap hooks run once per child record in a one-to-many mapping instead of once per parent."},"debugUntil":{"type":"string","format":"date-time","readOnly":true,"description":"Debug logging is active until this timestamp. Absent or in the past\nmeans debug is off. Can only be set via PATCH — ignored on POST and PUT.\nMaximum 1 hour from the current time."},"_sourceId":{"type":"string","format":"objectId","readOnly":true,"description":"Source script this was cloned from. Present only on scripts created by cloning."},"_templateId":{"type":"string","format":"objectId","readOnly":true,"description":"The template (`templates` resource) this script was generated from. Present only on scripts created from a template; omitted otherwise."},"createdAt":{"type":"string","format":"date-time","readOnly":true,"description":"Timestamp when the script was created."},"lastModified":{"type":"string","format":"date-time","readOnly":true,"description":"Timestamp when the script was last updated."}}},"Error":{"type":"object","description":"Standard error response envelope returned by integrator.io APIs.","properties":{"errors":{"type":"array","description":"List of errors that occurred while processing the request.","items":{"type":"object","properties":{"code":{"oneOf":[{"type":"string"},{"type":"integer"}],"description":"Machine-readable error code. Usually a string like\n`invalid_ref`, `missing_required_field`, or `unauthorized`;\nmay be an **integer** when the error mirrors an upstream HTTP\nstatus (e.g. `500`) — most commonly returned by connection-ping\nand adaptor-proxy responses."},"message":{"type":"string","description":"Human-readable description of the error."},"field":{"type":"string","description":"Optional pointer to the document field that caused the error.\nUsed by structural validation errors (`missing_required_field`,\n`invalid_ref`) to indicate which field is at fault\n(e.g. `_id`, `type`, `http.baseURI`)."},"source":{"type":"string","description":"Optional origin layer for the error — e.g. `application` when\nthe error came from the remote system the adaptor called,\n`connector` when the adaptor itself rejected the request."}},"required":["message"]}}},"required":["errors"]}},"responses":{"400-bad-request":{"description":"Bad request. The server could not understand the request because of malformed syntax or invalid parameters.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401-unauthorized":{"description":"Unauthorized. The request lacks a valid bearer token, or the provided token\nfailed to authenticate.\n\nNote: the 401 response is produced by the auth middleware **before** the\nrequest reaches the endpoint handler, so it does **not** follow the\nstandard `{errors: [...]}` envelope. Instead the body is a bare\n`{message: string}` object with no `code`, no `errors` array. Callers\nhandling 401s should key off the HTTP status and the `message` string,\nnot try to destructure an `errors[]`.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Human-readable description of the auth failure. Known values:\n- `\"Unauthorized\"` — no `Authorization` header on the request.\n- `\"Bearer Authentication Failed\"` — header present but token\n  is invalid, revoked, or expired."}},"required":["message"]}}}},"404-not-found":{"description":"Not found. The requested resource does not exist or is not visible to the caller.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/v1/scripts/{_id}":{"put":{"summary":"Update a script","description":"Replaces a script's mutable fields.","tags":["Scripts"],"operationId":"updateScript","parameters":[{"name":"_id","in":"path","description":"Script ID.","required":true,"schema":{"type":"string","format":"objectId"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Request"}}}},"responses":{"200":{"description":"Updated script.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Script"}}}},"400":{"$ref":"#/components/responses/400-bad-request"},"401":{"$ref":"#/components/responses/401-unauthorized"},"404":{"$ref":"#/components/responses/404-not-found"}}}}}}
```

## Delete a script

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

```json
{"openapi":"3.2.0","info":{"title":"Scripts","version":"1.0.0"},"tags":[{"name":"Scripts","description":"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.\n\n## Script schema\n\n{% openapi-schemas spec=\"script\" schemas=\"Script\" grouped=\"true\" %}"}],"servers":[{"url":"https://api.integrator.io","description":"Production (US / default region)"},{"url":"https://api.eu.integrator.io","description":"Production (EU region)"},{"url":"https://api.au.integrator.io","description":"Production (AU region)"},{"url":"https://api.ca.integrator.io","description":"Production (CA region)"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}},"responses":{"401-unauthorized":{"description":"Unauthorized. The request lacks a valid bearer token, or the provided token\nfailed to authenticate.\n\nNote: the 401 response is produced by the auth middleware **before** the\nrequest reaches the endpoint handler, so it does **not** follow the\nstandard `{errors: [...]}` envelope. Instead the body is a bare\n`{message: string}` object with no `code`, no `errors` array. Callers\nhandling 401s should key off the HTTP status and the `message` string,\nnot try to destructure an `errors[]`.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Human-readable description of the auth failure. Known values:\n- `\"Unauthorized\"` — no `Authorization` header on the request.\n- `\"Bearer Authentication Failed\"` — header present but token\n  is invalid, revoked, or expired."}},"required":["message"]}}}},"404-not-found":{"description":"Not found. The requested resource does not exist or is not visible to the caller.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422-dependency-conflict":{"description":"The resource has dependents that must be deleted first. Each entry\nin the `errors` array names one blocking resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","description":"Standard error response envelope returned by integrator.io APIs.","properties":{"errors":{"type":"array","description":"List of errors that occurred while processing the request.","items":{"type":"object","properties":{"code":{"oneOf":[{"type":"string"},{"type":"integer"}],"description":"Machine-readable error code. Usually a string like\n`invalid_ref`, `missing_required_field`, or `unauthorized`;\nmay be an **integer** when the error mirrors an upstream HTTP\nstatus (e.g. `500`) — most commonly returned by connection-ping\nand adaptor-proxy responses."},"message":{"type":"string","description":"Human-readable description of the error."},"field":{"type":"string","description":"Optional pointer to the document field that caused the error.\nUsed by structural validation errors (`missing_required_field`,\n`invalid_ref`) to indicate which field is at fault\n(e.g. `_id`, `type`, `http.baseURI`)."},"source":{"type":"string","description":"Optional origin layer for the error — e.g. `application` when\nthe error came from the remote system the adaptor called,\n`connector` when the adaptor itself rejected the request."}},"required":["message"]}}},"required":["errors"]}}},"paths":{"/v1/scripts/{_id}":{"delete":{"summary":"Delete a script","description":"Deletes a script. Soft-deleted and retained in the recycle bin for 30 days.","tags":["Scripts"],"operationId":"deleteScript","parameters":[{"name":"_id","in":"path","description":"Script ID.","required":true,"schema":{"type":"string","format":"objectId"}}],"responses":{"204":{"description":"Script deleted."},"401":{"$ref":"#/components/responses/401-unauthorized"},"404":{"$ref":"#/components/responses/404-not-found"},"422":{"$ref":"#/components/responses/422-dependency-conflict"}}}}}}
```

## Patch a script

> 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.

```json
{"openapi":"3.2.0","info":{"title":"Scripts","version":"1.0.0"},"tags":[{"name":"Scripts","description":"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.\n\n## Script schema\n\n{% openapi-schemas spec=\"script\" schemas=\"Script\" grouped=\"true\" %}"}],"servers":[{"url":"https://api.integrator.io","description":"Production (US / default region)"},{"url":"https://api.eu.integrator.io","description":"Production (EU region)"},{"url":"https://api.au.integrator.io","description":"Production (AU region)"},{"url":"https://api.ca.integrator.io","description":"Production (CA region)"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}},"responses":{"401-unauthorized":{"description":"Unauthorized. The request lacks a valid bearer token, or the provided token\nfailed to authenticate.\n\nNote: the 401 response is produced by the auth middleware **before** the\nrequest reaches the endpoint handler, so it does **not** follow the\nstandard `{errors: [...]}` envelope. Instead the body is a bare\n`{message: string}` object with no `code`, no `errors` array. Callers\nhandling 401s should key off the HTTP status and the `message` string,\nnot try to destructure an `errors[]`.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Human-readable description of the auth failure. Known values:\n- `\"Unauthorized\"` — no `Authorization` header on the request.\n- `\"Bearer Authentication Failed\"` — header present but token\n  is invalid, revoked, or expired."}},"required":["message"]}}}},"404-not-found":{"description":"Not found. The requested resource does not exist or is not visible to the caller.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422-unprocessable-entity":{"description":"Unprocessable entity. The request was well-formed but was unable to be followed due to semantic errors.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","description":"Standard error response envelope returned by integrator.io APIs.","properties":{"errors":{"type":"array","description":"List of errors that occurred while processing the request.","items":{"type":"object","properties":{"code":{"oneOf":[{"type":"string"},{"type":"integer"}],"description":"Machine-readable error code. Usually a string like\n`invalid_ref`, `missing_required_field`, or `unauthorized`;\nmay be an **integer** when the error mirrors an upstream HTTP\nstatus (e.g. `500`) — most commonly returned by connection-ping\nand adaptor-proxy responses."},"message":{"type":"string","description":"Human-readable description of the error."},"field":{"type":"string","description":"Optional pointer to the document field that caused the error.\nUsed by structural validation errors (`missing_required_field`,\n`invalid_ref`) to indicate which field is at fault\n(e.g. `_id`, `type`, `http.baseURI`)."},"source":{"type":"string","description":"Optional origin layer for the error — e.g. `application` when\nthe error came from the remote system the adaptor called,\n`connector` when the adaptor itself rejected the request."}},"required":["message"]}}},"required":["errors"]}}},"paths":{"/v1/scripts/{_id}":{"patch":{"summary":"Patch a script","description":"Partially updates a script using JSON Patch (RFC 6902). Only\n`/debugUntil` is a supported path — all others are rejected with 422.\nSupported operations: `replace`, `add`, `remove`. The value must be an\nISO-8601 timestamp no more than 1 hour in the future.","operationId":"patchScript","tags":["Scripts"],"parameters":[{"name":"_id","in":"path","description":"Script ID.","required":true,"schema":{"type":"string","format":"objectId"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"array","minItems":1,"items":{"type":"object","required":["op","path"],"properties":{"op":{"type":"string","enum":["replace","add","remove"],"description":"The operation to perform."},"path":{"type":"string","enum":["/debugUntil"],"description":"JSON Pointer to the field to patch."},"value":{"type":"string","format":"date-time","description":"ISO-8601 timestamp. Required for `replace` and `add`, omit for `remove`."}}}}}}},"responses":{"204":{"description":"Script patched."},"401":{"$ref":"#/components/responses/401-unauthorized"},"404":{"$ref":"#/components/responses/404-not-found"},"422":{"$ref":"#/components/responses/422-unprocessable-entity"}}}}}}
```

## Get execution logs for a script

> Returns the script's execution log — the entries its \`console.\*\` calls wrote during\
> real runs of the flows, APIs and Tools whose steps use the script. \`console.log\`,\
> \`console.info\`, \`console.warn\` and \`console.error\` output is recorded on every real\
> run regardless of the parent's logging mode (a flow's log level, an API's request\
> logging, a Tool invoke without \`x-log-mode\`); \`console.debug\` output is recorded only\
> while the script's \`debugUntil\` is in the future. Entries stay readable after a debug window closes. Test runs\
> execute the script but write no entries.\
> \
> The window is read from \`time\_lte\` downward, one time slice at a time, and each\
> call returns one slice. A response with an empty \`logs\` array \*\*and\*\* a\
> \`nextPageURL\` means that slice held nothing while the rest of the window is still\
> unread — follow the cursor until a response arrives without one. Only an empty\
> \`logs\` array with no \`nextPageURL\` means the window holds no entries. To read a\
> known run in one call, set \`time\_lte\` a few seconds after the run ended and\
> \`time\_gt\` just before it started (\`time\_lte\` needs \`time\_gt\`).

```json
{"openapi":"3.2.0","info":{"title":"Scripts","version":"1.0.0"},"tags":[{"name":"Scripts","description":"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.\n\n## Script schema\n\n{% openapi-schemas spec=\"script\" schemas=\"Script\" grouped=\"true\" %}"}],"servers":[{"url":"https://api.integrator.io","description":"Production (US / default region)"},{"url":"https://api.eu.integrator.io","description":"Production (EU region)"},{"url":"https://api.au.integrator.io","description":"Production (AU region)"},{"url":"https://api.ca.integrator.io","description":"Production (CA region)"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}},"responses":{"401-unauthorized":{"description":"Unauthorized. The request lacks a valid bearer token, or the provided token\nfailed to authenticate.\n\nNote: the 401 response is produced by the auth middleware **before** the\nrequest reaches the endpoint handler, so it does **not** follow the\nstandard `{errors: [...]}` envelope. Instead the body is a bare\n`{message: string}` object with no `code`, no `errors` array. Callers\nhandling 401s should key off the HTTP status and the `message` string,\nnot try to destructure an `errors[]`.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Human-readable description of the auth failure. Known values:\n- `\"Unauthorized\"` — no `Authorization` header on the request.\n- `\"Bearer Authentication Failed\"` — header present but token\n  is invalid, revoked, or expired."}},"required":["message"]}}}},"404-not-found":{"description":"Not found. The requested resource does not exist or is not visible to the caller.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","description":"Standard error response envelope returned by integrator.io APIs.","properties":{"errors":{"type":"array","description":"List of errors that occurred while processing the request.","items":{"type":"object","properties":{"code":{"oneOf":[{"type":"string"},{"type":"integer"}],"description":"Machine-readable error code. Usually a string like\n`invalid_ref`, `missing_required_field`, or `unauthorized`;\nmay be an **integer** when the error mirrors an upstream HTTP\nstatus (e.g. `500`) — most commonly returned by connection-ping\nand adaptor-proxy responses."},"message":{"type":"string","description":"Human-readable description of the error."},"field":{"type":"string","description":"Optional pointer to the document field that caused the error.\nUsed by structural validation errors (`missing_required_field`,\n`invalid_ref`) to indicate which field is at fault\n(e.g. `_id`, `type`, `http.baseURI`)."},"source":{"type":"string","description":"Optional origin layer for the error — e.g. `application` when\nthe error came from the remote system the adaptor called,\n`connector` when the adaptor itself rejected the request."}},"required":["message"]}}},"required":["errors"]}}},"paths":{"/v1/scripts/{_id}/logs":{"get":{"summary":"Get execution logs for a script","description":"Returns the script's execution log — the entries its `console.*` calls wrote during\nreal runs of the flows, APIs and Tools whose steps use the script. `console.log`,\n`console.info`, `console.warn` and `console.error` output is recorded on every real\nrun regardless of the parent's logging mode (a flow's log level, an API's request\nlogging, a Tool invoke without `x-log-mode`); `console.debug` output is recorded only\nwhile the script's `debugUntil` is in the future. Entries stay readable after a debug window closes. Test runs\nexecute the script but write no entries.\n\nThe window is read from `time_lte` downward, one time slice at a time, and each\ncall returns one slice. A response with an empty `logs` array **and** a\n`nextPageURL` means that slice held nothing while the rest of the window is still\nunread — follow the cursor until a response arrives without one. Only an empty\n`logs` array with no `nextPageURL` means the window holds no entries. To read a\nknown run in one call, set `time_lte` a few seconds after the run ended and\n`time_gt` just before it started (`time_lte` needs `time_gt`).","tags":["Scripts"],"operationId":"getScriptLogs","parameters":[{"name":"_id","in":"path","description":"Script ID.","required":true,"schema":{"type":"string","format":"objectId"}},{"name":"time_lte","in":"query","required":false,"description":"Upper bound of the time window (inclusive), as epoch milliseconds. Defaults to now if\nomitted. Reading starts here and proceeds backward. Send it with `time_gt`: `time_lte`\nalone fails with 422 (\"Invalid or Missing Field: time_gt\").","schema":{"type":"integer","format":"int64"}},{"name":"time_gt","in":"query","required":false,"description":"Lower bound of the time window (exclusive), as epoch milliseconds.","schema":{"type":"integer","format":"int64"}},{"name":"_flowId","in":"query","required":false,"description":"Restricts entries to hooks that ran inside this parent. Despite the name it matches\nthe containing flow, API, or Tool alike — pass whichever the hook step lives in.","schema":{"type":"string","format":"objectId"}},{"name":"_resourceId","in":"query","required":false,"description":"Restricts entries to hooks that ran on this export or import step.","schema":{"type":"string","format":"objectId"}},{"name":"functionType","in":"query","required":false,"description":"Restricts entries to one hook type (for example `preMap` or `postResponseMap`).","schema":{"type":"string"}}],"responses":{"200":{"description":"One slice of the script's execution log.","content":{"application/json":{"schema":{"type":"object","properties":{"logs":{"type":"array","description":"Entries from the slice that was read, newest first. Empty when the slice held\nnothing — check `nextPageURL` before treating that as an empty window.","items":{"type":"object","properties":{"time":{"type":"string","description":"UTC timestamp when the entry was written."},"functionType":{"type":"string","description":"Hook type that produced the entry."},"_resourceId":{"type":"string","format":"objectId","description":"ID of the export or import the script was running on."},"logLevel":{"type":"string","description":"Severity of the entry, derived from the `console` method that wrote it.","enum":["INFO","WARN","ERROR","DEBUG"]},"message":{"type":"string","description":"Log message content."}}}},"nextPageURL":{"type":"string","description":"Path of the next slice to read, carrying the same filters with `time_lte` moved\nback to the slice boundary. Present whenever unread window remains — including\nwhen `logs` is empty. Absent once the window is exhausted."}}}}}},"401":{"$ref":"#/components/responses/401-unauthorized"},"404":{"$ref":"#/components/responses/404-not-found"},"422":{"description":"Invalid time window — `time_lte` without `time_gt`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Delete execution logs for a script

> Deletes every entry in the script's execution log — the same action as the script\
> page's Clear logs. Synchronous and idempotent; succeeds when the script has no\
> entries. The only way, apart from account retention, that entries leave the log.

```json
{"openapi":"3.2.0","info":{"title":"Scripts","version":"1.0.0"},"tags":[{"name":"Scripts","description":"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.\n\n## Script schema\n\n{% openapi-schemas spec=\"script\" schemas=\"Script\" grouped=\"true\" %}"}],"servers":[{"url":"https://api.integrator.io","description":"Production (US / default region)"},{"url":"https://api.eu.integrator.io","description":"Production (EU region)"},{"url":"https://api.au.integrator.io","description":"Production (AU region)"},{"url":"https://api.ca.integrator.io","description":"Production (CA region)"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}},"responses":{"401-unauthorized":{"description":"Unauthorized. The request lacks a valid bearer token, or the provided token\nfailed to authenticate.\n\nNote: the 401 response is produced by the auth middleware **before** the\nrequest reaches the endpoint handler, so it does **not** follow the\nstandard `{errors: [...]}` envelope. Instead the body is a bare\n`{message: string}` object with no `code`, no `errors` array. Callers\nhandling 401s should key off the HTTP status and the `message` string,\nnot try to destructure an `errors[]`.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Human-readable description of the auth failure. Known values:\n- `\"Unauthorized\"` — no `Authorization` header on the request.\n- `\"Bearer Authentication Failed\"` — header present but token\n  is invalid, revoked, or expired."}},"required":["message"]}}}},"404-not-found":{"description":"Not found. The requested resource does not exist or is not visible to the caller.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","description":"Standard error response envelope returned by integrator.io APIs.","properties":{"errors":{"type":"array","description":"List of errors that occurred while processing the request.","items":{"type":"object","properties":{"code":{"oneOf":[{"type":"string"},{"type":"integer"}],"description":"Machine-readable error code. Usually a string like\n`invalid_ref`, `missing_required_field`, or `unauthorized`;\nmay be an **integer** when the error mirrors an upstream HTTP\nstatus (e.g. `500`) — most commonly returned by connection-ping\nand adaptor-proxy responses."},"message":{"type":"string","description":"Human-readable description of the error."},"field":{"type":"string","description":"Optional pointer to the document field that caused the error.\nUsed by structural validation errors (`missing_required_field`,\n`invalid_ref`) to indicate which field is at fault\n(e.g. `_id`, `type`, `http.baseURI`)."},"source":{"type":"string","description":"Optional origin layer for the error — e.g. `application` when\nthe error came from the remote system the adaptor called,\n`connector` when the adaptor itself rejected the request."}},"required":["message"]}}},"required":["errors"]}}},"paths":{"/v1/scripts/{_id}/logs":{"delete":{"operationId":"deleteScriptLogs","tags":["Scripts"],"summary":"Delete execution logs for a script","description":"Deletes every entry in the script's execution log — the same action as the script\npage's Clear logs. Synchronous and idempotent; succeeds when the script has no\nentries. The only way, apart from account retention, that entries leave the log.","parameters":[{"name":"_id","in":"path","description":"Script ID.","required":true,"schema":{"type":"string","format":"objectId"}}],"responses":{"204":{"description":"Logs deleted."},"401":{"$ref":"#/components/responses/401-unauthorized"},"404":{"$ref":"#/components/responses/404-not-found"}}}}}}
```

## Get audit log for a script

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

```json
{"openapi":"3.2.0","info":{"title":"Scripts","version":"1.0.0"},"tags":[{"name":"Scripts","description":"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.\n\n## Script schema\n\n{% openapi-schemas spec=\"script\" schemas=\"Script\" grouped=\"true\" %}"}],"servers":[{"url":"https://api.integrator.io","description":"Production (US / default region)"},{"url":"https://api.eu.integrator.io","description":"Production (EU region)"},{"url":"https://api.au.integrator.io","description":"Production (AU region)"},{"url":"https://api.ca.integrator.io","description":"Production (CA region)"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}},"responses":{"400-bad-request":{"description":"Bad request. The server could not understand the request because of malformed syntax or invalid parameters.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401-unauthorized":{"description":"Unauthorized. The request lacks a valid bearer token, or the provided token\nfailed to authenticate.\n\nNote: the 401 response is produced by the auth middleware **before** the\nrequest reaches the endpoint handler, so it does **not** follow the\nstandard `{errors: [...]}` envelope. Instead the body is a bare\n`{message: string}` object with no `code`, no `errors` array. Callers\nhandling 401s should key off the HTTP status and the `message` string,\nnot try to destructure an `errors[]`.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Human-readable description of the auth failure. Known values:\n- `\"Unauthorized\"` — no `Authorization` header on the request.\n- `\"Bearer Authentication Failed\"` — header present but token\n  is invalid, revoked, or expired."}},"required":["message"]}}}},"404-not-found":{"description":"Not found. The requested resource does not exist or is not visible to the caller.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422-unprocessable-entity":{"description":"Unprocessable entity. The request was well-formed but was unable to be followed due to semantic errors.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","description":"Standard error response envelope returned by integrator.io APIs.","properties":{"errors":{"type":"array","description":"List of errors that occurred while processing the request.","items":{"type":"object","properties":{"code":{"oneOf":[{"type":"string"},{"type":"integer"}],"description":"Machine-readable error code. Usually a string like\n`invalid_ref`, `missing_required_field`, or `unauthorized`;\nmay be an **integer** when the error mirrors an upstream HTTP\nstatus (e.g. `500`) — most commonly returned by connection-ping\nand adaptor-proxy responses."},"message":{"type":"string","description":"Human-readable description of the error."},"field":{"type":"string","description":"Optional pointer to the document field that caused the error.\nUsed by structural validation errors (`missing_required_field`,\n`invalid_ref`) to indicate which field is at fault\n(e.g. `_id`, `type`, `http.baseURI`)."},"source":{"type":"string","description":"Optional origin layer for the error — e.g. `application` when\nthe error came from the remote system the adaptor called,\n`connector` when the adaptor itself rejected the request."}},"required":["message"]}}},"required":["errors"]}}},"paths":{"/v1/scripts/{_id}/audit":{"get":{"summary":"Get audit log for a script","description":"Returns the change history for a script. Each entry records a mutation\nevent with who made the change, when, and which fields were affected.","tags":["Scripts"],"operationId":"getScriptAudit","parameters":[{"name":"_id","in":"path","description":"Script ID.","required":true,"schema":{"type":"string","format":"objectId"}},{"name":"limit","in":"query","description":"Maximum number of audit entries to return per page.","required":false,"schema":{"type":"integer","minimum":1,"maximum":1000,"default":1000}},{"name":"after","in":"query","required":false,"description":"Opaque pagination cursor for the next page. Take it from the `after` value in the `Link`\nresponse header's `rel=\"next\"` URL rather than constructing it.","schema":{"type":"string"}},{"name":"from","in":"query","required":false,"description":"Only return entries at or after this timestamp.","schema":{"type":"string","format":"date-time"}},{"name":"to","in":"query","required":false,"description":"Only return entries at or before this timestamp.","schema":{"type":"string","format":"date-time"}},{"name":"action","in":"query","required":false,"description":"Filter by the change type. Maps to the `event` field on each entry.","schema":{"type":"string","enum":["create","update","delete","view","restore","purge","signin","signout","purgelogs"]}},{"name":"source","in":"query","required":false,"description":"Filter by how the change was initiated.","schema":{"type":"string","enum":["ui","api","system","connector","script","sso"]}},{"name":"_byUserId","in":"query","required":false,"description":"Filter to changes performed by a single user.","schema":{"type":"string","format":"objectId"}}],"responses":{"200":{"description":"Array of audit entries, newest first.","headers":{"Link":{"description":"RFC 5988 pagination link. Includes `<...>; rel=\"next\"` with an\n`after` cursor when more entries exist; absent on the final page.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string","format":"objectId","description":"Unique identifier for this audit entry."},"resourceType":{"type":"string","description":"Always `script` for this endpoint."},"_resourceId":{"type":"string","format":"objectId","description":"ID of the script this entry belongs to."},"event":{"type":"string","description":"Type of change that occurred.","enum":["create","update","delete","purge","restore"]},"source":{"type":"string","description":"How the change was initiated.","enum":["api","ui","system"]},"time":{"type":"string","format":"date-time","description":"When the change occurred."},"byUser":{"type":"object","description":"User who made the change.","properties":{"_id":{"type":"string","format":"objectId","description":"User ID."},"email":{"type":"string","format":"email","description":"User email address."},"name":{"type":"string","description":"User display name."}}},"fieldChanges":{"type":"array","description":"Fields that were modified.","items":{"type":"object","properties":{"fieldPath":{"type":"string","description":"Dot-notation path of the changed field."},"oldValue":{"description":"Previous value (absent on create)."},"newValue":{"description":"New value (absent on delete)."}}}},"deletedInfo":{"type":"object","description":"Metadata about the deleted resource. Present on `delete` events.","properties":{"name":{"type":"string","description":"Name of the resource at the time of deletion."}}}}}}}}},"204":{"description":"No audit entries exist for this script."},"400":{"$ref":"#/components/responses/400-bad-request"},"401":{"$ref":"#/components/responses/401-unauthorized"},"404":{"$ref":"#/components/responses/404-not-found"},"422":{"$ref":"#/components/responses/422-unprocessable-entity"}}}}}}
```

## List dependencies of a script

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

```json
{"openapi":"3.2.0","info":{"title":"Scripts","version":"1.0.0"},"tags":[{"name":"Scripts","description":"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.\n\n## Script schema\n\n{% openapi-schemas spec=\"script\" schemas=\"Script\" grouped=\"true\" %}"}],"servers":[{"url":"https://api.integrator.io","description":"Production (US / default region)"},{"url":"https://api.eu.integrator.io","description":"Production (EU region)"},{"url":"https://api.au.integrator.io","description":"Production (AU region)"},{"url":"https://api.ca.integrator.io","description":"Production (CA region)"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"DependencyResponse":{"type":"object","description":"Map of dependent-resource types to arrays of dependency entries.\nKeys are plural resource type strings (e.g. `flows`, `imports`,\n`connections`). An empty object `{}` means no dependents.\n","additionalProperties":{"type":"array","items":{"$ref":"#/components/schemas/DependencyEntry"}}},"DependencyEntry":{"type":"object","description":"A single resource that depends on the queried resource.","properties":{"id":{"type":"string","description":"Unique identifier of the dependent resource."},"name":{"type":"string","description":"Display name of the dependent resource."},"type":{"type":"string","description":"Sub-type of the dependent resource when its collection distinguishes one, such as\n`stream` for a listener export. Only present for resource types that carry a `type`."},"paths":{"type":"array","description":"Dot-notation paths within the dependent resource that reference\nthe target resource. `[*]` denotes array elements.","items":{"type":"string"}},"accessLevel":{"type":"string","description":"The caller's access level on the dependent resource."},"dependencyIds":{"type":"object","description":"Map of resource types to arrays of IDs that this dependent\nresource references on the target. Keys are singular or plural\nresource type strings; values are arrays of ID strings.","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["id","name","paths","accessLevel","dependencyIds"]}},"responses":{"401-unauthorized":{"description":"Unauthorized. The request lacks a valid bearer token, or the provided token\nfailed to authenticate.\n\nNote: the 401 response is produced by the auth middleware **before** the\nrequest reaches the endpoint handler, so it does **not** follow the\nstandard `{errors: [...]}` envelope. Instead the body is a bare\n`{message: string}` object with no `code`, no `errors` array. Callers\nhandling 401s should key off the HTTP status and the `message` string,\nnot try to destructure an `errors[]`.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Human-readable description of the auth failure. Known values:\n- `\"Unauthorized\"` — no `Authorization` header on the request.\n- `\"Bearer Authentication Failed\"` — header present but token\n  is invalid, revoked, or expired."}},"required":["message"]}}}}}},"paths":{"/v1/scripts/{_id}/dependencies":{"get":{"operationId":"listScriptDependencies","tags":["Scripts"],"summary":"List dependencies of a script","description":"Returns the set of resources that depend on the specified script.","parameters":[{"name":"_id","in":"path","required":true,"description":"Script ID.","schema":{"type":"string","format":"objectId"}}],"responses":{"200":{"description":"Dependency map. Keys are resource-type strings; values are arrays\nof dependency entries. Returns `{}` when no dependents exist.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DependencyResponse"}}}},"401":{"$ref":"#/components/responses/401-unauthorized"}}}}}}
```
