V4 sync job reference
A version 4 sync job is a graph of named nodes: requests fetch data, transforms reshape it, and destination nodes send it to a webhook or a datastore. This page lists every node type and field the V4 runtime accepts.
Skip the reading — fast path for coding agents
truto sync-jobs create --stdin < job.json
/skill truto-operator
The job
| Field | Required | What it does |
|---|---|---|
default_runtime_version |
Yes | 4. Always send it: a job created through the API without it is a version 3 job, and its resources are read in the version 1 to 3 format. |
label |
No | A name for the job. Defaults to Untitled. |
integration_name |
No | The integration the job is for, or "" for a job any integration can use. |
resources |
Yes | The nodes, as an array. A run of a job with no nodes is refused with sync_job_no_resources. |
args_schema |
No | The arguments a run takes. See Args. |
args_validation |
No | A JSONata expression over args. Return null to accept the run, or { "message": "..." } to refuse it with 400 and that message. |
mutex_key |
No | A placeholder template, such as {{args.integrated_account_id}}. While a run with the same resolved key is still active, a new run is refused with 400 and truto_error_code: sync_job_run_not_completed. |
state_key |
No | A placeholder template that names the state store get_state and update_state use. The store belongs to the environment, not the job: runs of any job whose key resolves to the same value share it. Include something job-specific, such as tickets:{{args.integrated_account_id}}. A state node in a job without a state_key fails the run. |
delay_between_requests_ms |
No | A pause between requests. |
Args
A V4 run gets everything it needs from args: which account to read, and where to send the output. The run stores no account: its integrated_account_id is 00000000-0000-0000-0000-000000000000, so GET /sync-job-run?integrated_account_id=<id> doesn't find it. To find a V4 job's runs, list them with GET /sync-job-run?sync_job_id=<id> and read each run's args. Truto ignores a top-level integrated_account_id or webhook_id on a V4 run. A top-level datastore_id returns 400 on every runtime version: name the datastore in args instead.
Each key of args_schema describes one argument with type, an optional format and an optional required. Truto reads args_schema only for the ID formats in the table below. For those, a missing required argument refuses the run with 400, and so does a value that doesn't match its format:
format |
The value must be |
|---|---|
integrated_account_id |
An integrated account in the job's environment |
webhook_id |
A webhook in the job's environment |
super_query |
A SuperQuery region: apac or wnam |
datastore_id |
A datastore in the job's environment |
For any other argument, type, format and required are not checked: a run without start_date below still starts, and {{args.start_date}} stays in the output as literal text. To refuse such a run, check the argument in args_validation, as the example does for start_date.
If every account named by an integrated_account_id argument needs reauthentication, the run fails as soon as it starts, or partway through once a provider answers 401. See When an account needs reauthentication.
{
"args_schema": {
"integrated_account_id": { "type": "string", "format": "integrated_account_id", "required": true },
"webhook_id": { "type": "string", "format": "webhook_id" },
"start_date": { "type": "string", "format": "date", "required": true }
},
"args_validation": "$exists(args.start_date) ? null : { \"message\": \"start_date is required\" }"
}Run options
Besides sync_job_id and args, POST /sync-job-run takes these options:
| Field | What it does |
|---|---|
events_to_send |
An array of event types. Only these of sync_job_run:started, sync_job_run:record_error, sync_job_run:rate_limited, sync_job_run:completed and sync_job_run:failed go to the run's webhook destinations. Records always do. A job with no webhook destination sends every event to the environment's webhooks. |
individual_request_batch_size |
How many queued requests the run works on at once. Default 1. |
version |
The runtime version to run on. A version 2 job can run on version 3; every other job runs only on its own version. |
A schedule takes events_to_send and individual_request_batch_size too, and passes them to each run it starts. It can't set version.
Nodes
Every node has a name and a type. Names must be unique: depends_on and resources_to_persist refer to nodes by name. Every node also takes:
depends_on: the name of one parent node. Arequest,get_stateorupdate_statewithout one runs when the run starts; atransform,spooloradd_contextwithout one never runs. A request that depends on another request runs once for each record the parent returns, and sees that record atresources.<parent path>. Destinations don't needdepends_on:resources_to_persistfeeds them.run_if: a JSONata expression. The node runs only when it's truthy.
request
Calls an API for an integrated account.
| Field | What it does |
|---|---|
resource |
<unified model>/<resource>, such as ticketing/tickets, for a Unified API call. A name without a /, such as tickets, is a Proxy API resource. |
method |
list, get, or another method of the resource. |
integrated_account_id |
Required. Usually {{args.integrated_account_id}}. |
id |
The record ID for methods that take one. |
query |
An object with {{placeholders}}, or a JSONata string that returns the object. |
body |
An object or array with {{placeholders}}. A string is a template, not JSONata. |
loop_on |
A dotted path, such as resources.ticketing.tickets. The node runs once per item, and each run sees that path set to one item. |
recurse |
{ "if": "{{resources.file-storage.drive-items.has_children:bool}}", "config": { "id": ..., "query": ... } }. For each record, Truto fills if with placeholders; when it comes out true, it calls the same resource again with config merged over the request, such as for child folders. if is not JSONata. |
paginate_if |
A JSONata expression. Truto fetches the next page only while it's truthy. It sees payload and pagination (previous_total_records_size, current_page_records_size, total_records_size, next_cursor). |
delay_after_ms |
A pause after each call. The longest of this and the job's and run's delays wins. |
Later nodes read a request's records under resources, with each / in resource as a nested key: ticketing/tickets is resources.ticketing.tickets. In JSONata, quote a key with a hyphen in backticks, such as resources.`user-directory`.users.
transform
Runs config.expression, a JSONata expression over the parent's output, and passes the result on as payload.records. An empty result passes nothing. Set use_args: true when the parent isn't a request, such as a transform that builds records from args.
debug: true adds a log row as each batch enters and leaves the transform, under Logs → RapidBridge.
spool
Collects one page of its parent together with every page that page's recurse produced, then passes them on at once, such as a page of blocks with all their nested children. The parent's next page, and each loop_on iteration, is spooled separately.
add_context
Runs config.expression over its parent's output when the parent finishes, and adds the object it returns to the context of the parent's other children and everything below them. Use it to expose a value, such as a watermark, as {{last_synced_at}} or last_synced_at in JSONata.
Make the nodes that need the value depend on the same parent as the add_context node, not on the add_context node itself: nothing runs after an add_context node. In the example below, add-last-synced-at and list-tickets both depend on get-last-synced-at. If the expression fails, nothing is added, and placeholders that use it stay as literal text.
get_state, update_state
Read and write values kept under the job's resolved state_key, so one run can pick up where the last one stopped.
| Node | config |
|---|---|
get_state |
key, and default, which is stored and used the first time the key has no value. Later nodes read it at resources.<node name>.value. |
update_state |
key, and value (a placeholder template) or value_expression (JSONata). |
You can inspect a job's state on its Run State tab in the dashboard. To reset a value, write a new one with update_state, or delete it on the Run State tab (DELETE /sync-job-run-state/{key}?state_key=<resolved state key>).
Truto deletes the values under a resolved state_key once about 30 days pass with no run reading or writing them. A job that runs less often, such as a Monthly schedule across a 31-day month, finds them gone and starts again from each get_state default.
The API still accepts start events and delete_state nodes, but version 4 doesn't run them. Nodes that depend on a start event never run. A start event or delete_state node without depends_on never finishes, so the run stays Running, and with a mutex_key every later run for that key is refused with sync_job_run_not_completed. Remove these nodes, and stop such a run with Stop run.
event
config.name is complete. The get_state and update_state nodes that depend on a complete event run once the run has completed, which is where an update_state that moves the watermark belongs. Other nodes that depend on it, apart from an add_context that feeds them, don't run. See Errors for what this means when a request fails.
destination
Sends the output of the nodes named in resources_to_persist somewhere. config.id names the target, usually from args. A destination's run_if also sees payload, the records about to be sent, so $count(payload.records) > 0 skips empty batches.
destination_type |
What it does |
|---|---|
webhook |
Sends each batch to the webhook in config.id as a sync_job_run:record event. The webhook must be active and subscribe to sync_job_run:record (or all), or nothing arrives, and the run doesn't say so: it still counts the records as persisted. The run's sync_job_run:started, sync_job_run:record_error, sync_job_run:rate_limited, sync_job_run:completed and sync_job_run:failed events go to the same webhooks, under the same rule. If your endpoint refuses a batch, Truto retries it for about 10 seconds (a 400, 404 or 413 isn't retried), then drops it, and the run goes on. A batch that is a file arrives as multipart/form-data with the file in payload[records]; see Processing webhook events. A job with no webhook destination sends its run events to every webhook in the environment that subscribes to them. |
datastore |
Calls method on the datastore in config.id, with config.config as the method's input. loop_on calls it once per item at that path. See the methods each type takes. |
Placeholders and context
{{...}} placeholders and JSONata expressions read the same context:
args: the run's arguments.resources: output of earlier requests andget_statenodes.payload: in a destination, the batch being sent, so{{payload.records.0.file_name}}is the first record'sfile_name.sync_job_run: the run, such assync_job_run.started_at.toISOString()orsync_job_run.status.- Anything an
add_contextnode added. - The integrated account's context variables, such as
{{instance_url}}, and itstenant_id, in a node that names anintegrated_account_idand in the transforms below it. truto_parent_resource: the parent node, in a request that depends on another request and inrecurse.- In a transform,
resource: the request that produced the batch, with itsqueryfilled in.
mutex_key, state_key and a destination's config.id see only args.
Add a type suffix when a value must not become text: {{resources.knowledge-base.page-content.has_children:bool}} is a boolean, and {{payload.records.0.parquet:any}} keeps the value as it is, such as binary Parquet built with $jsonToParquet. Expressions can use the $ functions of @truto/truto-jsonata.
An incremental job
This job reads tickets created since the start of the last completed run and sends them to a webhook. The first run starts from args.start_date.
{
"label": "Fetch tickets with incremental sync",
"default_runtime_version": 4,
"integration_name": "",
"state_key": "tickets:{{args.integrated_account_id}}",
"mutex_key": "{{args.integrated_account_id}}",
"args_schema": {
"start_date": { "type": "string", "format": "date", "required": true },
"integrated_account_id": { "type": "string", "format": "integrated_account_id", "required": true },
"webhook_id": { "type": "string", "format": "webhook_id", "required": true }
},
"args_validation": "$exists(args.start_date) ? null : { \"message\": \"start_date is required\" }",
"resources": [
{
"type": "get_state",
"name": "get-last-synced-at",
"config": { "key": "last_synced_at", "default": "{{args.start_date}}" }
},
{
"type": "add_context",
"name": "add-last-synced-at",
"depends_on": "get-last-synced-at",
"config": { "expression": "{ 'last_synced_at': resources.`get-last-synced-at`.value }" }
},
{
"type": "request",
"name": "list-tickets",
"resource": "ticketing/tickets",
"method": "list",
"depends_on": "get-last-synced-at",
"query": { "created_at": { "gt": "{{last_synced_at}}" } },
"integrated_account_id": "{{args.integrated_account_id}}"
},
{
"name": "webhook",
"type": "destination",
"destination_type": "webhook",
"config": { "id": "{{args.webhook_id}}" },
"resources_to_persist": ["list-tickets"]
},
{ "name": "on-complete", "type": "event", "config": { "name": "complete" } },
{
"type": "update_state",
"name": "update-last-synced-at",
"depends_on": "on-complete",
"config": {
"key": "last_synced_at",
"value_expression": "sync_job_run.status = 'completed' ? sync_job_run.started_at.toISOString()"
}
}
]
}Which filters a Unified API list accepts, such as created_at with gt, depends on the integration's mapping. Check the resource's query parameters in the Unified API reference before you rely on one.
Create the job, then start a run with its args:
curl -X POST "https://api.truto.one/sync-job" \
-H "Authorization: Bearer <API token>" \
-H "Content-Type: application/json" \
-d @job.json
curl -X POST "https://api.truto.one/sync-job-run" \
-H "Authorization: Bearer <API token>" \
-H "Content-Type: application/json" \
-d '{
"sync_job_id": "<sync_job_id>",
"args": {
"integrated_account_id": "<integrated_account_id>",
"webhook_id": "<webhook_id>",
"start_date": "2026-01-01"
}
}'truto sync-jobs create --stdin < job.json
truto sync-job-runs create -b '{
"sync_job_id": "<sync_job_id>",
"args": {
"integrated_account_id": "<integrated_account_id>",
"webhook_id": "<webhook_id>",
"start_date": "2026-01-01"
}
}'Errors
A request that fails sends sync_job_run:record_error, and the run continues without that resource's later pages or the requests that depend on it. A 4xx fails at once; a 5xx or a timeout is retried 3 times first. The run still ends completed and its complete-event nodes still run, so a watermark moves past records that were never fetched. A failed transform or datastore call also only sends sync_job_run:record_error.
A 429 is different: the run shows rate_limited, sends sync_job_run:rate_limited, waits for the provider's Retry-After (60 seconds if it sends none), then fetches the page again.
V4 ignores error_handling. A run ends failed when every account in its arguments needs reauthentication (see When an account needs reauthentication), or when a get_state or update_state node's run_if or value_expression can't be evaluated. A request whose JSONata query or paginate_if can't be evaluated doesn't fail the run.
How V4 differs from versions 1 to 3
| Versions 1 to 3 | Version 4 | |
|---|---|---|
Node name and type |
Optional on requests. A node without type is a request. |
Required on every node. |
| Where output goes | The run picks one destination: webhook_id, super_query or daemon_group_key (a daemon group). |
destination nodes in the job, with targets from args. A job can write to several. |
| What gets sent | Unified API requests unless persist: false; Proxy API requests and transforms only with persist: true. |
The nodes listed in each destination's resources_to_persist. |
| Integrated account | The run's integrated_account_id. |
Each request's integrated_account_id, usually from args. One run can read several accounts. |
| Datastores | None. A run's datastore_id returns 400. Versions 2 and 3 wrote it through the MongoDB Data API, which MongoDB ended. |
Any datastore type with methods, called by name. |
| SuperQuery | super_query on the run. |
Not available. |
| Incremental sync | {{previous_run_date}}: the start of the last completed run for the job and account. |
get_state, update_state and event nodes. |
mutex_key, state_key, delay_between_requests_ms |
Ignored. | Used. |
error_handling, force, ignore_previous_run |
Used. | Ignored. |
| Response format | response_format on a request: raw, unified or normalized. |
Not a node field. Put truto_response_format: "normalized" in the request's query. |
A run uses the job's default_runtime_version, unless it sets version: a version 2 job can run on version 3, and every other job only on its own version.
Next
For the dashboard screens that create, run and inspect these jobs, see Using the Sync Jobs UI. To start a V4 run each time an account connects, use a workflow.