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

scripts

JavaScript hooks that run inside flow execution — _id-addressable, versioned resources that exports, imports, and flows reference by _scriptId.

REST API: Scripts

celigo scripts <subcommand> [args] [flags]

Supports all global flags.


Subcommands

Subcommand
Purpose

list

List all scripts.

get <id>

Fetch one script.

create

Create a script from a JSON body (--file <path> or stdin).

update <id>

Full replace from a JSON body (--file <path> or stdin); destructive PUT.

set <id> key=value …

Safe field edit: GET → modify → PUT. Supports key=file://<path>.

delete <id>

Delete a script.

dependencies <id> (alias used-by)

List resources that depend on this script.

enable-debug <id>

Turn on debug logging (sets debugUntil).

disable-debug <id>

Turn off debug logging (clears debugUntil).

debug-logs <id>

Fetch the script's debug logs (console output captured while debug is enabled).

delete-debug-logs <id>

Delete the script's debug logs.

audit <id>

Show the script's audit trail (change history).


celigo scripts list

List every script in the account.

Signature

Flags

Only global flags. See global-flags.

Example

Corresponds to: GET /v1/scripts → Scripts API reference.


celigo scripts get

Fetch one script by ID.

Signature

Arguments

Argument
Type
Required
Description

<id>

string

Yes

Script _id.

Example

Corresponds to: GET /v1/scripts/{_id} → Scripts API reference.


celigo scripts create

Create a script from a JSON body. Read the body from a file with -f, --file (recommended), or pipe it on stdin.

Signature

Flags

Flag
Type
Default
Description

-f, --file <path>

string

Read the JSON body from a file instead of stdin (--file - also means stdin). Added in celigo-cli 2026.6.1.

Request body

A JSON object matching the POST /v1/scripts request schema (see the Scripts API reference). The script body goes in the content field, which must be a JSON-encoded string — see Gotchas.

Example

Power-user (requires jq installed on your PATH): build the body inline, JSON-encoding the script source with jq --rawfile, so you don't need a separate file.

Corresponds to: POST /v1/scripts → Scripts API reference.


celigo scripts update

Full replace of a script from a JSON body (--file <path> or stdin). Omitted fields are erased — prefer set for targeted edits.

⚠️ update replaces the entire script. Any field you omit is erased, including content. GET the current script first, or use set content=file://… to swap only the body.

Signature

Arguments

Argument
Type
Required
Description

<id>

string

Yes

Script _id.

Flags

Flag
Type
Default
Description

-f, --file <path>

string

Read the JSON body from a file instead of stdin (--file - also means stdin). Added in celigo-cli 2026.6.1.

--force

boolean

false

Submit even if the body contains masked credential values (***) copied from a GET.

Request body

A JSON object matching the PUT /v1/scripts/{_id} request schema (see the Scripts API reference). The content field must be a JSON-encoded string — see Gotchas.

Example

To swap only the script body while keeping every other field, prefer set <id> content=file://… below.

Power-user (requires jq installed on your PATH): round-trip the current resource through jq, replacing content with the JSON-encoded file.

Corresponds to: PUT /v1/scripts/{_id} → Scripts API reference.


celigo scripts set

Safe field edit: GET the current resource, apply key=value assignments, then PUT the complete object back. Values are auto-parsed as JSON (disabled=false is a boolean, debugUntil=null removes the field), with a fallback to the literal string when the value isn't valid JSON. Dot notation and array indexing are supported.

A key=file://<path> value loads that field's value from a file instead of the command line — ideal for the multi-line content of a script, which is painful to quote and escape inline. A JSON file parses to an object; anything else (including JS source) is read as a literal string. A leading ~ and paths relative to the current directory are supported. Added in celigo-cli 2026.6.1.

Signature

Arguments

Argument
Type
Required
Description

<id>

string

Yes

Script _id.

key=value (repeatable)

string

Yes

One or more assignments. Use key=file://<path> to load a value from a file.

Example

Power-user (requires jq installed on your PATH): you can JSON-encode the source inline instead of using file://. The file:// form above avoids the external jq dependency and the shell differences entirely.

Corresponds to: GET /v1/scripts/{_id} then PUT /v1/scripts/{_id} → Scripts API reference.


celigo scripts delete

Delete a script. Prompts for confirmation unless -y is passed.

⚠️ Deleting a script cannot be undone. Run dependencies first — exports, imports, and flows that reference it by _scriptId will break.

Signature

Arguments

Argument
Type
Required
Description

<id>

string

Yes

Script _id.

Flags

Flag
Type
Default
Description

-y, --yes

boolean

false

Skip the confirmation prompt.

Example

Corresponds to: DELETE /v1/scripts/{_id} → Scripts API reference.


celigo scripts dependencies

List resources that depend on this script (alias: used-by). Use it to check whether a script is safe to delete — an empty result means nothing references it.

