Skip to content

Complete workflows with the Phonekit API

The API owns authorization, entitlements, provisioning and durable delivery. Your caller owns SMS polling, matching, deadlines and cancellation. The SDK wraps these same HTTP operations.

Phonekit team Updated

Authenticate deliberately

Create a credential in Settings → Automation. Select permissions and exact line grants separately for messages and management. Existing credentials retain messages:read only. Sending needs messages:send, which no other permission implies, and it applies only to the lines you select for the credential: there is no workspace-wide send scope. No credential administration API is required.

Send Authorization: Bearer $PHONEKIT_API_KEY over HTTPS. GET /api/v1/me returns the organization, connection identity, permissions, readable numbers and managedNumberIds. A number visible to a person is not automatically readable through a credential.

Download the OpenAPI specification for complete request and response schemas.

Discover before acting

Method and pathPurpose
GET /api/v1/meConnection identity, permissions and explicit scopes
GET /api/v1/number-typesSupported types and receive/voice capabilities; sendSms stays false because sending is limited to the closed loop below
GET /api/v1/allowancePlan, usage and remaining capacity; requires numbers:manage
GET /api/v1/numbersReadable lines
GET /api/v1/numbers/{numberRef}Exact authorized line metadata and readiness
GET /api/v1/membersEligible member IDs/names/roles for assignment/sharing; requires numbers:manage
GET /api/v1/inventory?areaCode=415Supported available lines; requires numbers:manage

Starter, Team and Scale include programmatic surfaces, authorized number management and webhooks, with 30-day default message retention. Each plan sets its included Standard/Mobile numbers, members, separate monthly SMS pools and overage rates. Workspace overrides replace plan defaults; purchased number additions extend capacity and the matching SMS pool. Membership limits apply to people who have joined, including owners and administrators. API keys and agents do not consume member places. subscription reports USD customer fees and monthly SMS capacity. sms reports the billing-period boundaries, per-class usage and estimated overage; exceeding the pool does not block delivery. Mobile capacity is reported as mobileNumbers. Supplier-cost limits are separate provisioning controls; nullable supplier-cost fields do not mean customer pricing is free.

Use number-type capabilities and inventory to choose a supported number for the workflow. Number acceptance by a target service is not guaranteed. readiness.canReceive requires active status; local fixtures are identified as simulated.

Acquire, configure and release

POST /api/v1/numbers requires numbers:manage, a UUID requestId (or matching Idempotency-Key header), explicit sharing, memberIds, and grantReadAccess choice:

Acquire a selected supported lineJSON
{
  "requestId": "90af27b0-275b-4c82-9f10-69d55f61203d",
  "phoneNumber": "+14155550101",
  "label": "QA account",
  "sharing": "restricted",
  "memberIds": [],
  "grantReadAccess": true,
  "purpose": "Invitation acceptance"
}

Acquisition picks a Standard number from inventory. Mobile numbers, which the carrier assigns when the line activates, are claimed in the web app; once claimed they appear here like any other number.

Save the UUID before sending. Retry with the same UUID and identical input; a changed body returns idempotency_conflict. A successful response contains operationId, numberId and statusUrl. It records an acquisition; it does not claim activation has completed. GET /api/v1/operations/{operationId} returns pending/completed/failed status, readiness and retry timing. POST /api/v1/numbers/{numberRef}/recheck reconciles a pending acquisition without repurchasing.

Capacity is reserved atomically for pending purchases. Ambiguous provider outcomes keep their reservation until reconciled. Optional maxSetupCostMinor and maxMonthlyCostMinor are explicit price ceilings; an unavailable quote cannot satisfy a ceiling.

PATCH /api/v1/numbers/{numberRef} accepts label, purpose, assignedToUserId, or access: {sharing, memberIds}. Assignment is metadata; sharing governs human access. Owners and admins retain access. Management grants do not grant message reads.

