Skip to main content
POST
Add a phone number to the DNC list
Add a phone number to your company’s Do-Not-Call list. Once added, outbound call placement (both POST /calls and the queue dispatcher) skips this destination: a call_logs row is written with status: "dnc_blocked" for analytics, but no carrier leg is established and no minutes are charged. The number is normalized to E.164 before storage, so any common input format works (+972501234567, 972501234567, 0501234567). Re-adding a number that is already on the list is idempotent — the existing row is returned unchanged with HTTP 200 instead of an error. That includes an entry whose block has lapsed (active: false): a re-add does not renew it, and the number stays callable. To block it again, send PATCH /do-not-call/{id} with a new expires_at (or null for a block that never lapses), or delete the entry and add it again. To replace metadata on an existing entry, use PATCH /do-not-call/{id}. By default an entry is global (every outbound agent is blocked). Pass agent_ids to scope the block to specific agents — agents not in the list can still call the number. Required scope: do_not_call:manage.

Example request

Example response

HTTP 201 is returned for a new entry; HTTP 200 with the same shape is returned for an idempotent re-add.

Errors

Authorizations

Authorization
string
header
required

Your Yappr API key (e.g. ypr_live_...). Generate one in the dashboard under Settings → API Keys. No key is 401 MISSING_KEY; a key that is not one of ours, or is revoked, is 401 INVALID_KEY; an expired one is 401 EXPIRED_KEY. A valid key without the scope an operation needs is 403 INSUFFICIENT_SCOPE on every operation, and the message names the scope. Every response, a 401 included, carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset: the budget is 60 requests a minute per API key. Every 429, whatever its code, carries Retry-After (whole seconds, never zero): the per-key budget's RATE_LIMIT asks for what is left of the minute, a route's daily cap (RATE_LIMITED) for the time until that cap resets. All four headers are listed in Access-Control-Expose-Headers, so a browser can read them. A path the API does not serve (an unknown sub-path, an id left empty) is 404 ROUTE_NOT_FOUND, and a method a served path does not take is 405 METHOD_NOT_ALLOWED with an Allow header; both are answered before any scope check, and nothing is read or changed. A trailing slash is ignored where it cannot be an id left empty (POST /calls/ is POST /calls) and refused where it can (GET /calls/). A doubled slash inside a path is merged into one before the request reaches the API (GET //calls is GET /calls).

Body

application/json
phone_number
string
required

Phone number in any common format. Normalized to E.164 before storage.

Example:

"+972501234567"

reason
string | null

Optional free-form note ("Customer requested removal", "Regulator complaint", etc.).

expires_at
string<date-time> | null

When the block lapses. Omit or set to null for a permanent block.

agent_ids
string<uuid>[]

Optional. Omit or pass [] for a global block (every agent in your company is blocked from calling this number). Pass an array of agent UUIDs to scope the block to those agents — agents NOT in the list can still place outbound calls to this number. All UUIDs must reference active agents in the same company; otherwise the request is rejected with HTTP 400.

Example:

Response

Existing entry returned (idempotent re-add)

A phone number on the company's Do-Not-Call list. Outbound call placement skips numbers on this list — the request returns status: "dnc_blocked" and a call_logs row is recorded for analytics, but no carrier leg is established and no minutes are charged.

DNC entries can be global (block every agent) or agent-scoped (block only specific agents — others can still call the number). Scope is controlled via the agent_ids field.

id
string<uuid>
company_id
string<uuid>
phone_number
string

E.164 form, e.g. +972501234567. Whatever input format you submit gets normalized before storage.

Example:

"+972501234567"

reason
string | null

Optional free-form note. Surfaced in the dashboard, not in outbound API responses.

source
enum<string>

Where this entry came from. manual = added via dashboard, api = added via this API, auto = reserved for future automated additions (e.g. opt-out keyword detection during a call).

Available options:
manual,
api,
auto
expires_at
string<date-time> | null

When the block lapses. null = permanent. Past timestamps are filtered out at outbound-check time.

active
boolean

Whether this entry blocks calls right now: true when expires_at is null or still in the future, false once it has passed. A lapsed entry is not removed - it stays on the list, and a ?phone= lookup still returns it, with active: false - until you delete it or give it a new expires_at.

Example:

true

agents
object[]

Empty array [] (or omitted on insert) = global: every agent in the company is blocked from calling this number.

Non-empty = scoped: only the listed agents are blocked. Agents NOT in the array can still place outbound calls to this number.

On GET responses each item is the full agent object (resolved from the underlying agent_ids column so you don't have to make a second /agents/{id} call). On POST/PATCH inputs the field is named agent_ids and takes a string[] of UUIDs — see those endpoints for the input shape.

created_by
string<uuid> | null

Best-effort attribution to a user; null when added via API.

created_at
string<date-time>