Restore a previous version of a Segment
Reinstates a previous definition. A restore is an ordinary edit whose content happens to be old: it snapshots the state it replaces in the same transaction, so nothing is lost, the restore is itself in the history, and restoring the version it created undoes it. That is why this operation is NOT classified destructive, and why a test-environment credential may call it.
It bypasses the optimistic-concurrency check by design — "whatever is there now, make it this" is not a statement about what the caller last read — and it deletes no history.
Path parameters
id string required The Segment's UUID or its org-unique key.
version integer required The version number, as returned by the versions collection. Version numbers are the handle on every kind here, including the kinds whose dashboard routes address a version by row id.
Responses
Errors follow the RFC 7807 problem format — see the error reference.
kind string required restored integer required The version number that was reinstated.
current object required The definition as it now stands, in the shape the kind's own read route returns.
version object required One row of a definition's history.
Fields of version:
version_number integer required created_at string<date-time> required When the snapshot was taken, which is when the edit that REPLACED this state was made — not when this state was authored.
actor object required Who made one edit. The label is resolved server-side — a person's name, an API key's name, an OAuth client's name — because the name lives in a different table per kind and a client can read none of them. It never carries a key, a token or a client secret; a revoked credential falls back to a short form of its id rather than rendering blank.
Fields of actor:
kind string enum required unknown is an honest value rather than an error: it is what rows predating actor recording carry, and what a write reached with no credential records.
One of: user, api_key, oauth_client, system, unknown
id string optional The users / api_keys / oauth_clients id, per kind. Absent for system and unknown.
label string required session string optional The HTTP request id of the edit — the same value on the matching audit row, so the two can be joined. It is NOT an MCP session id: the MCP transport is stateless and reads no session header.
content_hash string optional summary string required How this version differs from the one before it — +3 −1 lines for a source kind, renamed, type string→number for a schema kind. The oldest row says first recorded version.
current object optional Fields of current:
id string<uuid> required name string required key string required Org-unique slug, stable across renames.
description string required source string required The SendQL predicate that defines membership.
profile_version integer required SendQL profile version the source was compiled under.
eval_class string enum required How membership is reconciled: incremental (re-evaluated on an
attribute change), sweep (periodic full re-evaluation, for
time-relative or event predicates), or both.
One of: incremental, sweep, both
status string enum required invalid means the predicate no longer compiles (e.g. a referenced
attribute was deleted); fix the predicate with PUT /v1/segments/{id}
to re-activate.
archived is a retired segment — deactivated but preserved.
One of: active, paused, invalid, archived
member_count integer<int64> | null required Cached count of current members from the last reconcile, and null
when the segment has never been evaluated. Null is not zero: zero
means the predicate matched nobody, null means nothing has asked yet.
A newly created segment is null only until its first evaluation
completes — see evaluation.
evaluation string enum optional Present only on a write response. complete means the save evaluated
the membership before returning and member_count is that answer;
queued means the evaluation exceeded its budget or failed, a
background reconcile was enqueued, and member_count is null until it
finishes. Absent on reads.
One of: complete, queued
eval_warning string optional A standing "evaluation disrupted" warning, present when an attribute the predicate references was mutated disruptively (renamed or retyped via the management API). The segment keeps evaluating best-effort; the warning clears when the predicate is re-saved. Absent when the segment is healthy.
eval_warning_at string<date-time> optional Time the standing eval_warning was raised; absent when none.
last_evaluated_at string<date-time> optional Time of the last reconcile; absent until the first evaluation.
content_hash string optional The optimistic-concurrency token over the segment's author-editable
definition. Send it back as expected_content_hash on
PUT /v1/segments/{id} and the edit is refused (409) rather than
clobbering a concurrent one. Absent on a row that predates the
column, until its next managed write recomputes it.
warnings array<string> optional Non-blocking findings from the SendQL analyzer for the definition just saved — present only on a write response. A segment with warnings is saved, not rejected.
requires array<object> optional Everything this definition still depends on, with each dependency's state. Present on the write responses and on the detail read (the polling surface); absent on the collection read. An empty array means nothing is outstanding — see V1Requirement.
Each entry in requires:
kind string enum required The namespace key is looked up in. Branch on this; never parse detail.
One of: template, segment, list, topic, identity, channel, attribute, activity_property, asset
key string required The identifier as the definition names it — a template name, a segment id or key, a from-address. Empty for a requirement about the ABSENCE of a reference: a send with no topic at all names no topic.
status string enum required ok — resolves and is usable now.
missing — nothing in this organization answers to that key. Correct
the reference, or create the thing.
not_ready — it exists, in a state that cannot be used yet. Usually
a wait, and retrying the identical request is the move. Treating this
as missing sends you hunting for a typo that is not there.
One of: ok, missing, not_ready
detail string required The state, in the words that say which state — deploy_state=pending, member_count=null (evaluation queued). For display and logs; do not parse it.
fix string required The call that clears this requirement, as an HTTP route where there is one and as a plain instruction where there is not (a template deploy is waited for, not called). Empty on an ok entry.
created_at string<date-time> required updated_at string<date-time> required code is internal_error. The
request_id field can be quoted to SendOps support to investigate.
application/problem+json