DELETE /api/v1/numbers/{numberRef} saves an authorized release intent for an active selected line and starts releasing it in the background. It returns {ok:true,numberId,status} where status is release_pending (or released if it already was). On a Mobile number it records a release request that Phonekit support completes; the number keeps receiving and keeps its capacity until then. Follow GET /api/v1/numbers/{numberRef} for release.status, release.requestedAt and a safe retry detail. A pending release retains capacity until the provider confirms it. Phonekit retries durable intent even if the original connection is subsequently revoked. Retained messages keep their original receipt-based expiry. New write requests still check current permissions and creator membership.

Read fresh receipts immediately

Mark before your application requests SMS:

Capture a position, then trigger the application's SMS requestShell
curl --silent --show-error --fail-with-body \
  --header "Authorization: Bearer ${PHONEKIT_API_KEY}" \
  "https://www.phonekit.io/api/v1/numbers/${PHONEKIT_NUMBER_ID}/cursor"

Then call GET /api/v1/numbers/{numberRef}/messages/after?after={cursor}&limit=25. Reads return promptly in ascending receipt order:

Empty immediate resultJSON
{"data": [], "cursor": "c_djE6MTAw", "hasMore": false}

Nonempty data contains messages with id, numberId, sender, body, otp, links and receivedAt. The cursor advances past the last returned receipt; an empty read leaves it unchanged. hasMore indicates another page existed at read time. Limits are 1–100. Preserve opaque cursors unchanged.

The caller decides matching, interval, deadline, cancellation, resends and parallel work. Inspect unrelated receipts deliberately and save progress. SDK/CLI convenience waits repeat immediate reads locally. MCP tools return promptly. Phonekit has no customer wait sessions, concurrency packaging or test scheduler. Normal API rate limits are operational controls.

Send inside your closed loop

A credential with messages:send can text from a line selected for it to four kinds of destination, and no others:

Destination (toKind)Who it isNeeds adding?
numberAnother active number in the same workspaceNo
memberA current member's own phone, verified in their account for forwarded codesNo
contactA number that texted one of the workspace's numbers in the last 30 daysNo
productAn outside number the workspace added itself, such as its product's SMS lineYes, up to five numbers

Everything else is refused with 403 destination_not_allowed, including another workspace's Phonekit number, whatever list it is on. This is for testing your own SMS flows end to end, such as sending from one number and reading what another received. It is not a messaging service.

Outside numbers are not verified. Phonekit does not check that an added number is yours or that its owner expects your texts; that is your responsibility. The guardrail is the cap described below, the sending limits, and STOP.

Method and pathPurpose
POST /api/v1/sent-messagesSend one text; requires messages:send
GET /api/v1/sent-messages/{messageId}One sent text with its status and timestamps
GET /api/v1/sent-messages?numberId=…&limit=25Sent texts, newest first, as {data,nextCursor}
GET /api/v1/product-numbersAdded outside numbers and how many places are used
POST /api/v1/product-numbersAdd an outside number; it can be texted at once
DELETE /api/v1/product-numbers/{productNumberRef}Remove an outside number by ID or E.164 phone number

Outside-number operations require messages:send and a credential whose creator is currently an owner or admin. Reading sent texts accepts messages:send or messages:read on the sending line.

Members and numbers that texted first

These two need no setup and use none of the workspace's places. A member's phone counts while they are a member and the phone is verified in their account. A number that texts any of the workspace's numbers can be texted back for 30 days after its most recent text; each new text restarts the 30 days. Only senders that are US or Canadian phone numbers count, however the carrier writes them ((415) 555-0142, +1 415 555 0142). Short codes and named senders never do.

Add an outside number

POST /api/v1/product-numbers with {"phoneNumber": "+14155550142", "label": "Staging sender"} adds the number. There is no confirmation step: the next request can text it. The response, like the list, reports the workspace's places:

Adding an outside numberJSON
{
  "data": {
    "id": "pn_3Kd…",
    "phoneNumber": "+14155550142",
    "label": "Staging sender",
    "createdAt": "2026-11-10T15:00:00.120Z",
    "optedOut": false,
    "optedOutAt": null
  },
  "slots": { "limit": 5, "used": 1, "available": 4, "nextFreeAt": null }
}

