zumpo/docs
Dashboard
Skip to content
ads / API reference
POSTcreateAdAudience

Create a custom audience

Creates a custom audience on the platform and returns it. No local record is kept; the returned platformAudienceId is the id every other operation on this resource takes.

THIS OPERATION IS NOT IDEMPOTENT and must never be auto-retried: the same body sent twice creates TWO audiences. Send an Idempotency-Key if a retry is possible on your side; it is honoured here.

ALL EIGHT contract types are RECOGNISED. The four this API does not implement -- company_list, engagement and website_retargeting (LinkedIn audiences; this API serves ads through its Meta adapter) and saved_targeting (a stored targeting spec consumed by an operation this API does not serve) -- answer 501 WITH THE REASON, never 400: a real type must stay distinguishable from a typo.

Type-specific fields are OPTIONAL here and validated for SHAPE only. Which combination a given type requires is the platform's rule, and enumerating it here would mean rejecting a combination the platform accepts.

Authentication

The following security requirement applies to this operation.

  1. bearerhttp

    scheme
    bearer
    bearerFormat
    zumpo-api-key
Read the authentication guide

Parameters

Idempotency-Keyheaderoptional

Client-generated unique key. Strongly recommended: creation is not idempotent on the platform and a repeated body creates a second audience.

Idempotency-Keystring
maxLength
255
Original schema
{
  "type": "string",
  "maxLength": 255
}

Request body

Required body
application/json
Bodyobjectrequired
#/components/schemas/CreateAdAudienceDto
additionalProperties
false
required
[ "accountId", "adAccountId", "name", "type" ]
accountIdstringrequired

Social account id (posting or ads variant) used to resolve the platform token.

adAccountIdstringrequired

Platform ad account id (act_<n>) the audience is created in.

pattern
^act_[1-9]\d{0,19}$
namestringrequired

Audience name, as it will appear in the platform UI.

maxLength
255
typestringrequired

Audience type. All eight contract values are RECOGNISED; the four this API does not implement (company_list, engagement, website_retargeting, saved_targeting) answer 501 with the reason, never 400 -- a real type must stay distinguishable from a typo.

enum
[ "customer_list", "company_list", "engagement", "meta_engagement", "website", "website_retargeting", "lookalike", "saved_targeting" ]
descriptionstring
maxLength
1024
customerFileSourcestring

Where a customer_list came from, in the platform's own vocabulary (e.g. the value meaning "provided directly by the people themselves"). Forwarded verbatim; the platform owns the enumeration.

pixelIdstring

Pixel id a website audience is built from.

retentionDaysinteger

How long a member stays in the audience. The platform applies its own per-type ceiling below this one (a website audience is shorter than an engagement audience); that per-type rule is the platform's, not this API's, because the contract states it in prose and not in a schema.

minimum
1
maximum
365
engagementSourcestring

Which engagement surface a meta_engagement audience is built from. Values are LOWER CASE, as the contract declares them; the platform's own upper-case spelling is a translation this API performs for you.

Only page resolves to a platform value today. The others are RECOGNISED but answer 501: the platform publishes no counterpart for them, and inventing one would either be rejected outright or -- worse -- build an audience that silently stays empty.

enum
[ "page", "instagram", "video" ]
sourceIdstring

The object id behind engagementSource (e.g. the page or form).

eventstring

Which engagement event the audience is keyed on.

sourceAudienceIdstring

Seed audience a lookalike is expanded from.

pattern
^[1-9]\d{0,19}$
countrystring

Two-letter country a lookalike is expanded within.

pattern
^[A-Za-z]{2}$
rationumber

How much of the country a lookalike covers, as a fraction. Smaller is closer to the seed.

minimum
0.01
maximum
0.2
ruleobject

Platform rule object for a website audience, forwarded VERBATIM. Only its container is checked (a non-empty object); its contents are the platform's own rule language and coercing a shape here would break rules the platform accepts.

additionalProperties
true
platformstring

Defaults to 'facebook'. Only Meta is served today.

Original schema
{
  "$ref": "#/components/schemas/CreateAdAudienceDto"
}

