Skip to content
DhvaneeDocs
Dashboard
On this page

Errors

Every status code the public API returns, the exact shapes of the detail field, and which failures are worth retrying.

A request that cannot be completed gets a non-2xx status and a JSON body with a single field, detail. Read the status first, then detail. detail comes in three shapes, depending on the kind of failure.

The machine-readable contract is openapi.public.yaml. Download it for clients and codegen. This site has no live Try-it console.

The three shapes of `detail`

ShapeUsed forExample
A stringMost failures: missing key, missing scope, not found, conflicts and rejected input.{"detail": "Contact not found"}
An object with code402 (plan limits), 429 (rate limits) and server-side failures. Branch on code, not on the text.{"detail": {"code": "rate_limit_key", "message": "Too many requests"}}
A list422 when the body, path or query does not match what the route expects. One entry per problem.{"detail": [{"type": "missing", "loc": ["body", "from"], "msg": "Field required"}]}

Each list entry names the problem with type, the place in the request with loc, and a readable msg. Entries can also carry the rejected value, so do not write raw error bodies to shared logs. Every response, success or failure, has an X-Request-Id header: quote it to support.

Example

curl -sS -X GET "https://api.stage.dhvanee.com/v1/contacts/00000000-0000-0000-0000-000000000000" \
  -H "Authorization: Bearer dhvanee_live_YOUR_KEY"
{"detail": "Contact not found"}

Status codes

StatusMeaningWhat to do
400The request is well formed but cannot be done as it stands, for example starting a campaign that has no recipients, publishing a flow agent whose canvas is invalid, a file the knowledge base rejects, or a malformed Idempotency-Key when starting an automation run.Change the request. Do not retry it unchanged.
401No key, an unusable key, or an unknown or revoked key. See Authentication.Check the key. Do not retry in a loop: repeated attempts with a wrong key are throttled.
402The plan has no allowance left for this action. detail.code says which. See Credits.Raise the allowance or wait for the next cycle; retrying does not help.
403The key is valid but not allowed: it lacks the scope, or a publishable key tried a write.Use a key with the scope the message names.
404Nothing with that id in this workspace. An id that belongs to another workspace also answers 404, so you cannot probe other workspaces.Check the id.
409A conflict with the current state, such as a phone number another contact already owns, or an Idempotency-Key reused with a different body.Fix the cause. Do not retry unchanged.
422Input that was understood but rejected: a missing or malformed field, a value out of range, or a rule such as an agent that is not published yet.Change the request.
428The Idempotency-Key header is missing on POST /v1/automations/{id}/runs.Add the header and send again.
429Too many requests. The Retry-After header says how many seconds to wait. See Rate limits.Wait, then retry.
5xxSomething failed on Dhvanee's side, including 503 when the rate-limit store is briefly unavailable.Retry with a short, growing delay. For a call or run use the same Idempotency-Key.

Messages you will see

These are the exact detail strings. Branch on the status code and, for objects, on code; treat the text as something to show or log.

Status`detail`When
401Valid API key is requiredNo key, wrong header form, or a value that is not a Dhvanee key.
401API key is invalid or revokedUnknown or revoked key, or a suspended workspace.
403API key needs contacts:write scopeThe key lacks that scope (the message names it).
403Publishable API keys cannot use this scopeA publishable key on a write or copilot:use route.
404Contact not found, Agent not found, Call not found, Campaign not found, Automation not found, Run not found, Document not found, Phone number not foundNo such record in this workspace.
404Not FoundThe path does not exist.
409A contact already owns that phone numberCreating or updating a contact to a phone number another contact has.
409Idempotency-Key was already used with a different requestThe same Idempotency-Key with a different body on a call, campaign start or automation create.
409Idempotency-Key was already used with a different payloadThe same key with a different payload when running an automation.
409Only an active automation with a Manual trigger can be run on demandRunning an automation that is not active or has no Manual trigger.
409Phone number already mapped to a workspaceImporting a number that is already in use.
422Give a valid phone or emailCreating or updating a contact without a usable phone or email.
422limit must be 1-200 and offset non-negativeA paging value out of range on contacts or calls.
422Idempotency-Key is requiredNo Idempotency-Key on a call, campaign start or automation create.
422Idempotency-Key must be 1-128 printable ASCII charactersA key that is empty, too long or has spaces or non-ASCII characters.
422Publish the agent before placing a callCalling with an agent that has never been published.
422Use a phone number this workspace already ownsA from number that is not yours.
422Give a valid phone numberA to number that cannot be read as a phone number.
428Idempotency-Key is requiredNo Idempotency-Key when running an automation.
429{"code": "rate_limit_key", "message": "Too many requests"}Over a limit. code is rate_limit_key, rate_limit_workspace, rate_limit_client or rate_limit_auth_fail.

Plan limits (402)

A 402 body is an object with only a code:

{"detail": {"code": "minutes_limit_reached"}}

The codes are minutes_limit_reached, wallet_empty, concurrent_limit_reached, outbound_disabled, workspace_inactive, kb_storage_limit_reached, automation_executions_limit_reached and copilot_credits_exhausted. Each is explained on Credits.

Server-side failures

When something goes wrong on our side the real cause is never put in the response. You get the same calm object, with a code of busy (or timeout for a 504) and an action of retry:

{"detail": {"code": "busy", "message": "We're seeing a lot of activity right now. Please try again in a moment.", "action": {"type": "retry"}}}

Retrying safely

  • Retry only 429, 503, 504 and other 5xx answers, and network timeouts. Wait for Retry-After when it is present, otherwise back off 1, 2, 4, 8 seconds with a little randomness.
  • Never retry unchanged a 400, 401, 402, 403, 404, 409, 422 or 428. The answer will be the same.
  • Use an `Idempotency-Key` wherever the API accepts one, so a retry after a timeout does not place a second call or start a second run. The same key and body within 24 hours returns the first response. For calls, campaign starts and automation creation, a request that failed is not remembered, so you can send it again with the same key.
  • Creating a contact has no `Idempotency-Key`. Retrying a create that had a phone number answers 409 instead of making a duplicate.
Errors · Dhvanee Docs