Volanea Segments API
Dynamic (condition-driven) and static audiences.
Dynamic (condition-driven) and static audiences.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/volanea-com:volanea-com-segments-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Volanea Segments API
version: 0.1.0
description: 'The open email platform: transactional sending, marketing campaigns, and lifecycle automation over one contact graph.
**Authentication** — pass an API key as `Authorization: Bearer `. Three key types exist per project:
`sk_…` (secret, full access — server-side only), `sk_test_…` (test — full access, renders and logs but never delivers),
and `pk_…` (public — only accepted by `POST /v1/events`, safe to ship in client code).
**Response envelope** — every 2xx body is `{ "success": true, "data": … }`. The schema shown for each operation below
describes what goes in `data`, not the whole body. Cursor-paginated lists put the array in `data` and `nextCursor`
beside it: `{ "success": true, "data": [...], "nextCursor": "1730000000000.6a6dd07e6afeb87b46b08bca" }`.
`nextCursor` is an opaque string — send it back as `cursor` unchanged, and never parse or synthesise one.
**Errors** — every error is `{ "success": false, "error": "", "code": "" }` with an
appropriate HTTP status. Branch on `code`, never on the wording of `error`. Validation failures (422) add a `details`
array naming each failing field by its dotted path.
**Unknown request-body fields are rejected** — a body carrying a field this spec does not declare is a 422
`validation_error`, with one `details` entry per unknown key (`code: "unrecognized_keys"`, `path` naming the key).
Until 2026-08 they were silently dropped, which is how `reply_to` for `replyTo`, a `cc` carried over from another
provider, and a misspelled segment `operator` all shipped to production looking like they had worked: the request
answered 200 and the behaviour the field was meant to buy simply never happened. Sending an unknown field now costs
you a failed request instead of a silent one. Query strings are the exception and stay permissive — a URL routinely
carries analytics and cache-busting params that have nothing to do with the endpoint.
**Idempotency** — `POST /v1/send` and `POST /v1/send/batch` accept an `Idempotency-Key` header. A repeated key with the
same body replays the stored response, marked BOTH by the `X-Idempotent-Replay: true` response header and by
`"replay": true` inside `data`. Read either; they are set together. (The header was promised here for years and never
actually sent, so callers wrote against the body field — both are now part of the contract and neither will be
removed.) A repeated key with a *different* body is a 409 `idempotency_key_reused` — the request is neither sent nor
replayed, because silently returning the first response would discard the new message.
**Template variables** — `{{name}}` placeholders are substituted in subjects, bodies, and preheaders wherever this
spec says so. A placeholder may carry a fallback: `{{firstName | "there"}}` renders `there` when `firstName` is
missing, null, or the empty string. The quotes are required and must be double quotes. Without a fallback a missing
variable renders as nothing at all, which is how "Hi ," reaches inboxes. Dotted paths (`{{data.plan}}`) resolve
into the contact''s custom `data`; per-call `variables` win over contact fields of the same name.
**Pagination** — list endpoints return `{ data, nextCursor }`; pass `nextCursor` back as `cursor` until it is `null`.'
servers:
- url: https://api.volanea.com
description: Production
- url: http://localhost:4100
description: Local development
security:
- bearerAuth: []
tags:
- name: Segments
description: Dynamic (condition-driven) and static audiences.
paths:
/v1/segments:
get:
tags:
- Segments
operationId: listSegments
summary: List segments
description: 'Every segment in the project — dynamic and static — with its conditions and cached `memberCount`.
Unpaginated. The count is as of the last refresh, not live: a dynamic segment whose contacts changed since then reports a stale number until `POST /v1/segments/{id}/refresh` recomputes it.'
responses:
'200':
description: All segments.
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Segment'
required:
- data
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
post:
tags:
- Segments
operationId: createSegment
summary: Create a segment
description: 'Dynamic segments require `conditions` and are computed immediately; static segments start empty and are managed via the members endpoints.
Pass `dryRun: true` to preview instead of create — identical to `POST /v1/segments/preview`, and `name` is not required. The alias exists because the MCP `create_segment` tool takes `dryRun` and tells agents to run one first: until this was honoured, carrying that parameter into the REST call created a live segment on every "preview", and deleting it afterwards did not undo the `segment.entered` activity it had already written onto contacts.'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
maxLength: 120
description: Required unless `dryRun` is true.
description:
type: string
maxLength: 500
type:
type: string
enum:
- dynamic
- static
default: dynamic
conditions:
$ref: '#/components/schemas/SegmentConditions'
dryRun:
type: boolean
description: Preview only — nothing is created. Returns the same shape as `POST /v1/segments/preview`.
responses:
'200':
description: Preview, when `dryRun` is true.
content:
application/json:
schema:
type: object
properties:
dryRun:
type: boolean
enum:
- true
segmentId:
type: 'null'
description: Always null — a dry run creates nothing.
count:
type: integer
sample:
type: array
items:
$ref: '#/components/schemas/Contact'
required:
- dryRun
- count
'201':
description: Created.
content:
application/json:
schema:
$ref: '#/components/schemas/Segment'
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Not included in this project's plan (code `plan_limit`); `details.requiredPlan` names the cheapest plan that includes it.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: Request validation failed (code `validation_error`, 422).
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/v1/segments/preview:
post:
tags:
- Segments
operationId: previewSegment
summary: Preview conditions
description: Live member-count preview for a condition tree (used while building a segment). Returns the count and a small sample of matching contacts.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
conditions:
$ref: '#/components/schemas/SegmentConditions'
required:
- conditions
responses:
'200':
description: Match count and sample.
content:
application/json:
schema:
type: object
properties:
count:
type: integer
sample:
type: array
items:
$ref: '#/components/schemas/Contact'
required:
- count
- sample
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: Request validation failed (code `validation_error`, 422).
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/v1/segments/{id}:
get:
tags:
- Segments
operationId: getSegment
summary: Get a segment
description: 'One segment: its type, its condition tree if dynamic, and its cached member count.
The count is from the last refresh rather than computed on read. For the actual contacts, use `GET /v1/segments/{id}/members`.'
parameters:
- name: id
in: path
required: true
description: Segment id.
schema:
type: string
responses:
'200':
description: The segment.
content:
application/json:
schema:
$ref: '#/components/schemas/Segment'
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: Request validation failed (code `validation_error`, 422).
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
patch:
tags:
- Segments
operationId: updateSegment
summary: Update a segment
description: Changing `conditions` recomputes membership immediately. Static segments reject `conditions`.
parameters:
- name: id
in: path
required: true
description: Segment id.
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
maxLength: 120
description:
type:
- string
- 'null'
maxLength: 500
conditions:
$ref: '#/components/schemas/SegmentConditions'
responses:
'200':
description: The updated segment.
content:
application/json:
schema:
$ref: '#/components/schemas/Segment'
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Not included in this project's plan (code `plan_limit`); `details.requiredPlan` names the cheapest plan that includes it.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: Request validation failed (code `validation_error`, 422).
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
delete:
tags:
- Segments
operationId: deleteSegment
summary: Delete a segment
description: 'Deletes the segment and every membership row belonging to it. The contacts themselves are untouched — membership is a join, and only the join is removed.
Nothing checks whether a campaign or workflow still names this `segmentId`; those references are left dangling and resolve to no audience.'
parameters:
- name: id
in: path
required: true
description: Segment id.
schema:
type: string
responses:
'200':
description: Deleted.
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
required:
- success
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: Request validation failed (code `validation_error`, 422).
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/v1/segments/{id}/refresh:
post:
tags:
- Segments
operationId: refreshSegment
summary: Recompute membership
description: 'Recomputes a dynamic segment against the current contact graph and returns how many contacts `entered`, how many `exited`, and the resulting `memberCount`.
**This has side effects beyond the count.** Entering and exiting emit `segment.entered` and `segment.exited`, so any workflow triggered on those events is set off by this call and any webhook subscribed to them fires. Refreshing a large segment after a bulk import is therefore an automation event, not a read.
Static segments are not recomputed — their membership is whatever was added by hand — so for those the call only refreshes the stored count and reports `entered: 0, exited: 0`.'
parameters:
- name: id
in: path
required: true
description: Segment id.
schema:
type: string
responses:
'200':
description: Membership delta.
content:
application/json:
schema:
type: object
properties:
entered:
type: integer
exited:
type: integer
memberCount:
type: integer
required:
- entered
- exited
- memberCount
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: Request validation failed (code `validation_error`, 422).
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/v1/segments/{id}/members:
get:
tags:
- Segments
operationId: listSegmentMembers
summary: List members
description: Current members joined to their contacts, newest entries first.
parameters:
- name: id
in: path
required: true
description: Segment id.
schema:
type: string
- name: limit
in: query
required: false
schema:
type: integer
minimum: 1
maximum: 200
default: 50
responses:
'200':
description: Current members.
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/SegmentMember'
required:
- data
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: Request validation failed (code `validation_error`, 422).
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
post:
tags:
- Segments
operationId: addSegmentMembers
summary: Add members (static segments)
description: Add up to 1,000 contacts by email. Only valid for static segments — dynamic membership is computed from conditions.
parameters:
- name: id
in: path
required: true
description: Segment id.
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
emails:
type: array
items:
type: string
format: email
minItems: 1
maxItems: 1000
required:
- emails
responses:
'200':
description: Add summary.
content:
application/json:
schema:
type: object
properties:
added:
type: integer
missing:
type: array
items:
type: string
description: Addresses with no matching contact.
required:
- added
- missing
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: Request validation failed (code `validation_error`, 422).
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/v1/segments/{id}/members/{contactId}:
delete:
tags:
- Segments
operationId: removeSegmentMember
summary: Remove a member (static segments)
description: 'Marks a contact as exited from a **static** segment and emits `segment.exited`.
Static only: membership of a dynamic segment is derived from its conditions, so removing someone by hand would be undone by the next refresh. Attempting it answers 422 — edit the conditions instead.
The contact record is untouched and the same contact can be added back later with `POST /v1/segments/{id}/members`.'
parameters:
- name: id
in: path
required: true
description: Segment id.
schema:
type: string
- name: contactId
in: path
required: true
description: Contact id.
schema:
type: string
responses:
'200':
description: Removed.
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
required:
- success
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: Request validation failed (code `validation_error`, 422).
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
Error:
type: object
description: The error envelope returned by every non-2xx response. `error` is a human-readable string — branch on `code`, not on the wording of `error`, which may be reworded at any time.
properties:
success:
type: boolean
enum:
- false
error:
type: string
description: Human-readable explanation. For `validation_error` it names the failing field.
code:
type: string
description: Machine-readable code, e.g. `unauthorized`, `not_found`, `validation_error`, `invalid_state`, `idempotency_key_reused`, `ambiguous_api_key`, `send_failed`, `plan_limit`.
details:
type:
- array
- object
description: 'Present on `validation_error` (one entry per failing field) and on `send_failed`, where the single entry names the specific cause. `code` is the part to branch on — see the `details` note on `POST /v1/send`. On `plan_limit` it is an object instead: `{ feature, plan, requiredPlan, limit?, used? }`, where `requiredPlan` is the cheapest plan that includes the feature (`null` when none does — contact support).'
items:
type: object
properties:
path:
type: string
description: Dotted path into the request body, e.g. "messages.2.to". Empty string when the failure is not attributable to one field — which is the case for every `send_failed` entry.
message:
type: string
code:
type: string
description: The underlying validator's code (`invalid_string`, `unrecognized_keys`, `invalid_cursor`, …), or for `send_failed` the specific cause (`template_not_found`, …).
required:
- path
- message
- code
required:
- success
- error
- code
Contact:
type: object
properties:
contactId:
type: string
projectId:
type: string
email:
type: string
format: email
firstName:
type:
- string
- 'null'
lastName:
type:
- string
- 'null'
subscribed:
type: boolean
data:
type:
- object
- 'null'
additionalProperties: true
description: Arbitrary custom fields.
locale:
type:
- string
- 'null'
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
required:
- contactId
- email
- subscribed
- createdAt
- updatedAt
SegmentConditions:
type: object
description: Nested condition tree evaluated against contacts, their custom `data`, and their activity.
properties:
logic:
type: string
enum:
- and
- or
groups:
type: array
minItems: 1
maxItems: 20
items:
type: object
properties:
filters:
type: array
minItems: 1
maxItems: 20
items:
type: object
properties:
field:
type: string
description: '`email`, `subscribed`, `locale`, `createdAt`, `data.<key>`, `event.<name>`, `email.opened`, …'
operator:
type: string
description: '`equals`, `notEquals`, `contains`, `notContains`, `greaterThan`, `lessThan`, `exists`, `notExists`, `within`, `notWithin`, `triggered`, `notTriggered`, …'
value:
oneOf:
- type: string
- type: number
- type: boolean
days:
type: integer
minimum: 1
maximum: 3650
description: Time window (days) for activity operators.
required:
- field
- operator
required:
- filters
required:
- logic
- groups
SegmentMember:
type: object
properties:
contactId:
type: string
email:
type: string
format: email
firstName:
type:
- string
- 'null'
lastName:
type:
- string
- 'null'
enteredAt:
type: string
format: date-time
required:
- contactId
- email
- enteredAt
Segment:
type: object
properties:
segmentId:
type: string
projectId:
type: string
name:
type: string
description:
type:
- string
- 'null'
type:
type: string
enum:
- dynamic
- static
description: Dynamic segments are computed from `conditions`; static segments are managed via the members endpoints.
conditions:
oneOf:
- $ref: '#/components/schemas/SegmentConditions'
- type: 'null'
memberCount:
type: integer
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
required:
- segmentId
- name
- type
- memberCount
- createdAt
- updatedAt
securitySchemes:
bearerAuth:
type: http
scheme: bearer
description: Project API key. Use `sk_…` (secret) or `sk_test_…` (test) for server-side endpoints; `pk_…` (public) is accepted only by `POST /v1/events`.