Responses

Status codes and shapes declared for this operation. Read each description for the meaning of that response.

201Response schema
application/json
Response 201object
#/components/schemas/MutateAdAudienceResponseDto
required
[ "audience", "message" ]
audienceobjectrequired
#/components/schemas/AdAudienceDto
required
[ "platformAudienceId", "name", "description", "type", "size", "status", "retentionDays", "createdAt", "updatedAt" ]
platformAudienceIdstringrequired

The platform's own audience id. It is ALSO the {audienceId} path segment of every other operation on this resource -- this API keeps no local audience record, so there is no second id space to translate between.

pattern
^[1-9]\d{0,19}$
namestringrequired

Audience name, or null when the platform did not report one.

nullable
true
maxLength
255
descriptionstringrequired
nullable
true
typestringrequired

The audience type, mapped from the platform's own subtype. NULL when the platform reported a subtype outside the mapped set -- forcing an unrecognised subtype into a known value would state a type we never observed.

nullable
true
enum
[ "customer_list", "website", "lookalike", "meta_engagement" ]
sizeintegerrequired

Approximate audience size as the platform reports it. It is a LOWER BOUND and it is a COUNT -- no membership is ever returned by this API.

nullable
true
minimum
0
statusstringrequired

The platform's own operation status text, verbatim (e.g. the sentence it writes while an upload is still being processed). It is NOT normalised: an unrecognised value must stay distinguishable from a recognised one.

nullable
true
retentionDaysintegerrequired

Membership retention window in days, when the platform reports one.

nullable
true
minimum
1
maximum
365
createdAtstringrequired
nullable
true
updatedAtstringrequired
nullable
true
messagestringrequired

Human-readable confirmation of what was done.

Original schema
{
  "$ref": "#/components/schemas/MutateAdAudienceResponseDto"
}
400Response schema
application/json
Response 400object
#/components/schemas/ZumpoErrorDto
required
[ "error", "type", "code", "docUrl", "requestId" ]
errorstringrequired

Human-readable message. UNSTABLE — do not branch on it.

example
WhatsApp session window expired; use a template message.
typestringrequired

Stable error category (does not change across versions).

enum
[ "invalid_request_error", "authentication_error", "permission_error", "not_found", "conflict", "rate_limit_error", "platform_error", "platform_rejected", "account_disconnected", "media_error", "api_error" ]
example
invalid_request_error
codestringrequired

Stable machine-readable code.

example
whatsapp_window_expired
paramstring

Offending parameter, present only when relevant.

example
body
docUrlstringrequired

https://docs.zumpo.io/errors/{code}

example
https://docs.zumpo.io/errors/whatsapp_window_expired
requestIdstringrequired

Support correlation id: req_ + 16 hex.

example
req_7f3a9c2e1b8d4056
detailsobject

Additional structured context, present only when an error has more to say than a single param can carry. Values are generated by this API (identifiers, node names); provider text and raw upstream payloads are never placed here. Example: a multi-step ad create that fails part-way performs no compensating delete and returns what it already built, so the caller can attach to the surviving ad set instead of losing it.

additionalProperties
true
example
{ "created": [ { "kind": "campaign", "platformId": "120210000000000001" }, { "kind": "adSet", "platformId": "120210000000000002" } ] }
Original schema
{
  "$ref": "#/components/schemas/ZumpoErrorDto"
}
401Response schema
application/json
Response 401object
#/components/schemas/ZumpoErrorDto
required
[ "error", "type", "code", "docUrl", "requestId" ]
errorstringrequired

Human-readable message. UNSTABLE — do not branch on it.

example
WhatsApp session window expired; use a template message.
typestringrequired

Stable error category (does not change across versions).

enum
[ "invalid_request_error", "authentication_error", "permission_error", "not_found", "conflict", "rate_limit_error", "platform_error", "platform_rejected", "account_disconnected", "media_error", "api_error" ]
example
invalid_request_error
codestringrequired

Stable machine-readable code.

example
whatsapp_window_expired
paramstring

