Skip to content
Last updated

Sinch uses conventional HTTP codes to indicate the success or failure of an API request.

Generally, a 2xx code indicates success. Codes in the 4xx range indicate an error that failed because of information you provided in the request (authentication failed, a required field was missing, or some other parameter was invalid are all examples). Codes in the 5xx range are rare errors on the Sinch servers that you as a developer usually can't do anything about.

In addition to the standard HTTP codes, we provide a Message field to help you understand in plain text what went wrong.

codeinteger(int32)read-only

HTTP status code or error code

Example: 400
statusstringread-only

Response status name.

Example: "INVALID_ARGUMENT"
messagestringread-only

A developer-facing error message

Example: "Bad request."
detailsArray of objects(ErrorDetail)read-only

Details of the errors

HTTP Codes

The Sinch API can throw the following HTTP codes:

2xx - Success

Any 2xx response is considered a successful response. Response bodies will differ depending on the request.

400 - BadRequest

400 errors generally concern the construction or format of the request you submitted. For example, missing required parameters or the using the wrong parameter in a request. The following examples all show different types of 400 errors:

HTTP CodeStatusMessage
400BAD_REQUEST"The provided domain name is unavailable"
400BAD_REQUEST"The provided username is unavailable"
400BAD_REQUEST"Customer with id '$id' already exists"
400BAD_REQUEST"Phone Number '$phoneNumber' already exists"
400BAD_REQUEST"Project with id '$id' is not enabled"
400BAD_REQUEST"Project with id '$id' already exists"
400BAD_REQUEST"$parent cannot be deleted while there are one or more ${child}s attached"
400BAD_REQUEST"$child cannot be deleted while attached to a $parent"
400BAD_REQUEST"Invalid timestamp format, must match $CALL_RECORD_TIME_STAMP_FORMAT"
400BAD_REQUEST"Access control list with id '$aclId' is already added to trunk '$trunkId'"
400BAD_REQUEST"Credential list with id '$clId' is already added to trunk '$trunkId'"
400BAD_REQUEST"Access Control Lists must contain at least one IP Range"
400BAD_REQUEST"Credential Lists must contain at least one Credential"
400BAD_REQUEST"Cannot delete SIP Trunk $trunkId when there are phone numbers assigned."
400BAD_REQUEST"Credential '$username' is already being used by a SIP Endpoint on SIP Trunk '$trunkId'"
400BAD_REQUEST"Phone number $number is already assigned to SIP Trunk $trunkId"
400BAD_REQUEST"Blocking rule already exists with the same parameters"
400BAD_REQUEST"Invalid $fieldName: $countryCode. Must be a valid ISO 3166-1 alpha-2 code."
400BAD_REQUEST"Invalid direction type: $direction. Must be INBOUND or OUTBOUND."
400BAD_REQUEST"Direction field cannot be null or empty"

403 - Forbidden

HTTP CodeStatusMessage
403FORBIDDEN

404 - NotFound

404 errors are thrown when the specified resource can't be found. The following examples all show different types of 404 errors:

HTTP CodeStatusMessage
404NOT_FOUND"Could not find SIP Trunk with id '$id'"
404NOT_FOUND"Could not find SIP Trunk with domain '$domain'"
404NOT_FOUND"Could not find SIP Endpoint with id '$id'"
404NOT_FOUND"Could not find phone number with id '$id'"
404NOT_FOUND"Could not find phone number '$number'"
404NOT_FOUND"Could not find Customer with id '$id'"
404NOT_FOUND"Could not find Project with id '$id'"
404NOT_FOUND"Could not find project config with key '$key'"
404NOT_FOUND"Could not find Access Control List with id '$id'"
404NOT_FOUND"Could not find IP Range with id '$id' in access control list with id '$aclId'"
404NOT_FOUND"Access control list '$aclId' is not associated with trunk '$trunk'"
404NOT_FOUND"Could not find Credential List with id '$id'"
404NOT_FOUND"Could not find Credential with username '$username'"
404NOT_FOUND"Could not find call ID '$callId'"
404NOT_FOUND"BlockingRule with ID $id not found for project $projectId"
404NOT_FOUND"Export '$key' could not be found. Check this is the correct key name, if so, it may still be processing."

500 - Internal Server Error

500 errors are general server errors that are temporary and you usually can't do anything about. Try the request a little later or contact support if you receive this error repeatedly after a period of time.

HTTP CodeStatusMessage
500INTERNAL_SERVER_ERROR"Internal Server Error"