Signature

Arguments

Argument
Type
Required
Description

<id>

string

Yes

Script _id.

Example

Corresponds to: GET /v1/scripts/{_id}/dependencies → Scripts API reference.


celigo scripts enable-debug

Enable debug logging on a script by setting debugUntil via PATCH.

Signature

Arguments

Argument
Type
Required
Description

<id>

string

Yes

Script _id.

Flags

Flag
Type
Default
Description

--duration <minutes>

integer

60

Debug window length. Max 60 minutes; larger values are clamped.

Example

Corresponds to: PATCH /v1/scripts/{_id} (JSON-Patch replace /debugUntil) → Scripts API reference.


celigo scripts disable-debug

Disable debug logging on a script by clearing debugUntil via PATCH.

Signature

Arguments

Argument
Type
Required
Description

<id>

string

Yes

Script _id.

Example

Corresponds to: PATCH /v1/scripts/{_id} (JSON-Patch remove /debugUntil) → Scripts API reference.


celigo scripts debug-logs

Fetch a script's debug logs — the console output (console.log/warn/error) captured while debug is enabled. The /v1/scripts/{_id}/logs endpoint only returns data while debugUntil is set, so run enable-debug first.

Signature

Arguments

Argument
Type
Required
Description

<id>

string

Yes

Script _id.

Flags

Flag
Type
Default
Description

--level <level>

INFO|WARN|ERROR

Filter by log level.

--limit <n>

integer

100

Max entries to return (1-1000).

--offset <n>

integer

Entries to skip.

--since <minutes>

integer

Only return logs from the last N minutes (sets time_gt).

--flow-id <id>

string

Filter logs to a specific flow.

--time-gte <iso>

ISO 8601

Return entries at or after this timestamp.

--time-lte <iso>

ISO 8601

Return entries at or before this timestamp.

These flags were renamed in celigo-cli 2026.8.1. They were --start-date and --end-date. The new names match the --*-gte / --*-lte pattern used for every date bound in the CLI.

Example

Corresponds to: GET /v1/scripts/{_id}/logs → Scripts API reference.


celigo scripts delete-debug-logs

Delete a script's debug logs (the entries shown by scripts debug-logs). Prompts for confirmation unless -y is passed.

Signature

Arguments

Argument
Type
Required
Description

<id>

string

Yes

Script _id.

Flags

Flag
Type
Default
Description

-y, --yes

boolean

false

Skip the confirmation prompt.

Example

Corresponds to: DELETE /v1/scripts/{_id}/logs → Scripts API reference.


celigo scripts audit

Get a script's audit trail (change history).

Signature

Arguments

Argument
Type
Required
Description

<id>

string

Yes

Script _id.

Example

Corresponds to: GET /v1/scripts/{_id}/audit → Scripts API reference.


Hook types

The entry-function name in your script body determines which hook point it runs at:

Entry function
When it runs

preSavePage

Before a page of records is saved to the import queue.

preMap

Before import mapping transforms records.

postMap

After mapping, before the HTTP call to the destination.

postSubmit

After the destination returns.

postResponseMap

After response mapping extracts data from the destination.

handleRequest

For Celigo APIs — handle the incoming request body.

transform

Standalone transform within Transformation 2.0.

branching

Router decision function for flow branching.

filter

Boolean return — include or exclude records.

Gotchas

  • content is freeform JavaScript — let the CLI encode it, don't hand-escape. With create/update the script source lives inside a JSON body, so pasting raw multi-line JS makes the body invalid JSON and the command fails with Invalid JSON input. before any API call — which is why script writes can look like a broken CLI when they're really a local parse error. With set content=… the value is taken literally (no JSON escaping needed), but multi-line source is still painful to quote safely on one command line. Avoid both traps: pass the file with set content=file://<path> or create/update --file <path> and the CLI handles the encoding.

  • Writing script content requires full mode. create, update, and delete are full-mode-only, and set may only touch content in full mode (operate mode limits set to fields like disabled, debugUntil, schedule; read mode blocks all writes). A rejected write reports the required mode — switch with celigo config set mode full (see config) or use a full-mode profile.

  • AFE 2.0 uses the record. prefix (record.customerId). AFE 1.0 uses bare customerId / data.customerId. New scripts should always be AFE 2.0.

  • console.log appears in the script's execution log, not your terminal — inspect it with scripts debug-logs <id>.

  • Sandboxed V8, not Node.js. No Buffer, require, fetch, or outbound network. Use sjcl for base64, dayjs for dates.

  • preSavePage is an export-only hook. Attaching it to an import silently produces no logs.

  • No scripts test subcommand. Run the script inside a flow via flows test-run.

  • flows — where scripts are referenced via _scriptId.

  • exports, imports — resources that attach scripts at specific hook points.

  • audit — per-script change history.

Last updated

Was this helpful?