Offending parameter, present only when relevant.

example
body
docUrlstringrequired

https://docs.zumpo.io/errors/{code}

example
https://docs.zumpo.io/errors/whatsapp_window_expired
requestIdstringrequired

Support correlation id: req_ + 16 hex.

example
req_7f3a9c2e1b8d4056
detailsobject

Additional structured context, present only when an error has more to say than a single param can carry. Values are generated by this API (identifiers, node names); provider text and raw upstream payloads are never placed here. Example: a multi-step ad create that fails part-way performs no compensating delete and returns what it already built, so the caller can attach to the surviving ad set instead of losing it.

additionalProperties
true
example
{ "created": [ { "kind": "campaign", "platformId": "120210000000000001" }, { "kind": "adSet", "platformId": "120210000000000002" } ] }
Original schema
{
  "$ref": "#/components/schemas/ZumpoErrorDto"
}
403Response schema
application/json
Response 403object
#/components/schemas/ZumpoErrorDto
required
[ "error", "type", "code", "docUrl", "requestId" ]
errorstringrequired

Human-readable message. UNSTABLE — do not branch on it.

example
WhatsApp session window expired; use a template message.
typestringrequired

Stable error category (does not change across versions).

enum
[ "invalid_request_error", "authentication_error", "permission_error", "not_found", "conflict", "rate_limit_error", "platform_error", "platform_rejected", "account_disconnected", "media_error", "api_error" ]
example
invalid_request_error
codestringrequired

Stable machine-readable code.

example
whatsapp_window_expired
paramstring

Offending parameter, present only when relevant.

example
body
docUrlstringrequired

https://docs.zumpo.io/errors/{code}

example
https://docs.zumpo.io/errors/whatsapp_window_expired
requestIdstringrequired

Support correlation id: req_ + 16 hex.

example
req_7f3a9c2e1b8d4056
detailsobject

Additional structured context, present only when an error has more to say than a single param can carry. Values are generated by this API (identifiers, node names); provider text and raw upstream payloads are never placed here. Example: a multi-step ad create that fails part-way performs no compensating delete and returns what it already built, so the caller can attach to the surviving ad set instead of losing it.

additionalProperties
true
example
{ "created": [ { "kind": "campaign", "platformId": "120210000000000001" }, { "kind": "adSet", "platformId": "120210000000000002" } ] }
Original schema
{
  "$ref": "#/components/schemas/ZumpoErrorDto"
}
404Resource not found

Resource not found

application/json
Response 404object
#/components/schemas/ZumpoErrorDto
required
[ "error", "type", "code", "docUrl", "requestId" ]
errorstringrequired

Human-readable message. UNSTABLE — do not branch on it.

example
WhatsApp session window expired; use a template message.
typestringrequired

Stable error category (does not change across versions).

enum
[ "invalid_request_error", "authentication_error", "permission_error", "not_found", "conflict", "rate_limit_error", "platform_error", "platform_rejected", "account_disconnected", "media_error", "api_error" ]
example
invalid_request_error
codestringrequired

Stable machine-readable code.

example
whatsapp_window_expired
paramstring

Offending parameter, present only when relevant.

example
body
docUrlstringrequired

https://docs.zumpo.io/errors/{code}

example
https://docs.zumpo.io/errors/whatsapp_window_expired
requestIdstringrequired

Support correlation id: req_ + 16 hex.

example
req_7f3a9c2e1b8d4056
detailsobject

Additional structured context, present only when an error has more to say than a single param can carry. Values are generated by this API (identifiers, node names); provider text and raw upstream payloads are never placed here. Example: a multi-step ad create that fails part-way performs no compensating delete and returns what it already built, so the caller can attach to the surviving ad set instead of losing it.

additionalProperties
true
example
{ "created": [ { "kind": "campaign", "platformId": "120210000000000001" }, { "kind": "adSet", "platformId": "120210000000000002" } ] }
Original schema
{
  "$ref": "#/components/schemas/ZumpoErrorDto"
}
409Response schema
application/json
Response 409object
#/components/schemas/ZumpoErrorDto
required
[ "error", "type", "code", "docUrl", "requestId" ]
errorstringrequired

