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
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
<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
-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.
⚠️
updatereplaces the entire script. Any field you omit is erased, includingcontent. GET the current script first, or useset content=file://…to swap only the body.
Signature
Arguments
<id>
string
Yes
Script _id.
Flags
-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
<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
dependenciesfirst — exports, imports, and flows that reference it by_scriptIdwill break.
Signature
Arguments
<id>
string
Yes
Script _id.
Flags
-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
<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
<id>
string
Yes
Script _id.
Flags
--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
<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
<id>
string
Yes
Script _id.
Flags
--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-dateand--end-date. The new names match the--*-gte/--*-ltepattern 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
<id>
string
Yes
Script _id.
Flags
-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
<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:
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
contentis freeform JavaScript — let the CLI encode it, don't hand-escape. Withcreate/updatethe script source lives inside a JSON body, so pasting raw multi-line JS makes the body invalid JSON and the command fails withInvalid 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. Withset 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 withset content=file://<path>orcreate/update --file <path>and the CLI handles the encoding.Writing script
contentrequiresfullmode.create,update, anddeleteare full-mode-only, andsetmay only touchcontentinfullmode (operatemode limitssetto fields likedisabled,debugUntil,schedule;readmode blocks all writes). A rejected write reports the required mode — switch withceligo 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 barecustomerId/data.customerId. New scripts should always be AFE 2.0.console.logappears in the script's execution log, not your terminal — inspect it withscripts debug-logs <id>.Sandboxed V8, not Node.js. No
Buffer,require,fetch, or outbound network. Usesjclfor base64,dayjsfor dates.preSavePageis an export-only hook. Attaching it to an import silently produces no logs.No
scripts testsubcommand. Run the script inside a flow viaflows test-run.
Related
Last updated
Was this helpful?