A workspace has five places unless Phonekit has raised its limit. Removing a number stops texts to it immediately, including any already queued, but its place stays used for 30 days: the response gives slotFreesAt, and slots.nextFreeAt shows when the next held place comes back. A sixth number is refused with 409 product_number_limit until then. The same number can be added back into its own place at any time. Adding a number that is already listed changes nothing. Phonekit numbers cannot be added. A number that has opted out can be added, and the response shows optedOut: true, but it still cannot be texted.

Send and follow a text

POST /api/v1/sent-messagesJSON
{
  "from": "+14155550101",
  "to": "+14155550102",
  "body": "Hello from the loop",
  "requestId": "6f0c1c0e-6c1f-4f0a-9a57-0d7c1f6f2a11"
}

from is a selected line's ID or E.164 number. to is one US or Canadian number in E.164 form. body is plain text up to three SMS segments (459 standard characters, or 201 with emoji); longer text is refused rather than trimmed. There are no group texts, MMS or RCS. Save requestId (or send the same UUID as Idempotency-Key) and reuse it on a retry: the retry returns the first send, and the same UUID with a different message returns idempotency_conflict.

The response is the sent text:

A sent text, later read backJSON
{
  "data": {
    "id": "msg_4QK2…",
    "numberId": "num_7R1…",
    "from": "+14155550101",
    "sentFrom": "+14155550101",
    "to": "+14155550102",
    "toKind": "number",
    "body": "Hello from the loop",
    "segments": 1,
    "status": "received",
    "failure": null,
    "queuedAt": "2026-11-10T15:00:00.120Z",
    "sentAt": "2026-11-10T15:00:02.480Z",
    "receivedAt": "2026-11-10T15:00:06.910Z",
    "receivedMessageId": "msg_9XB…",
    "latencyMs": 6790
  }
}
StatusMeaning
queuedAccepted and waiting its turn; texts carrying verification codes go first
retryingA temporary failure; Phonekit will try again
sentThe carrier line accepted the text. This is not proof the destination received it
unconfirmedThe line may have accepted it, but did not confirm. It is not sent again automatically
receivedIt arrived on one of your own numbers; receivedAt, receivedMessageId and latencyMs are set
failedNot sent; failure says why

received is only ever reported for a text to one of your own numbers, where Phonekit sees the arrival. It is matched by sending line, destination and exact text, so a carrier that alters the text leaves the status at sent; read the destination number's messages for the authoritative receipt. A text to any other destination stops at sent: confirm it where it was meant to arrive. latencyMs runs from acceptance to arrival and includes time spent queued, so compare queuedAt, sentAt and receivedAt to separate Phonekit's queue from the carrier.

The received copy is an ordinary message on the destination number: it appears in GET /api/v1/messages and messages/after for that number, with the sending line as sender. Sent texts never appear in those streams, so a cursor wait on the sending number is not satisfied by your own text.

What Phonekit checks, and when

Texts leave from real Mobile lines. A Mobile number sends from itself; a Standard number sends from the Mobile line chosen for it in the web app and is refused with sending_line_required until one is chosen. sentFrom is the line the recipient sees, and replies arrive on that line. A text is never sent from a number that is not yours, and never from Phonekit's own shared line.

Every check runs when the text is accepted and again just before it is sent. If, in between, the outside number is removed, the member leaves, the 30 days since a contact's last text run out, the destination replies STOP, either number starts being released, the Standard number's line changes, or the credential is revoked or loses the line, the text is not sent and reads failed with failure: "no_longer_eligible". A line that is off the network or at its daily limit gives line_unavailable. A text still unsent after ten minutes is dropped rather than delivered late.

STOP belongs to the person who sent it. A number that replies STOP, END, CANCEL, QUIT or UNSUBSCRIBE to a Phonekit Mobile line cannot be texted by any workspace, whichever of the four kinds it is. A workspace cannot undo that, and removing and re-adding the number changes nothing; only that phone texting START restores it. A keyword counts only when it is the whole message, ignoring case, surrounding spaces and closing punctuation: STOP, stop and Stop. opt out, while “STOP texting me”, “please stop”, “Stop sign reminder set for 5pm” and “End of day: you have 2 reminders left” are ordinary replies that arrive in the inbox. START and HELP are read the same way.