Human-readable message. UNSTABLE — do not branch on it.

example
WhatsApp session window expired; use a template message.
typestringrequired

Stable error category (does not change across versions).

enum
[ "invalid_request_error", "authentication_error", "permission_error", "not_found", "conflict", "rate_limit_error", "platform_error", "platform_rejected", "account_disconnected", "media_error", "api_error" ]
example
invalid_request_error
codestringrequired

Stable machine-readable code.

example
whatsapp_window_expired
paramstring

Offending parameter, present only when relevant.

example
body
docUrlstringrequired

https://docs.zumpo.io/errors/{code}

example
https://docs.zumpo.io/errors/whatsapp_window_expired
requestIdstringrequired

Support correlation id: req_ + 16 hex.

example
req_7f3a9c2e1b8d4056
detailsobject

Additional structured context, present only when an error has more to say than a single param can carry. Values are generated by this API (identifiers, node names); provider text and raw upstream payloads are never placed here. Example: a multi-step ad create that fails part-way performs no compensating delete and returns what it already built, so the caller can attach to the surviving ad set instead of losing it.

additionalProperties
true
example
{ "created": [ { "kind": "campaign", "platformId": "120210000000000001" }, { "kind": "adSet", "platformId": "120210000000000002" } ] }
Original schema
{
  "$ref": "#/components/schemas/ZumpoErrorDto"
}
422Response schema
application/json
Response 422object
#/components/schemas/ZumpoErrorDto
required
[ "error", "type", "code", "docUrl", "requestId" ]
errorstringrequired

Human-readable message. UNSTABLE — do not branch on it.

example
WhatsApp session window expired; use a template message.
typestringrequired

Stable error category (does not change across versions).

enum
[ "invalid_request_error", "authentication_error", "permission_error", "not_found", "conflict", "rate_limit_error", "platform_error", "platform_rejected", "account_disconnected", "media_error", "api_error" ]
example
invalid_request_error
codestringrequired

Stable machine-readable code.

example
whatsapp_window_expired
paramstring

Offending parameter, present only when relevant.

example
body
docUrlstringrequired

https://docs.zumpo.io/errors/{code}

example
https://docs.zumpo.io/errors/whatsapp_window_expired
requestIdstringrequired

Support correlation id: req_ + 16 hex.

example
req_7f3a9c2e1b8d4056
detailsobject

Additional structured context, present only when an error has more to say than a single param can carry. Values are generated by this API (identifiers, node names); provider text and raw upstream payloads are never placed here. Example: a multi-step ad create that fails part-way performs no compensating delete and returns what it already built, so the caller can attach to the surviving ad set instead of losing it.

additionalProperties
true
example
{ "created": [ { "kind": "campaign", "platformId": "120210000000000001" }, { "kind": "adSet", "platformId": "120210000000000002" } ] }
Original schema
{
  "$ref": "#/components/schemas/ZumpoErrorDto"
}
429Response schema
application/json
Response 429object
#/components/schemas/ZumpoErrorDto
required
[ "error", "type", "code", "docUrl", "requestId" ]
errorstringrequired

Human-readable message. UNSTABLE — do not branch on it.

example
WhatsApp session window expired; use a template message.
typestringrequired

Stable error category (does not change across versions).

enum
[ "invalid_request_error", "authentication_error", "permission_error", "not_found", "conflict", "rate_limit_error", "platform_error", "platform_rejected", "account_disconnected", "media_error", "api_error" ]
example
invalid_request_error
codestringrequired

Stable machine-readable code.

example
whatsapp_window_expired
paramstring

Offending parameter, present only when relevant.

example
body
docUrlstringrequired

https://docs.zumpo.io/errors/{code}

example
https://docs.zumpo.io/errors/whatsapp_window_expired
requestIdstringrequired

Support correlation id: req_ + 16 hex.

example
req_7f3a9c2e1b8d4056
detailsobject

