Synapse definition guide
A synapse definition is one YAML file that describes how Syncari talks to a vendor API: where to connect, how to sign in, how to read, write and delete records, and how the vendor's fields map to Syncari. The engine runs the file; there is no vendor code. Edit it in the Form or the YAML view; both are the same definition. Save to Arcade to make it live, or to a local file for development.
Before you start, collect from the vendor docs: base URL, auth type, rate limits, the list endpoint and its paging style, the last-modified field, write endpoints, and how the vendor reports deletes.
Two layers per entity: api holds vendor facts (endpoints, selectors, fields), syncari holds Syncari decisions (id, watermark, capabilities). Selectors are JSONPath and start with $. Unknown keys are rejected; the Problems list shows every error with its location.
File structure
Every definition has the same shape. Top-level blocks describe the connection as a whole; entities holds one block per vendor object, and each entity splits into api (facts from the vendor docs) and syncari (decisions about how Syncari uses them). Click a block to jump to its section.
formatVersion: 0 synapse: # who the connector is: name, display name, runner, direction connection: # customer settings (fields) and the base URL auth: # how to sign in (methods) and the test call requests: # headers, timeouts, rate limits for every call errors: # which errors retry, retry timing, error rules entities: # one block per vendor object, keyed by the vendor's name contacts: displayName: api: # VENDOR FACTS - what the API looks like read: # list (incremental), getById, deleted, deletes, firstCreated write: # create, update, delete, batches, merge, associations, soft delete schema: # the fields: type, path, read-only, references syncari: # SYNCARI DECISIONS - id, watermark, capabilities, enabledWhen webhooks: # optional: inbound vendor events provenance: # where the facts came from (doc links, version, date)
| Block | Required | Purpose | Form section |
|---|---|---|---|
synapse | yes | name (must match the saved name), display name, category, runner, direction | Overview |
connection | yes (baseUrl) | settings the customer fills in when connecting; the base URL can use them | Connection & auth |
auth | yes | sign-in method (first one is used), credential fields, test call | Connection & auth |
requests | no | headers and rate limits applied to every call | Requests & rate limits |
errors | no (defaults) | retry rules, message location, error rules for errors in the body | Errors & retry |
entities.<key>.api.read | for reading | how to list changed records, read one, and find deletes | entity: Read |
entities.<key>.api.write | for writing | how to create, update, delete (single or batch) | entity: Write |
entities.<key>.api.schema | yes | the fields and where they sit in the vendor record | entity: Schema |
entities.<key>.syncari | yes | id and watermark fields, capabilities, per-connection switches | entity: Syncari behavior |
webhooks | no | inbound events from the vendor | Webhooks |
provenance | no (recommended) | sources and notes; not used at run time | Overview |
How the engine uses it, in order: connect (connection + auth, test call) - read (read.list for each time window, then read.deleted) - write (write.* for records Syncari sends, guarded by capabilities and enabledWhen) - events (webhooks, between syncs). The minimal working file is one entity with read.list, schema and syncari.
Overview (synapse)
| Key | Meaning |
|---|---|
name | Definition name; must equal the name you save as. |
displayName, category, icon, helpUrl | What customers see in the catalog. |
runner | rest (the only runner today). |
direction | both (default), source or sink. A sink cannot have getByWatermark. |
disabledMessage | Shown instead of the connect button, for example "Coming soon". |
clockSkewSeconds | Seconds taken off the window end, so records still being written are read next time. Default 5. |
formatVersion | Version of the YAML format, set by the engine: always 0 today, and read-only in the form. It is not the connector's version: Arcade counts saves of each connector (v1, v2, ...) on its own. provenance: free-form sources and notes (doc links, API version, date). |
Variables and expressions
Strings can contain ${scope.name}. Scopes: config.* (connection fields), secret.* (credentials), request.watermark / watermarkEnd / pageSize / limit / id, page.cursor / offset / page, record.* (writes, getById, field values), parent.* (child entities), schema.namesUnder.<segment> (field names under a path, for vendor "properties" lists), target.id (associations), winner.id (merge), webhook.url / secret / id (webhook registration), session.token (session_login value), source.<name> (source filters, read.list only).
Expressions (enabledWhen, delete when, webhook match) are one comparison: scope.path == literal or !=. Literals: true, false, null, numbers, quoted strings. A missing value is null, so config.allowDelete == true is false when the field is not set.
Connection & auth
connection.fields are customer settings (not secret), for example a subdomain or an allow-delete switch. connection.baseUrl may use them: https://${config.subdomain}.example.com/api.
auth.methods: list every method the vendor supports. Each method is one option in Spectrum's "Authentication method" picklist, and the engine uses the method the customer picked (the first one for connections saved before a choice was recorded). Two methods that map to the same Spectrum option are rejected. The Test panel's method picker works the same way. Types:
| Type | Keys | Spectrum shows |
|---|---|---|
api_key_header | header, value | the method's fields, then Test |
api_key_query | param, value (key in the URL; redacted in logs) | fields, Test |
bearer | value | fields, Test |
basic | uses secret.userName / secret.password | fields, Test |
session_login | login (call returning a token), tokenSelector (JSONPath or header:Name), header or param, value with ${session.token}, expiresSelector / ttlSeconds; logs in again after a 401 | fields, Test |
jwt_bearer | jwt {alg RS256 or HS256, key, claims, kid}, ttlSeconds; with tokenUrl the JWT is exchanged for an access token (service accounts) | fields, Test |
oauth2_client_credentials | tokenUrl, scopes, tokenAuth form or basic | fields, Test |
oauth2_authorization_code | authorizeUrl (fixed URL), tokenUrl, scopes, authorizeParams, pkce, tokenAuth | redirect URL and Authorize (consent); the platform stores the tokens and refreshes them before they expire; the engine uses the stored token and refreshes it itself only after the vendor rejects it |
Credential field names must be AuthConfig names (accessToken, refreshToken, clientId, clientSecret, userName, password, token, ...). auth.test is the call Test connection makes; set expectStatus.
Requests & rate limits
requests.headers go on every call. rateLimit.burst {requests, perSeconds} paces calls; rateLimit.headers names the vendor's limit / remaining / reset headers so the engine slows down before a 429. Any operation can add its own rateLimit (for example a search endpoint with a lower limit).
Errors & error rules
Status lists: retriable (default 429, 5xx, timeout), nonRetriable, authExpired (401: refresh the OAuth token once, then fail). messageSelector picks the vendor message for logs. Retry backs off from minBackoffMs to maxBackoffMs; Retry-After wins.
errors.rules handle vendors that report errors in the body, including inside an HTTP 200. Each rule has status, selector or both; equals or in compare the selected value (a list matches if any item does); without them any non-empty, non-false value matches. classify: retriable, nonRetriable or authExpired. code: a Syncari error code such as DATA_NOT_FOUND (a getById then returns nothing) or TOO_MANY_REQUESTS. First match wins.
errors:
rules:
- {selector: "$.ok", equals: false} # Slack-style error in a 200
- {selector: "$.error", equals: ratelimited, classify: retriable}
- {status: 400, selector: "$.code", equals: NOT_FOUND, code: DATA_NOT_FOUND}
Reading
read.list serves incremental syncs. recordSelector points at the records. incremental.param / upperParam send the window (format rfc3339, epoch_ms, epoch_s, date or a date pattern); or put ${request.watermark} in a bodyTemplate; or use clientSide: true when the vendor cannot filter. maxResultsPerWindow + totalSelector split the window when the vendor caps results per query.
Pagination: cursor (cursorParam, nextCursorSelector; stops when empty), offset (offsetParam), page (pageParam, startPage), nextLink (nextLinkSelector in the body or nextLinkHeader such as Link; the URL is requested as-is, relative links resolve against the page they came from; a link to another scheme, host or port is refused), or none. hasMoreSelector (any type) stops when the vendor says there are no more pages. Offset and page stop on a short page. The engine sorts by watermark, drops duplicate ids across pages and honors the record limit.
Source filters (read.list.sourceParams, optional): inputs the customer fills in on the pipeline's source step in Spectrum, to limit what is read. Each has name, label, type (string, textarea, integer, boolean, picklist with options), required, default and help. Put ${source.<name>} where the value belongs in the list params or body (not the URL path or headers). An empty filter is left out of the request; an optional filter must therefore be the whole value of a param or body field. A required filter that is missing fails the read. Values are converted to the declared type (integer, boolean); a multi-select becomes a comma-separated value. Not allowed on an entity other entities read from (child entities). Two styles: declared filters (a status picklist, an owner id) or one free-form textarea where the customer writes the vendor's own syntax. When the source step is saved, Syncari reads one record of the last day with the filters, so a filter the vendor rejects blocks the save with the vendor's message; a vendor outage does not block it, and nothing is read when every filter is empty or the entity reads everything first (child entities, client-side filtering). The Test panel takes the same values as JSON.
read:
list:
path: /deals
params: {status: "${source.status}", filter_id: "${source.savedFilter}"}
sourceParams:
- {name: status, label: Status, type: picklist, options: [open, won, lost]}
- {name: savedFilter, label: Saved filter id, help: "Pipedrive filter id"}
read.getById reads one record (${request.id}). list.parent.entity makes a child entity: the list runs once per parent record with ${parent.field}; one level only.
read.firstCreated finds the oldest record so the first sync starts there: an operation (for example sorted by created date, limit 1), an optional recordSelector, and valueSelector for the created time. Without it the first sync starts at 1970.
Deletes
Pick the style the vendor offers, per entity:
| Vendor offers | Declare |
|---|---|
| A true/false field on the normal read (is_deleted, archived) | syncari.deletedFlag: is_deleted |
| A status or other value (status = deleted, active = false) | read.deletes.when: ["record.status == 'deleted'"] (on the vendor record; any match) |
| An endpoint listing deleted records | read.deleted: same keys as list; runs after each read with the same window; idSelector if the id is not the id field |
| Ids merged into a surviving record | read.deletes.mergedIds: {selector, separator} |
| Delete webhooks | a webhooks event with op: delete |
| Nothing | read.deletes.detect: [none]: the entity does not capture deletes |
detect lists the styles in use and is checked against what is declared. Deleted records are disconnected from their Syncari record; a Syncari record counts as deleted when every source has deleted it.
Writing
Every operation can add headers (on top of the global ones) and bodyFormat: form (form-encoded, nested keys as a[b]=c). Methods: GET, POST, PUT, PATCH, DELETE, MERGE.
write.create / update / delete: body: record sends all writable fields, changedFields only the changed ones (create-only fields left out); idSelector reads the new id. Only declared, writable fields are sent, placed at their path.
Batches (createBatch, updateBatch, deleteBatch): items wrapped as {itemsKey: [...]}, itemTemplate adds keys per item, resultsSelector / resultIdSelector match results to records (by position for create, by id otherwise, or by correlationKey). A rejected batch is retried one by one, except a create answered 2xx with an error (it may be partly created). syncari.maxCrudBatch caps the batch size.
merge: vendor merge per loser into the winner (${winner.id}), then the winner is updated; without it, merge = update the winner and delete the losers. associations: link fields written after the record (mode add or sync).
Deletes: a delete answered 404 or 410 counts as done (alreadyDeletedStatuses; [] turns it off). With writePolicy.deleteMode: soft and write.softDelete.set, a delete is sent as an update of those values instead (never batched). deleteMode: unsupported refuses deletes.
Schema
source: static lists fields in the file; describe also reads fields from a vendor endpoint (name, label, type, readOnly, picklist selectors, typeMap, fieldPath with ${field.name}). Field keys: type (string, text, integer, long, number, double, boolean, datetime, date, object, picklist, email, url, phone, or array<type>), id, watermark, createdAt, readOnly, createOnly, required, reference, picklist, path (JSONPath in the vendor record; writes use the same simple path), value (computed read-only), multiValueSeparator. Id, watermark, created-at and deleted-flag fields must be declared statically.
Syncari behavior
entity (Syncari entity name), idField, watermarkField, createdAtField, idTemplate (composite id), watermarkFormat. capabilities: getByWatermark, getById, create, update, delete (each needs its operation). enabledWhen switches a capability per connection, for example delete: "config.allowDelete == true". lookBehindSeconds re-reads a little before the watermark. writePolicy.matchKeys is informational. An entity without create or update is read-only.
Webhooks
The vendor calls POST https://<spectrum host>/arcade/api/v1/webhooks/<synapse name> (registration builds this URL as ${webhook.url}). Only definitions with a webhooks block accept calls. verify: none is only allowed when every event is changed, because delete and record events trust the payload.
identifier.config: the connection field that identifies the vendor account;identifier.selector: where the same value is in the payload. Without a selector the URL carries?instanceId=<value>.verify:hmac(signature of the raw body inheader; algorithm, hex or base64, optional prefix such as "sha256="),token(header equals the secret) ornone. The secret is a config or secret variable, or${webhook.secret}when the synapse registers the subscription.itemsSelector: the events in one call (a list body is split automatically).events: first matching rule wins.op: delete(idSelector),changed(re-read the record by id; needs getById),record(the payload holds the record; recordSelector). Optional timestampSelector / timestampFormat.register(optional):createruns when a connection is saved and has no subscription yet (variables${webhook.url},${webhook.secret}; idSelector = subscription id). If it cannot run yet (empty identifier, no token, vendor error) the save still goes through and the next save retries.deleteruns when the connection is removed (${webhook.id}); a failure there is logged and does not block the delete. secretSelector when the vendor returns its own secret. Changing the identifier later does not move an existing subscription.
webhooks: # example vendor that signs the raw body with HMAC-SHA256
identifier: {config: accountId, selector: "$[0].accountId"}
verify: {type: hmac, header: X-Signature, prefix: "sha256=", secret: "${webhook.secret}"}
events:
- {match: "event.type == 'contact.deleted'", entity: contacts, op: delete, idSelector: $.objectId}
- {match: "event.type == 'contact.updated'", entity: contacts, op: changed, idSelector: $.objectId}
register:
create: {method: POST, path: /webhooks, bodyTemplate: {url: "${webhook.url}", secret: "${webhook.secret}"}, idSelector: $.id}
delete: {method: DELETE, path: "/webhooks/${webhook.id}"}
Check how the vendor signs: some sign more than the body (URL, timestamp) and cannot be checked with plain hmac yet.
Validate & test
Validate runs every check and lists problems with their location; click one to jump to the field. The Test panel runs the definition in the editor (unsaved changes included) against the real API: Test connection, then Read first page per entity, with the authentication method picked in the panel and optional source filters (JSON). Credentials stay in the page until reload. Always check by hand: the watermark field, the paging stop, delete behavior and rate limits.
Saving, status and versions
Arcade stores the YAML text; the Form is only an editor. Saving from the YAML tab keeps the text as written (comments included); saving from the Form writes the canonical layout. Every save to Arcade becomes a new version (v1, v2, ...) with who saved it, when, and the optional Change note. The Versions panel lists them: View, Compare with editor (line diff), and Load into editor - saving it then creates the next version, marked as restored. Two people cannot overwrite each other: a save based on an older version is refused. Status: Draft (not in Spectrum; the only status that can be deleted), Active (in Spectrum; changes go live within about 15 seconds, no rebuild), Inactive (hidden from Spectrum, existing synapses keep running). formatVersion is the version of the YAML format itself (0), not of the connector, and is read-only in the Form.
Not supported yet
Search for the pipeline's "Look up external record" (not planned for factory definitions; use source filters to limit reads), full-set delete comparison (planned later), OData, GraphQL and SOAP runners (kept off for now), entities discovered at runtime (custom objects), file downloads, instance URL from the OAuth token, an OAuth authorize URL that depends on a connection setting, OAuth 1.0a, AWS SigV4, request signing other than JWT, account timezone, named custom extensions. Databases, file storage and Kafka use the existing synapses.
For AI agents: drafting a definition
Give this to an AI agent (as a prompt, a skill or a file) together with the vendor's API docs or OpenAPI spec. It is self-contained: output contract, procedure, mapping tables from vendor docs to keys, the full key reference, a self-check, what to hand back to a person, and a starter template that passes the validator. Paste the agent's YAML into the YAML tab and click Validate.
# Syncari synapse definition - instructions for an AI agent
You are drafting a Syncari synapse definition: one YAML file that lets the Syncari factory engine read and write a vendor's REST API. The engine runs the file; you never write code. Follow these instructions exactly. When a fact is not in the vendor documentation, leave it out and list it under "Open questions" - never guess.
## 0. File structure at a glance
```
formatVersion: 0
synapse: # name, displayName, category, runner: rest, direction
connection: # customer settings (fields) and baseUrl
auth: # methods (first is used) and test call
requests: # headers, timeouts, rateLimit for every call
errors: # retry lists, retry timing, messageSelector, rules
entities: # one block per vendor object, keyed by the vendor's name
<key>:
api: # VENDOR FACTS
read: # list (incremental), getById, deleted, deletes, firstCreated
write: # create, update, delete, batches, merge, associations, softDelete
schema: # fields: type, path, readOnly, reference
syncari: # SYNCARI DECISIONS: idField, watermarkField, capabilities, enabledWhen
webhooks: # optional inbound events
provenance: # doc links, API version, date
```
Required: synapse, connection.baseUrl, auth (methods + test), and per entity api.schema and syncari (idField, watermarkField). Everything else is optional. The smallest useful file is one entity with read.list, schema and syncari.
## 1. Output contract
- Output exactly one YAML document, then a short "Open questions" list and a "Verification notes" list.
- `formatVersion: 0` and `synapse.runner: rest`. Only REST/JSON APIs are supported today (no SOAP, OData, GraphQL, bulk export, databases, files). Form-encoded request bodies are fine (bodyFormat: form).
- Use only the keys in section 5. Unknown keys are rejected by the validator.
- No secrets, tokens, real account ids or customer data. Credentials are referenced as `${secret.<name>}` only.
- JSONPath selectors start with `$`. Writable fields use simple dotted paths (`$.properties.email`).
- Fill `provenance` with the doc URLs you used, the API version and the date.
- ASCII only, plain quotes.
## 2. Inputs to collect from the vendor docs (in this order)
1. Base URL and API version; whether the host depends on the customer (subdomain, region, instance URL).
2. Auth: header API key, bearer token, basic, OAuth 2 authorization code (with refresh) or client credentials. If the docs have an OpenAPI `securitySchemes`, map it with the table in section 4.
3. Rate limits: requests per second or minute, and the rate-limit response headers.
4. Error format: where the message is; whether errors can come back with HTTP 200.
5. For each entity (object) to sync:
- list endpoint, sort order, filter on last-modified time (param names and date format);
- paging style and page-size limit;
- get-by-id endpoint;
- create, update and delete endpoints, and batch endpoints if any;
- how deletes are visible (see section 4, deletes);
- the fields: name, type, read-only, required, picklist values, references to other entities;
- the last-modified field and the created field.
6. Webhooks, only if the vendor has them and signs them with an HMAC of the raw body or a shared token.
## 3. Procedure
1. Write `synapse`, `connection` (customer settings, not secret) and `auth` (with `auth.test`: a cheap GET that needs auth, `expectStatus: 200`).
2. Add `requests.rateLimit` from the documented limits (be conservative: a little under the limit).
3. Add `errors.messageSelector`. Add `errors.rules` only for documented error bodies (especially errors inside HTTP 200).
4. For each entity, write `api.read.list` first, then `getById`, then writes, then `schema`, then `syncari`.
5. Choose capabilities. Include a capability only when its operation exists (getByWatermark -> read.list, getById -> read.getById, create/update/delete -> write.*). Guard writes with `enabledWhen` on connection switches (`allowWriteBack`, `allowDelete`, default false).
6. Declare deletes (section 4). If the vendor exposes none, write `read.deletes.detect: [none]`.
7. Self-check against section 6, then output.
## 4. Mapping tables
Auth (OpenAPI securitySchemes -> auth.methods[].type):
| Vendor / OpenAPI | type | keys |
|---|---|---|
| apiKey in header | api_key_header | header, value: "${secret.accessToken}" |
| http bearer | bearer | value: "${secret.accessToken}" |
| http basic | basic | uses ${secret.userName} / ${secret.password} |
| oauth2 authorizationCode | oauth2_authorization_code | authorizeUrl (fixed URL), tokenUrl, scopes; pkce, authorizeParams if the vendor needs them |
| oauth2 clientCredentials | oauth2_client_credentials | tokenUrl, scopes |
| apiKey in query | api_key_query | param, value |
| login call returns a session token | session_login | login, tokenSelector, header or param, value: "... ${session.token}" |
| signed JWT (service account, app key) | jwt_bearer | jwt {alg, key, claims}; tokenUrl to exchange it |
| OAuth 1.0a, AWS SigV4, other request signing | not supported | say so in Open questions |
If the vendor accepts the key in a header and in the URL, prefer the header (api_key_header): URLs end up in logs.
List every method the vendor supports; the customer picks one when connecting. At most one method per row group: api_key_header / api_key_query count as one option, basic / session_login as one.
Credential field names must be one of: userName, password, token, accessToken, refreshToken, clientId, clientSecret, tokenId, tokenSecret, consumerKey, consumerSecret.
Paging (read.list.pagination):
| Docs say | type | keys |
|---|---|---|
| response has a next cursor / token | cursor | cursorParam, nextCursorSelector (stops when empty) |
| offset / skip + limit | offset | offsetParam, pageSizeParam, pageSize |
| page number | page | pageParam, startPage, pageSizeParam, pageSize |
| one response, no paging | none | |
| response has the next page URL (body field, Link header) | nextLink | nextLinkSelector or nextLinkHeader: Link |
| response says whether more pages exist | any type plus hasMoreSelector | e.g. $.has_more |
Set `pageSize` to the documented maximum (or a safe value).
Incremental reads (read.list.incremental):
- Filter params for the window: `param` (start) and `upperParam` (end); `format`: rfc3339, epoch_ms, epoch_s, date, or a Java date pattern.
- If the filter goes in a JSON body (search endpoints), use `bodyTemplate` with `${request.watermark}` / `${request.watermarkEnd}` and `${page.cursor}`.
- If the vendor cannot filter by modified time: `clientSide: true` (reads everything; small entities only).
- If a query returns at most N results: `maxResultsPerWindow: N` and `totalSelector`.
- Prefer ascending sort by the last-modified field.
Deletes (choose all that apply):
| Vendor behavior | Declare |
|---|---|
| boolean field on normal reads (is_deleted, archived) | syncari.deletedFlag: <field> (declare it in schema), detect: [flag] |
| status value (status = deleted, active = false) | read.deletes.when: ["record.status == 'deleted'"], detect: [flag] |
| endpoint listing deleted records | read.deleted (same keys as list), detect: [endpoint] |
| merged records list the ids merged away | read.deletes.mergedIds: {selector, separator}, detect: [mergedIds] |
| webhook delete events | webhooks event with op: delete, detect: [webhook] |
| nothing | read.deletes.detect: [none] |
Write side: DELETE answered 404/410 already counts as done. If the vendor's delete is reversible (trash, archive): writePolicy.deleteMode: soft. If deleting must be done by updating a field: also write.softDelete.set and a write.update.
Field types: string, text, integer, long, number, double, boolean, datetime, date, object, picklist, email, url, phone, or array<type>. Use readOnly for server-set fields, createOnly for fields only accepted on create, reference: <entity key> for ids of other entities, picklist for fixed value lists.
## 5. Key reference (everything the validator accepts)
```yaml
formatVersion: 0
synapse: {name, displayName, category, runner: rest, helpUrl, icon, direction: both|source|sink, disabledMessage, clockSkewSeconds}
connection:
fields: [{name, label, type, required, default, help}] # customer settings, never secret
baseUrl: "https://${config.subdomain}.vendor.example/api"
auth:
methods: [{type, label, header, value, param, tokenUrl, authorizeUrl, scopes, tokenAuth: form|basic, authorizeParams, pkce,
login, tokenSelector, expiresSelector, ttlSeconds, jwt: {alg, key, claims, kid},
fields: [{name, label, type: password, required, secret: true}]}]
test: {method, path, params, expectStatus}
requests: {headers, timeouts: {connectMs, readMs}, rateLimit: {burst: {requests, perSeconds}, headers: {limit, remaining, reset}, backoffOn}}
errors:
retriable: [429, 500, 502, 503, 504, timeout]
nonRetriable: [400, 401, 403, 404, 413, 422]
authExpired: [401]
messageSelector: "$.message"
retry: {minBackoffMs, maxBackoffMs, maxRetries, jitter}
rules: [{status, selector, equals | in, classify: retriable|nonRetriable|authExpired, code, messageSelector}]
entities:
<key>: # the vendor's object name, e.g. contacts
displayName:
api:
read:
list: {method, path, params, bodyTemplate, recordSelector, rateLimit,
incremental: {param, upperParam, format, clientSide, maxResultsPerWindow, totalSelector},
pagination: {type: cursor|offset|page|nextLink|none, cursorParam, nextCursorSelector, offsetParam, pageParam, startPage, pageSizeParam, pageSize, nextLinkSelector, nextLinkHeader, hasMoreSelector},
parent: {entity}, # child entity: once per parent record, ${parent.<field>}
sourceParams: [{name, label, type: string|textarea|integer|boolean|picklist, required, options, default, help}]} # ${source.<name>}
getById: {path: "/things/${request.id}", recordSelector}
deleted: {...same keys as list..., idSelector}
deletes: {detect: [flag|endpoint|mergedIds|webhook|none], when: ["record.<path> == <literal>"], mergedIds: {selector, separator}}
firstCreated: {path, params, recordSelector, valueSelector, format} # oldest record, start of the first sync
write:
create: {method: POST, path, body: record, idSelector, headers: {...}, bodyFormat: json|form}
update: {method: PATCH, path: "/things/${record.id}", body: changedFields}
delete: {method: DELETE, path: "/things/${record.id}"}
createBatch | updateBatch | deleteBatch: {method, path, body, maxSize, itemsKey, itemTemplate, resultsSelector, resultIdSelector, correlationKey, resultCorrelationSelector}
merge: {method, path, bodyTemplate: {winner: "${winner.id}", loser: "${record.id}"}, idSelector}
associations: [{field, mode: add|sync, add: {...}, remove: {...}, current: {path, recordSelector, idSelector, pagination}}]
alreadyDeletedStatuses: [404, 410]
softDelete: {set: {archived: true}}
schema:
source: static | describe
describe: {path, recordSelector, name, label, type, readOnly, picklist, fieldPath: "$.properties.${field.name}", typeMap: {}}
fields: [{name, displayName, type, id, watermark, createdAt, readOnly, createOnly, required, reference, picklist, path, value, multiValueSeparator}]
syncari:
entity: Contact # Syncari entity name, when one fits
idField, watermarkField, createdAtField, deletedFlag, idTemplate, watermarkFormat
capabilities: [getByWatermark, getById, create, update, delete]
enabledWhen: {create: "config.allowWriteBack == true"}
writePolicy: {matchKeys: [email], deleteMode: hard|soft|unsupported}
maxCrudBatch, lookBehindSeconds
webhooks:
identifier: {config: <connection field>, selector}
verify: {type: none|hmac|token, header, algorithm, encoding: hex|base64, prefix, secret}
itemsSelector:
events: [{match: "event.<path> == <literal>", entity, op: delete|changed|record, idSelector, recordSelector, timestampSelector, timestampFormat}]
register: {create: {..., idSelector}, delete: {...}, secretSelector}
provenance: {sources: [...], apiVersion, retrieved, notes}
```
Source filters: only when the vendor's list endpoint documents filters worth exposing (status, owner, saved filter). An optional filter must be the whole value of a param or body field.
Variables `${scope.name}`: source.<name> (read.list), session.token (session_login value), config.*, secret.*, request.watermark / watermarkEnd / pageSize / limit / id, page.cursor / offset / page, record.* (writes, getById, field value, idTemplate), parent.* (child entities), schema.namesUnder.<segment> (reads), target.id (associations), winner.id (merge), field.name (describe.fieldPath), webhook.url / secret / id (webhooks). Expressions: `scope.path == literal` or `!=`; literals true, false, null, numbers, quoted strings.
## 6. Self-check before you output
- [ ] Every `${config.x}` is a connection field; every `${secret.x}` is an allowed credential name.
- [ ] Every capability has its operation; writes and deletes are guarded by enabledWhen switches that default to false.
- [ ] idField, watermarkField, createdAtField and deletedFlag fields are declared in schema.fields.
- [ ] The watermark field really changes on every update (not only on create).
- [ ] Paging stops: cursor selector points at an empty / missing value on the last page, or offset/page sizes match the vendor maximum.
- [ ] Read-only and server-set fields are readOnly; writable fields with a path use a simple dotted path.
- [ ] A delete style is declared, or detect: [none].
- [ ] No secrets, real ids or customer data; provenance filled in.
## 7. Hand back to a human
List under "Open questions" anything you could not confirm, at least: rate limits not in the docs, whether the modified-time filter is inclusive, delete behavior, fields whose write format is unclear, and any unsupported feature (section 4). The human pastes the YAML into the Synapse Builder (YAML tab), clicks Validate, fixes the listed problems, then uses the Test panel (Test connection, Read first page) with a sandbox account before saving.
## 8. Starter template (passes the validator; replace every acme value)
```yaml
formatVersion: 0
synapse:
name: acme
displayName: Acme CRM
category: CRM
runner: rest
helpUrl: https://developer.acme.example/docs
connection:
fields:
- {name: subdomain, label: Subdomain, required: true, help: "The part before .acme.example"}
- {name: allowWriteBack, label: Allow write back, type: boolean, default: false}
- {name: allowDelete, label: Allow delete, type: boolean, default: false}
baseUrl: "https://${config.subdomain}.acme.example/api/v2"
auth:
methods:
- type: api_key_header
label: API token
header: X-Api-Token
value: "${secret.accessToken}"
fields:
- {name: accessToken, label: API token, type: password, required: true, secret: true}
test: {method: GET, path: /contacts, params: {limit: 1}, expectStatus: 200}
requests:
headers: {Accept: application/json}
rateLimit:
burst: {requests: 10, perSeconds: 1}
headers: {limit: X-RateLimit-Limit, remaining: X-RateLimit-Remaining, reset: X-RateLimit-Reset}
errors:
messageSelector: "$.error.message"
rules:
- {selector: "$.error.code", equals: RATE_LIMITED, classify: retriable, code: TOO_MANY_REQUESTS}
entities:
contacts:
displayName: Contacts
api:
read:
list:
path: /contacts
params: {sort: updated_at}
incremental: {param: updated_since, upperParam: updated_until, format: rfc3339}
recordSelector: "$.data[*]"
pagination: {type: cursor, cursorParam: cursor, nextCursorSelector: "$.meta.next_cursor", pageSizeParam: limit, pageSize: 100}
getById: {path: "/contacts/${request.id}", recordSelector: "$.data"}
deletes:
detect: [flag]
write:
create: {method: POST, path: /contacts, body: record, idSelector: "$.data.id"}
update: {method: PATCH, path: "/contacts/${record.id}", body: changedFields}
delete: {method: DELETE, path: "/contacts/${record.id}"}
schema:
source: static
fields:
- {name: id, type: string, id: true, readOnly: true}
- {name: email, type: email}
- {name: first_name, type: string}
- {name: last_name, type: string}
- {name: company_id, type: string, reference: companies}
- {name: created_at, type: datetime, createdAt: true, readOnly: true}
- {name: updated_at, type: datetime, watermark: true, readOnly: true}
- {name: deleted, type: boolean, readOnly: true}
syncari:
entity: Contact
idField: id
watermarkField: updated_at
createdAtField: created_at
deletedFlag: deleted
capabilities: [getByWatermark, getById, create, update, delete]
enabledWhen:
create: "config.allowWriteBack == true"
update: "config.allowWriteBack == true"
delete: "config.allowDelete == true"
lookBehindSeconds: 300
provenance:
sources:
- "https://developer.acme.example/docs/contacts (list, get, create, update, delete; read 2026-11-23)"
notes: "Example only. Acme is not a real vendor."
```