Errors
Every Phone.inc API error has a JSON body and a meaningful HTTP status code. Most failures fall into a small handful of categories — bad input, missing or invalid auth, or a resource that doesn't exist. Use the status code to decide how to react and the body to figure out what to fix.
Status codes
- Name
200 OK- Description
The request succeeded. The body contains the resource.
- Name
400 Bad Request- Description
A required parameter is missing or malformed.
- Name
401 Unauthorized- Description
The credential is missing, malformed, expired, or revoked. For API keys, fix the key. For OAuth tokens, refresh and retry.
- Name
403 Forbidden- Description
The credential is valid but doesn't grant access to the requested resource.
- Name
404 Not Found- Description
The resource doesn't exist, or it belongs to a different company than the authenticated credential.
- Name
409 Conflict- Description
An idempotency key was reused with different SMS input, a text is not safe to retry, or an employee changed or was deleted during an update. Inspect the persisted message or retrieve the employee again before retrying.
- Name
422 Unprocessable Entity- Description
The request was well-formed but failed validation. The body lists every field-level problem.
- Name
429 Too Many Requests- Description
Rate limit hit. Look at
Retry-Afterfor how long to wait before retrying.
- Name
5xx Server Error- Description
Something broke on our side. Retry reads with exponential backoff. For SMS sends, reuse the same idempotency key and inspect the message: acceptance may be unknown, so a new key could send a duplicate. If it persists, email support@phone.inc.
Error response shapes
Single-message errors use an error key — most 400/401/403/404/429 responses look like this:
Single error
{
"error": "Voicemail not found"
}
Validation errors (422) return an errors object keyed by field, mirroring the request body:
Validation errors
{
"errors": {
"listened": ["must be a boolean"]
}
}
OAuth endpoints (/oauth/token, /oauth/authorize, /oauth/revoke) follow the OAuth 2.0 spec and use a different shape — see OAuth 2.0 for partners for those.
Authentication errors
A 401 Unauthorized from /api/v1/* always means the credential is the problem. The reason depends on whether you sent an API key or an OAuth bearer token.
API keys
Tokens that start with phk_ are looked up as API keys. If the lookup fails — wrong token, revoked key, typo — you get:
401 Invalid API key
{
"error": "Invalid API key"
}
There is no expiry on API keys. A 401 means the key doesn't exist on our side, full stop. Don't retry — fix the key. Generate a new one at app.phone.inc/api_keys if needed.
OAuth bearer tokens
Tokens without the phk_ prefix are validated as OAuth access tokens. The response includes a WWW-Authenticate header with the specific reason:
WWW-Authenticate: Bearer realm="Doorkeeper", error="invalid_token", error_description="The access token expired"
Common reasons:
- Name
invalid_token- Description
The token doesn't exist or was malformed.
- Name
expired_token- Description
The token expired (access tokens last 1 hour). Use your refresh token to mint a new one.
- Name
revoked_token- Description
The token was revoked — either by your app calling
/oauth/revokeor by an admin. The user has to re-authorize.
The right move is almost always: refresh the token and retry the request once. If the refresh itself fails, send the user back through the authorization flow.
Partner installations and permissions
A partner token also needs an active installation whose current application and customer permissions cover the token. Otherwise /api/v1/* returns:
401 Disconnected application
{
"error": "Application is disconnected"
}
Start a fresh authorization flow rather than repeatedly refreshing or retrying a disconnected installation.
An active installation with a token missing an endpoint's required permissions receives 403 Forbidden. The body includes error: "insufficient_scope" and a required_scopes array. For example, a read-only company token attempting to update company details receives:
403 Insufficient permissions
{
"error": "insufficient_scope",
"required_scopes": ["company:write", "company:read"]
}
The response also includes the required scopes as a space-separated Bearer challenge:
WWW-Authenticate: Bearer error="insufficient_scope", scope="company:write company:read"
Enable the required scopes in your application. Then ask the customer to grant fresh consent and exchange a new authorization code. Refresh cannot expand the old token's permissions. An action unavailable to partner tokens returns the same error with an empty required_scopes array and scope=""; requesting more permissions does not enable that action.
Rate limits
Company-owned OAuth applications share fixed one-minute budgets across all tokens and MCP requests: 600 requests per application, with 120 per application/customer company. MCP's internal REST dispatch does not consume a second request. Caller-context previews and synthetic webhook tests share a separate budget of 30 per application, with 5 per application/customer company, including tests started from the dashboard or through an API key. Regular API keys and first-party clients do not consume the partner API budget. Other limits still apply.
Exceeding either partner budget returns 429, { "error": "Application rate limit exceeded. Retry after the indicated delay." }, and a Retry-After header with the seconds until the next minute. Honour the delay; changing tokens does not reset the budget.
The public API limits SMS sending and protects against credential-stuffing on /api/v1/*. After 10 invalid-key attempts from the same IP within 60 seconds, that IP is blocked for 60 seconds. Clients sharing a public IP address share this limit. Supplying forwarding headers does not let a client choose a different rate-limit identity. Subsequent requests get:
429 Too Many Requests
{
"error": "Too many failed API key attempts. Wait a moment and try again."
}
The response includes a Retry-After: 60 header. Honour it. Valid keys are not throttled here — only failed lookups count toward the budget. If you're hitting this in production, your code is probably sending the wrong token; double-check what's in the X-Api-Key header before retrying.
SMS send limits
New SMS sends, explicit retries, and auto-replies share a limit of 30 send attempts per business number in a rolling minute. Safe replays of an existing idempotency key do not consume another attempt. Requests over that limit return 429, Retry-After: 60, and { "error": "At most 30 message send attempts per business number per minute" }.
Common mistakes
A few patterns trip up most integrators on day one:
- Forgot the
X-Api-Keyheader. Empty header =401. Make sure your HTTP client is actually attaching the key. - Pasted a key with surrounding whitespace. Some shells add a trailing newline when copying. Strip whitespace before sending.
- Using a non-E.164 phone number. Endpoints that accept a phone number (
/api/v1/calls?phone_number=,/api/v1/caller_context?phone=) expect E.164 format like+14155551234. Anything else is silently treated as no match. - Querying a resource that belongs to another company. API keys and OAuth tokens are scoped to a single company. A
404here doesn't mean the ID is wrong globally — just that it's not visible under this credential. - OAuth: ignoring
expires_in. Access tokens expire after 1 hour. Refresh proactively when there are fewer than ~5 minutes left, not on the first401.
Retrying
Retry reads after 5xx responses with exponential backoff (e.g. 1s, 2s, 4s, capped at 30s) and a small jitter. Do not blindly retry side-effecting requests. For SMS sends, reuse the original idempotency key and inspect the persisted message's status; a new key can send a duplicate, chargeable text. Only definitively failed texts support the explicit retry endpoint.
429 is retryable — wait at least the Retry-After value before retrying. Other 4xx responses need an input or credential fix before you try again.