Additional structured context, present only when an error has more to say than a single param can carry. Values are generated by this API (identifiers, node names); provider text and raw upstream payloads are never placed here. Example: a multi-step ad create that fails part-way performs no compensating delete and returns what it already built, so the caller can attach to the surviving ad set instead of losing it.

additionalProperties
true
example
{ "created": [ { "kind": "campaign", "platformId": "120210000000000001" }, { "kind": "adSet", "platformId": "120210000000000002" } ] }
Original schema
{
  "$ref": "#/components/schemas/ZumpoErrorDto"
}

Response headers

X-RateLimit-Limit

Request ceiling that applied to this request. Authenticated requests use the team tier ceiling; unauthenticated identity endpoints use a per-IP ceiling. Usage is measured continuously against a trailing period rather than tallied and cleared at a boundary, so the full ceiling never becomes available again in one step.

X-RateLimit-Limitinteger
minimum
1
Original schema
{
  "type": "integer",
  "minimum": 1
}

X-RateLimit-Remaining

Requests still allowed against that ceiling; never negative. On a 429 produced by the request throttler this is 0. Such a refused request is not counted, so retrying too early costs you no capacity and does not push your recovery further away.

X-RateLimit-Remaininginteger
minimum
0
Original schema
{
  "type": "integer",
  "minimum": 0
}

X-RateLimit-Reset

Absolute Unix epoch time, in SECONDS, at which the current counting period turns over. This is NOT the number of seconds left: subtract the current time to obtain that. It is also NOT the moment your capacity returns: earlier usage keeps weighing on the ceiling across the turnover, so after a 429 wait for Retry-After instead, which is usually later than this value.

X-RateLimit-Resetinteger
format
int64
minimum
0
Original schema
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}

Retry-After

Seconds to wait before retrying. Always a positive integer delta (never an HTTP-date), at least 1. On a 429 from the request throttler it is the wait until your usage actually drops back under the ceiling; prefer it over any delay you compute from X-RateLimit-Reset.

Retry-Afterinteger
minimum
1
maximum
86400
Original schema
{
  "type": "integer",
  "minimum": 1,
  "maximum": 86400
}
500Server error

Server error

application/json
Response 500object
#/components/schemas/ZumpoErrorDto
required
[ "error", "type", "code", "docUrl", "requestId" ]
errorstringrequired

Human-readable message. UNSTABLE — do not branch on it.

example
WhatsApp session window expired; use a template message.
typestringrequired

Stable error category (does not change across versions).

enum
[ "invalid_request_error", "authentication_error", "permission_error", "not_found", "conflict", "rate_limit_error", "platform_error", "platform_rejected", "account_disconnected", "media_error", "api_error" ]
example
invalid_request_error
codestringrequired

Stable machine-readable code.

example
whatsapp_window_expired
paramstring

Offending parameter, present only when relevant.

example
body
docUrlstringrequired

https://docs.zumpo.io/errors/{code}

example
https://docs.zumpo.io/errors/whatsapp_window_expired
requestIdstringrequired

Support correlation id: req_ + 16 hex.

example
req_7f3a9c2e1b8d4056
detailsobject

Additional structured context, present only when an error has more to say than a single param can carry. Values are generated by this API (identifiers, node names); provider text and raw upstream payloads are never placed here. Example: a multi-step ad create that fails part-way performs no compensating delete and returns what it already built, so the caller can attach to the surviving ad set instead of losing it.

additionalProperties
true
example
{ "created": [ { "kind": "campaign", "platformId": "120210000000000001" }, { "kind": "adSet", "platformId": "120210000000000002" } ] }
Original schema
{
  "$ref": "#/components/schemas/ZumpoErrorDto"
}
501Response schema
application/json
Response 501object
#/components/schemas/ZumpoErrorDto
required
[ "error", "type", "code", "docUrl", "requestId" ]
errorstringrequired

Human-readable message. UNSTABLE — do not branch on it.

example
WhatsApp session window expired; use a template message.
typestringrequired

Stable error category (does not change across versions).

