Skip to content

Errors and status codes

The API answers almost every request with HTTP 200, including failed ones. Check the success flag in the body:

{
"response": {
"success": "0",
"error": "Your token seems expired, please login again",
"tech_msg": "invalid_user"
}
}
Field Meaning
success 0 when the request failed
error Human-readable message. Safe to log; don’t show it to account holders.
tech_msg Machine-readable reason, on authentication errors
error1, error2, … One message per invalid field, on validation errors
tech_msg What happened What to do
invalid_user Unknown user, or the token is expired or wrong Log in again, then retry once
invalid_password Wrong password Check the credentials; don’t retry in a loop
inactive_user The user is disabled Ask your DCDial administrator

When fields are missing or invalid, the response lists one message per problem:

{ "response": { "success": 0, "error1": "<first problem>", "error2": "<second problem>" } }
Status Meaning
200 The request reached the API. Check success.
500 Unexpected server error. Safe to retry read-only requests after a short wait.
502, 503, 504 The API is temporarily unavailable. Check status.dcdial.com and retry with backoff.
import time, requests
def dcdial(fields, retries=3):
for attempt in range(retries):
r = requests.post("https://api.dcdial.com/api/", data=fields, timeout=30)
if r.status_code >= 500 and fields["type"].startswith("get"):
time.sleep(2 ** attempt)
continue
r.raise_for_status()
body = r.json()
data = body.get("response", body)
if str(data.get("success")) != "1":
raise RuntimeError(data.get("error") or data)
return data
raise RuntimeError("DCDial API unavailable")