An opt-out is visible to the workspaces that can text the number, and to no one else. GET /api/v1/product-numbers returns optedOut and optedOutAt for each listed number, the web app shows “Opted out” with the date in the outside-numbers list and in that number's conversation, and workspace history records one entry when a number in the loop opts out and one when it opts back in, naming only its last four digits. Sends to it keep failing with 409 destination_opted_out. For a number outside your loop the refusal is destination_not_allowed, so nothing is revealed about numbers you have no relationship with.

Phonekit treats an identical text arriving on the same Mobile number from the same sender within three minutes as a duplicate delivery. When you send the same words twice to one of your own numbers, vary the text (a counter is enough) or the second copy will not appear and will stay at sent.

LimitValue
Per sending number10 a minute, 100 a day
Per destination10 a minute
Per workspace30 a minute, 200 a day
Per Mobile line, accepted sends100 a day
Outside numbers per workspace5, held 30 days after removal

Over a per-minute limit the response is 429 with Retry-After; over a daily limit it is 429 daily_send_limit. A refused destination does not count against any limit. Each accepted segment counts against the workspace's Mobile SMS pool, as does the copy received on a Mobile number, and both appear in GET /api/v1/allowance.

Sent texts are encrypted at rest and follow the workspace's message retention, counted from when they were accepted. Deleting a queued sent text in the web app cancels it.

Retained messages and selected subscriptions

GET /api/v1/messages?numberId=…&limit=10&cursor=… returns newest-first retained pages {data,nextCursor}. GET /api/v1/messages/{messageId} reads the exact retained receipt, including the ID from a webhook event. Scope and retention apply equally to full content and OTP extraction.

Method and pathPermission
GET /api/v1/webhooks and GET /api/v1/webhooks/{id}webhooks:manage
POST /api/v1/webhooks with {url,numberIds}webhooks:manage
PATCH /api/v1/webhooks/{id} with URL or replacement number IDswebhooks:manage
DELETE /api/v1/webhooks/{id}webhooks:manage
GET /api/v1/deliveries and GET /api/v1/deliveries/{id}diagnostics:read
POST /api/v1/deliveries/{id}/retrywebhooks:manage

Subscribe explicit management-scoped line IDs to a public HTTPS endpoint. Creation returns the signing secret once. A subscription must be wholly within the connection's selected scope. Legacy subscriptions need an explicit line selection before delivery resumes.

Events use stable IDs and may duplicate. Deduplicate durably; read exact message IDs, and recover gaps with saved inbox cursors. Diagnostics expose sanitized attempt status/categories and retry timing. They omit message text, credentials and destination response bodies. See webhook verification.

Distinguish failures

Errors contain code, safe message, requestId, and applicable retryAfterSeconds. Responses include X-Request-Id; rate-limit responses use Retry-After. No result is evidence that the target service accepted a verification code.

FailureMeaning
401Missing, expired or revoked authentication
403 / permission_requiredExplicit permission or current membership is missing
404Resource outside scope or retention
409 / allowance_exhaustedActive and pending acquisitions consume the line allowance
409 / claim_limit_reachedNew Standard numbers this billing period reached twice the slots
409 / idempotency_conflictSame UUID with a different acquisition body
409 / pricing_unavailableAn explicit spend ceiling cannot be evaluated
403 / destination_not_allowedThe destination is outside the workspace's closed loop
409 / product_number_limitEvery place for outside numbers is used or held
409 / destination_opted_outThe destination replied STOP to Phonekit
409 / sending_line_requiredThe Standard number has no Mobile line chosen to send from
429 / daily_send_limitThe sending number or workspace reached its daily cap
429Operational rate limit; honor retry timing
5xxService failure; bounded retries for safe/idempotent operations

An empty immediate read is successful. SDK timeout, no_match, missing_otp/extraction_failed, ambiguous and cancelled describe caller-side outcomes. Keep message contents and bearer credentials out of shared logs.