enum
[ "invalid_request_error", "authentication_error", "permission_error", "not_found", "conflict", "rate_limit_error", "platform_error", "platform_rejected", "account_disconnected", "media_error", "api_error" ]
example
invalid_request_error
codestringrequired

Stable machine-readable code.

example
whatsapp_window_expired
paramstring

Offending parameter, present only when relevant.

example
body
docUrlstringrequired

https://docs.zumpo.io/errors/{code}

example
https://docs.zumpo.io/errors/whatsapp_window_expired
requestIdstringrequired

Support correlation id: req_ + 16 hex.

example
req_7f3a9c2e1b8d4056
detailsobject

Additional structured context, present only when an error has more to say than a single param can carry. Values are generated by this API (identifiers, node names); provider text and raw upstream payloads are never placed here. Example: a multi-step ad create that fails part-way performs no compensating delete and returns what it already built, so the caller can attach to the surviving ad set instead of losing it.

additionalProperties
true
example
{ "created": [ { "kind": "campaign", "platformId": "120210000000000001" }, { "kind": "adSet", "platformId": "120210000000000002" } ] }
Original schema
{
  "$ref": "#/components/schemas/ZumpoErrorDto"
}
502Platform error

Platform error

application/json
Response 502object
#/components/schemas/ZumpoErrorDto
required
[ "error", "type", "code", "docUrl", "requestId" ]
errorstringrequired

Human-readable message. UNSTABLE — do not branch on it.

example
WhatsApp session window expired; use a template message.
typestringrequired

Stable error category (does not change across versions).

enum
[ "invalid_request_error", "authentication_error", "permission_error", "not_found", "conflict", "rate_limit_error", "platform_error", "platform_rejected", "account_disconnected", "media_error", "api_error" ]
example
invalid_request_error
codestringrequired

Stable machine-readable code.

example
whatsapp_window_expired
paramstring

Offending parameter, present only when relevant.

example
body
docUrlstringrequired

https://docs.zumpo.io/errors/{code}

example
https://docs.zumpo.io/errors/whatsapp_window_expired
requestIdstringrequired

Support correlation id: req_ + 16 hex.

example
req_7f3a9c2e1b8d4056
detailsobject

Additional structured context, present only when an error has more to say than a single param can carry. Values are generated by this API (identifiers, node names); provider text and raw upstream payloads are never placed here. Example: a multi-step ad create that fails part-way performs no compensating delete and returns what it already built, so the caller can attach to the surviving ad set instead of losing it.

additionalProperties
true
example
{ "created": [ { "kind": "campaign", "platformId": "120210000000000001" }, { "kind": "adSet", "platformId": "120210000000000002" } ] }
Original schema
{
  "$ref": "#/components/schemas/ZumpoErrorDto"
}
503Service unavailable

Service unavailable

application/json
Response 503object
#/components/schemas/ZumpoErrorDto
required
[ "error", "type", "code", "docUrl", "requestId" ]
errorstringrequired

Human-readable message. UNSTABLE — do not branch on it.

example
WhatsApp session window expired; use a template message.
typestringrequired

Stable error category (does not change across versions).

enum
[ "invalid_request_error", "authentication_error", "permission_error", "not_found", "conflict", "rate_limit_error", "platform_error", "platform_rejected", "account_disconnected", "media_error", "api_error" ]
example
invalid_request_error
codestringrequired

Stable machine-readable code.

example
whatsapp_window_expired
paramstring

Offending parameter, present only when relevant.

example
body
docUrlstringrequired

https://docs.zumpo.io/errors/{code}

example
https://docs.zumpo.io/errors/whatsapp_window_expired
requestIdstringrequired

Support correlation id: req_ + 16 hex.

example
req_7f3a9c2e1b8d4056
detailsobject

Additional structured context, present only when an error has more to say than a single param can carry. Values are generated by this API (identifiers, node names); provider text and raw upstream payloads are never placed here. Example: a multi-step ad create that fails part-way performs no compensating delete and returns what it already built, so the caller can attach to the surviving ad set instead of losing it.

