D Line API

REST and webhooks for calls, texts, voicemail and your workspace.

Errors

Errors use the HTTP status plus one JSON envelope. Branch on code, show message to people, and quote request_id (also in the DLine-Request-Id header) when you contact support. New codes may be added; handle an unknown code by its type.

{
  "error": {
    "type": "policy_error",
    "code": "recipient_opted_out",
    "message": "This number opted out of texts from your workspace.",
    "param": "to",
    "request_id": "req_01J9ZK3Q4T8N6V2B0C5D7E9F1G",
    "doc_url": "https://d-line.app/developers/errors#recipient_opted_out"
  }
}

Types

TypeStatusMeaning
invalid_request_error400, 404, 409, 410, 413, 422The request is malformed, refers to something that does not exist, or conflicts with its current state. Fix the request before retrying.
authentication_error401The API key is missing, malformed, revoked or expired.
permission_error403The key is valid but may not do this: a missing scope, a feature that is not enabled, or a blocked IP.
rate_limit_error429Too many requests. Wait for Retry-After seconds, then retry.
policy_error422A compliance rule refused the request (10DLC, opt-outs, quiet hours, fair use). Nothing was created or billed.
api_error5xxSomething failed on our side. Retry with backoff and the same Idempotency-Key.

Codes

CodeStatusTypeMeaning
unknown_parameter400invalid_request_errorThe body or query has a field the endpoint does not accept (often a typo). `param` names it.
invalid_parameter400invalid_request_errorA field has the wrong type or format, for example a number that is not E.164.
missing_parameter400invalid_request_errorA required field is missing.
invalid_cursor400invalid_request_errorThe pagination cursor is malformed, expired or from another workspace.
invalid_json400invalid_request_errorThe body is not valid UTF-8 JSON.
idempotency_key_required400invalid_request_errorThis endpoint needs an Idempotency-Key header.
invalid_recipient400invalid_request_errorThe `to` number is not a valid US or Canadian number, or is known not to receive texts.
test_number_required422invalid_request_errorTest keys can only send to the documented magic numbers.
resource_not_found404invalid_request_errorNo object with this id exists in the workspace.
recording_not_found404invalid_request_errorThe call has no recording.
transcript_not_found404invalid_request_errorThe call has no transcript. Request one with POST /calls/{id}/transcript.
summary_not_found404invalid_request_errorThe call has no AI summary.
from_number_not_owned404invalid_request_errorThe `from` number is not an active number of this workspace.
idempotency_key_reused409invalid_request_errorThe Idempotency-Key was already used with a different request body.
transcript_pending409invalid_request_errorThe transcript is still being processed. Wait for transcript.ready.
summary_pending409invalid_request_errorThe AI summary is still being processed. Wait for ai_summary.ready.
consumer_opt_out409invalid_request_errorThe contact opted out themselves (STOP or carrier). Only the contact can lift it by texting START.
replay_in_progress409invalid_request_errorA replay is already running for this endpoint.
recording_deleted410invalid_request_errorThe recording existed but retention removed the audio.
media_too_large413invalid_request_errorThe upload is over 5 MB, or the media cannot be shrunk to fit carrier limits.
endpoint_limit_reached422invalid_request_errorThe workspace already has 10 webhook endpoints.
invalid_webhook_url422invalid_request_errorThe webhook URL is not public HTTPS, or resolves to a private address.
text_too_long422invalid_request_errorThe text is over 1,600 characters.
too_many_media422invalid_request_errorMore than 10 media items.
media_fetch_failed422invalid_request_errorA `media_urls` entry could not be fetched (not public, timed out, or not a supported type).
invalid_api_key401authentication_errorThe Authorization header is missing or the key is not valid.
api_key_expired401authentication_errorThe key passed its expiry date. Create or roll a key in Settings > Developers.
api_key_revoked401authentication_errorThe key was revoked.
insufficient_scope403permission_errorThe key lacks the scope this endpoint needs. Roll the key with the extra scope.
ip_not_allowed403permission_errorThe request came from an IP outside the key's allow-list.
feature_not_enabled403permission_errorThe workspace plan does not include this feature.
test_mode_only403permission_errorThis endpoint only accepts test keys.
registration_required422policy_errorThe number has no approved 10DLC campaign yet.
registration_pending422policy_errorThe 10DLC campaign is still under carrier review.
number_not_assigned422policy_errorThe number is not attached to the workspace's 10DLC campaign.
not_sms_capable422policy_errorThe number cannot send texts.
billing_hold422policy_errorTexting is paused on the account (for example an unpaid invoice).
recipient_opted_out422policy_errorThe recipient is on the workspace opt-out list.
quiet_hours422policy_errorOutside the sending window in the recipient's local time. `next_allowed_at` says when to retry.
fair_use_exceeded422policy_errorThe workspace used its monthly SMS allowance plus the API buffer.
daily_cap_reached422policy_errorThe campaign's carrier daily cap or the workspace's own cap is used up.
content_blocked422policy_errorThe content was refused, for example a public URL shortener that carriers filter.
transcription_allowance_exceeded422policy_errorThe workspace has no transcription minutes left this period.
rate_limited429rate_limit_errorOver the request rate for the key or workspace. Honour Retry-After.
internal_error500api_errorAn unexpected error. Retry with backoff; quote the request id if it persists.
service_unavailable503api_errorA dependency is temporarily unavailable. Retry with backoff.