Phone Contact Rules
Per-identity allow/block rules for inbound calls and text messages. Rules attach to the agent identity itself and are addressed by agent_handle, covering both voice and SMS on the identity's phone number. The identity's phone_filter_mode field decides how the rule list is interpreted:
phone_filter_mode: "whitelist"— only callers and senders matching anallowrule can reach the agentphone_filter_mode: "blacklist"— every caller and sender can reach the agent except those matching ablockrule
Set phone_filter_mode on the identity via PATCH /identities/{agent_handle} — see Manage identities. Rules match on exact E.164 phone numbers only in v1 (match_type: "exact_number"); the field is wired in to stay forward-compatible when additional match types are added.
A rule with status: "paused" has no effect, but still counts as the rule for its number. Creating a duplicate returns 409.
When a caller or sender is blocked: inbound calls are rejected before they connect, and inbound texts are stored but never delivered to the agent. No text.received webhooks fire, identity-scoped keys never see the blocked rows, and admin API keys or the Inkbox Console can audit them with is_blocked=true filters on the calls and texts listings.
The identity needs a phone number. Phone contact rules and
phone_filter_modeonly apply to an identity that has a phone number. While an identity has no number, creating a rule (or settingphone_filter_mode) returns422, listing rules returns an empty list, and addressing a specific rule returns404. Assign a number first — see Phone numbers.
Deprecated. The per-number routes under
/numbers/{phone_number_id}/contact-rulesare deprecated. Use the handle-keyed routes documented below instead.
Auth. List, get, and create accept admin API keys and claimed agent keys; unclaimed (mid-signup) agent keys are rejected. PATCH, DELETE, and the org-wide list require an admin-scoped API key, or you can manage them as a user in the Inkbox Console.
List contact rules GET
GET /identities/{agent_handle}/phone-contact-rulesList contact rules for an agent identity, newest first. Returns an empty list while the identity has no phone number.
An identity-scoped API key may only address its own identity's agent_handle — any other handle returns 403 (this applies to list, get, and create alike).
Path parameters
| Parameter | Type | Description |
|---|---|---|
agent_handle | string | The identity's handle, with or without the leading @ |
Query parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
action | string | — | Filter by "allow" or "block" |
match_type | string | — | Filter by match type ("exact_number" is the only value in v1) |
limit | integer | 50 | 1–200 |
offset | integer | 0 | Offset for pagination |
Response (200)
Code examples
Create contact rule POST
POST /identities/{agent_handle}/phone-contact-rulesAdd an allow or block rule for an agent identity. New rules are always created active; use update to pause one.
Path parameters
| Parameter | Type | Description |
|---|---|---|
agent_handle | string | The identity's handle |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
action | string | Yes | "allow" or "block" |
match_target | string | Yes | E.164 phone number to match (e.g. +14155550100) |
match_type | string | No | Defaults to "exact_number" (the only value in v1) |
Request example
Response (201)
Returns the new rule. See Contact rule object.
Error responses
| Status | Description |
|---|---|
| 403 | Identity-scoped key addressed a different identity's handle |
| 404 | Identity not found, or not visible to the caller |
| 409 | rule_already_exists — a rule with the same (match_type, match_target) already exists on this identity; the response includes existing_rule_id |
| 422 | Invalid action, match_type, or match_target — or the identity has no phone number |
Code examples
Get contact rule GET
GET /identities/{agent_handle}/phone-contact-rules/{rule_id}Fetch a single rule by ID.
Path parameters
| Parameter | Type | Description |
|---|---|---|
agent_handle | string | The identity's handle |
rule_id | UUID | Rule ID |
Response (200)
Returns the rule. See Contact rule object.
Error responses
| Status | Description |
|---|---|
| 403 | Identity-scoped key addressed a different identity's handle |
| 404 | Rule not found, it belongs to a different identity, or the identity has no phone number |
Update contact rule PATCH
PATCH /identities/{agent_handle}/phone-contact-rules/{rule_id}Change a rule's action or status. Requires an admin API key, or manage rules from the Inkbox Console. match_type and match_target are immutable — delete the rule and create a new one to change the target.
Path parameters
| Parameter | Type | Description |
|---|---|---|
agent_handle | string | The identity's handle |
rule_id | UUID | Rule ID |
Request body
At least one field is required; fields you omit are left unchanged.
| Field | Type | Required | Description |
|---|---|---|---|
action | string | No | "allow" or "block" |
status | string | No | "active" or "paused" |
Request example
Response (200)
Returns the updated rule.
Error responses
| Status | Description |
|---|---|
| 403 | Caller is not admin-scoped |
| 404 | Rule not found, it belongs to a different identity, or the identity has no phone number |
| 422 | Empty body, or a field explicitly set to null |
Delete contact rule DELETE
DELETE /identities/{agent_handle}/phone-contact-rules/{rule_id}Delete a rule. Requires an admin API key, or manage rules from the Inkbox Console.
Path parameters
| Parameter | Type | Description |
|---|---|---|
agent_handle | string | The identity's handle |
rule_id | UUID | Rule ID |
Response (204)
No content.
Error responses
| Status | Description |
|---|---|
| 403 | Caller is not admin-scoped |
| 404 | Rule not found, it belongs to a different identity, or the identity has no phone number |
List org phone contact rules GET
GET /phone/contact-rulesOrg-wide aggregate list of phone contact rules across every identity. Intended for admin dashboards that render rules org-wide without fanning out one request per identity. Requires an admin API key, or browse rules in the Inkbox Console.
Results are ordered created_at descending, with id as a stable tiebreaker so pagination stays consistent when rules from different identities share a timestamp.
Query parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
agent_identity_id | UUID | — | Narrow to one identity by ID; omit to list across every identity in the org |
action | string | — | Filter by "allow" or "block" |
match_type | string | — | Filter by match type ("exact_number" is the only value in v1) |
limit | integer | 50 | 1–200 |
offset | integer | 0 | Offset for pagination |
Response (200)
Returns a list[ContactRule] ordered newest first — same shape as the per-identity list.
Code examples
Contact rule object
| Field | Type | Description |
|---|---|---|
id | string (UUID) | Rule ID |
agent_identity_id | string (UUID) | The identity this rule protects |
action | string | "allow" or "block" |
match_type | string | "exact_number" (the only value in v1) |
match_target | string | The matched phone number in E.164 format |
status | string | "active" or "paused" |
created_at | string (ISO 8601) | Creation timestamp |
updated_at | string (ISO 8601) | Last update timestamp |
Additional resources
- Phone guide — Filtering inbound calls and texts — narrative walk-through of whitelist/blacklist semantics
- Manage identities — set
phone_filter_mode - iMessage contact rules — the identity-scoped equivalent for iMessage
- Mail contact rules — the mail-side equivalent