additionalProperties
true
example
{ "created": [ { "kind": "campaign", "platformId": "120210000000000001" }, { "kind": "adSet", "platformId": "120210000000000002" } ] }
Original schema
{
  "$ref": "#/components/schemas/ZumpoErrorDto"
}

Referenced schemas

Original local definitions used by this operation. Recursive and deeply nested references can be inspected here without expanding them repeatedly.

CreateAdAudienceDto

#/components/schemas/CreateAdAudienceDto

{
  "type": "object",
  "properties": {
    "accountId": {
      "type": "string",
      "description": "Social account id (posting or ads variant) used to resolve the platform token."
    },
    "adAccountId": {
      "type": "string",
      "pattern": "^act_[1-9]\\d{0,19}$",
      "description": "Platform ad account id (act_<n>) the audience is created in."
    },
    "name": {
      "type": "string",
      "maxLength": 255,
      "description": "Audience name, as it will appear in the platform UI."
    },
    "type": {
      "type": "string",
      "enum": [
        "customer_list",
        "company_list",
        "engagement",
        "meta_engagement",
        "website",
        "website_retargeting",
        "lookalike",
        "saved_targeting"
      ],
      "description": "Audience type. All eight contract values are RECOGNISED; the four this API does not implement (`company_list`, `engagement`, `website_retargeting`, `saved_targeting`) answer 501 with the reason, never 400 -- a real type must stay distinguishable from a typo."
    },
    "description": {
      "type": "string",
      "maxLength": 1024
    },
    "customerFileSource": {
      "type": "string",
      "description": "Where a customer_list came from, in the platform's own vocabulary (e.g. the value meaning \"provided directly by the people themselves\"). Forwarded verbatim; the platform owns the enumeration."
    },
    "pixelId": {
      "type": "string",
      "description": "Pixel id a `website` audience is built from."
    },
    "retentionDays": {
      "type": "integer",
      "minimum": 1,
      "maximum": 365,
      "description": "How long a member stays in the audience. The platform applies its own per-type ceiling below this one (a website audience is shorter than an engagement audience); that per-type rule is the platform's, not this API's, because the contract states it in prose and not in a schema."
    },
    "engagementSource": {
      "type": "string",
      "enum": [
        "page",
        "instagram",
        "video"
      ],
      "description": "Which engagement surface a `meta_engagement` audience is built from. Values are LOWER CASE, as the contract declares them; the platform's own upper-case spelling is a translation this API performs for you.\n\nOnly page resolves to a platform value today. The others are RECOGNISED but answer 501: the platform publishes no counterpart for them, and inventing one would either be rejected outright or -- worse -- build an audience that silently stays empty."
    },
    "sourceId": {
      "type": "string",
      "description": "The object id behind `engagementSource` (e.g. the page or form)."
    },
    "event": {
      "type": "string",
      "description": "Which engagement event the audience is keyed on."
    },
    "sourceAudienceId": {
      "type": "string",
      "pattern": "^[1-9]\\d{0,19}$",
      "description": "Seed audience a `lookalike` is expanded from."
    },
    "country": {
      "type": "string",
      "pattern": "^[A-Za-z]{2}$",
      "description": "Two-letter country a `lookalike` is expanded within."
    },
    "ratio": {
      "type": "number",
      "minimum": 0.01,
      "maximum": 0.2,
      "description": "How much of the country a `lookalike` covers, as a fraction. Smaller is closer to the seed."
    },
    "rule": {
      "type": "object",
      "additionalProperties": true,
      "description": "Platform rule object for a `website` audience, forwarded VERBATIM. Only its container is checked (a non-empty object); its contents are the platform's own rule language and coercing a shape here would break rules the platform accepts."
    },
    "platform": {
      "type": "string",
      "description": "Defaults to 'facebook'. Only Meta is served today."
    }
  },
  "additionalProperties": false,
  "required": [
    "accountId",
    "adAccountId",
    "name",
    "type"
  ]
}
MutateAdAudienceResponseDto

#/components/schemas/MutateAdAudienceResponseDto

