Skip to content
Inkbox

Inkbox

BlogContactDocs
GuidesAPI Reference

Ctrl K

GuidesAPI Reference

Jump to

iMessage Contact Rules

Per-identity allow/block rules for inbound iMessage traffic. Because there is no per-identity iMessage number — conversations ride a shared pool of lines — rules attach to the agent identity itself and are addressed by agent_handle. The identity's imessage_filter_mode field decides how the rule list is interpreted:

  • imessage_filter_mode: "whitelist" — only numbers matching an allow rule can reach the agent
  • imessage_filter_mode: "blacklist" — every number can reach the agent except those matching a block rule

Set imessage_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 number is blocked: inbound messages are stored but never delivered to the agent. No webhooks fire, identity-scoped keys never see them, and admin API keys or the Inkbox Console can audit them with is_blocked=true. Inbound tapbacks are not recorded, outbound sends and tapbacks to the number return 403, and the router gives the blocked human the same generic response as for an unknown agent.

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}/contact-rules

List contact rules for an agent identity, newest first.

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

ParameterTypeDescription
agent_handlestringThe identity's handle, with or without the leading @

Query parameters

ParameterTypeDefaultDescription
actionstringFilter by "allow" or "block"
match_typestringFilter by match type ("exact_number" is the only value in v1)
limitinteger501–200
offsetinteger0Offset for pagination

Response (200)

JSONJSON

Code examples


Create contact rule POST

POST /identities/{agent_handle}/contact-rules

Add an allow or block rule for an agent identity. New rules are always created active; use update to pause one.

Path parameters

ParameterTypeDescription
agent_handlestringThe identity's handle

Request body

FieldTypeRequiredDescription
actionstringYes"allow" or "block"
match_targetstringYesPhone number to match, normalized to E.164
match_typestringNoDefaults to "exact_number" (the only value in v1)

Request example

JSONJSON

Response (201)

Returns the new rule. See Contact rule object.

Error responses

StatusDescription
403Identity-scoped key addressed a different identity's handle
404Identity not found, or not visible to the caller
409rule_already_exists — a rule with the same (match_type, match_target) already exists on this identity; the response includes existing_rule_id
422Invalid action, match_type, or match_target

Code examples


Get contact rule GET

GET /identities/{agent_handle}/contact-rules/{rule_id}

Fetch a single rule by ID.

Path parameters

ParameterTypeDescription
agent_handlestringThe identity's handle
rule_idUUIDRule ID

Response (200)

Returns the rule. See Contact rule object.

Error responses

StatusDescription
403Identity-scoped key addressed a different identity's handle
404Rule not found, or it belongs to a different identity

Update contact rule PATCH

PATCH /identities/{agent_handle}/contact-rules/{rule_id}

Change a rule's action or status. Requires an admin API key, or manage rules from the Inkbox Console.

Path parameters

ParameterTypeDescription
agent_handlestringThe identity's handle
rule_idUUIDRule ID

Request body

At least one field is required; fields you omit are left unchanged.

FieldTypeRequiredDescription
actionstringNo"allow" or "block"
statusstringNo"active" or "paused"

Request example

JSONJSON

Response (200)

Returns the updated rule.

Error responses

StatusDescription
403Caller is not admin-scoped
404Rule not found, or it belongs to a different identity
422Empty body, or a field explicitly set to null

Delete contact rule DELETE

DELETE /identities/{agent_handle}/contact-rules/{rule_id}

Delete a rule. Requires an admin API key, or manage rules from the Inkbox Console.

Path parameters

ParameterTypeDescription
agent_handlestringThe identity's handle
rule_idUUIDRule ID

Response (204)

No content.

Error responses

StatusDescription
403Caller is not admin-scoped
404Rule not found, or it belongs to a different identity

List org iMessage contact rules GET

GET /contact-rules

Org-wide aggregate list of iMessage contact rules across every identity. Requires an admin API key, or browse rules in the Inkbox Console.

Query parameters

ParameterTypeDefaultDescription
agent_identity_idUUIDNarrow to one identity by ID
actionstringFilter by "allow" or "block"
match_typestringFilter by match type ("exact_number" is the only value in v1)
limitinteger501–200
offsetinteger0Offset for pagination

Response (200)

Returns a list[ContactRule] ordered newest first.

Code examples


Contact rule object

FieldTypeDescription
idstring (UUID)Rule ID
agent_identity_idstring (UUID)The identity this rule protects
actionstring"allow" or "block"
match_typestring"exact_number" (the only value in v1)
match_targetstringThe matched phone number in E.164 format
statusstring"active" or "paused"
created_atstring (ISO 8601)Creation timestamp
updated_atstring (ISO 8601)Last update timestamp

Additional resources

Inkbox

Copyright © 2026 Inkbox

This site is protected by reCAPTCHA.

Google Privacy Policy and Terms of Service apply.

Website

Inkbox

Copyright © 2026 Inkbox

This site is protected by reCAPTCHA.

Google Privacy Policy and Terms of Service apply.

Website

Y CombinatorBacked by Y Combinator
iMessage Contact Rules