{
  "type": "object",
  "properties": {
    "audience": {
      "$ref": "#/components/schemas/AdAudienceDto"
    },
    "message": {
      "type": "string",
      "description": "Human-readable confirmation of what was done."
    }
  },
  "required": [
    "audience",
    "message"
  ]
}
AdAudienceDto

#/components/schemas/AdAudienceDto

{
  "type": "object",
  "properties": {
    "platformAudienceId": {
      "type": "string",
      "pattern": "^[1-9]\\d{0,19}$",
      "description": "The platform's own audience id. It is ALSO the `{audienceId}` path segment of every other operation on this resource -- this API keeps no local audience record, so there is no second id space to translate between."
    },
    "name": {
      "type": "string",
      "nullable": true,
      "maxLength": 255,
      "description": "Audience name, or null when the platform did not report one."
    },
    "description": {
      "type": "string",
      "nullable": true
    },
    "type": {
      "type": "string",
      "nullable": true,
      "enum": [
        "customer_list",
        "website",
        "lookalike",
        "meta_engagement"
      ],
      "description": "The audience type, mapped from the platform's own subtype. NULL when the platform reported a subtype outside the mapped set -- forcing an unrecognised subtype into a known value would state a type we never observed."
    },
    "size": {
      "type": "integer",
      "nullable": true,
      "minimum": 0,
      "description": "Approximate audience size as the platform reports it. It is a LOWER BOUND and it is a COUNT -- no membership is ever returned by this API."
    },
    "status": {
      "type": "string",
      "nullable": true,
      "description": "The platform's own operation status text, verbatim (e.g. the sentence it writes while an upload is still being processed). It is NOT normalised: an unrecognised value must stay distinguishable from a recognised one."
    },
    "retentionDays": {
      "type": "integer",
      "nullable": true,
      "minimum": 1,
      "maximum": 365,
      "description": "Membership retention window in days, when the platform reports one."
    },
    "createdAt": {
      "type": "string",
      "nullable": true
    },
    "updatedAt": {
      "type": "string",
      "nullable": true
    }
  },
  "required": [
    "platformAudienceId",
    "name",
    "description",
    "type",
    "size",
    "status",
    "retentionDays",
    "createdAt",
    "updatedAt"
  ]
}
ZumpoErrorDto

#/components/schemas/ZumpoErrorDto

{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "description": "Human-readable message. UNSTABLE — do not branch on it.",
      "example": "WhatsApp session window expired; use a template message."
    },
    "type": {
      "type": "string",
      "description": "Stable error category (does not change across versions).",
      "enum": [
        "invalid_request_error",
        "authentication_error",
        "permission_error",
        "not_found",
        "conflict",
        "rate_limit_error",
        "platform_error",
        "platform_rejected",
        "account_disconnected",
        "media_error",
        "api_error"
      ],
      "example": "invalid_request_error"
    },
    "code": {
      "type": "string",
      "description": "Stable machine-readable code.",
      "example": "whatsapp_window_expired"
    },
    "param": {
      "type": "string",
      "description": "Offending parameter, present only when relevant.",
      "example": "body"
    },
    "docUrl": {
      "type": "string",
      "description": "https://docs.zumpo.io/errors/{code}",
      "example": "https://docs.zumpo.io/errors/whatsapp_window_expired"
    },
    "requestId": {
      "type": "string",
      "description": "Support correlation id: req_ + 16 hex.",
      "example": "req_7f3a9c2e1b8d4056"
    },
    "details": {
      "type": "object",
      "additionalProperties": true,
      "description": "Additional structured context, present only when an error has more to say than a single `param` can carry. Values are generated by this API (identifiers, node names); provider text and raw upstream payloads are never placed here. Example: a multi-step ad create that fails part-way performs no compensating delete and returns what it already built, so the caller can attach to the surviving ad set instead of losing it.",
      "example": {
        "created": [
          {
            "kind": "campaign",
            "platformId": "120210000000000001"
          },
          {
            "kind": "adSet",
            "platformId": "120210000000000002"
          }
        ]
      }
    }
  },
  "required": [
    "error",
    "type",
    "code",
    "docUrl",
    "requestId"
  ]
}