# Errors 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. ## 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 Code | Status | Message | | --- | --- | --- | | 400 | BAD_REQUEST | "The provided domain name is unavailable" | | 400 | BAD_REQUEST | "The provided username is unavailable" | | 400 | BAD_REQUEST | "Customer with id '$id' already exists" | | 400 | BAD_REQUEST | "Phone Number '$phoneNumber' already exists" | | 400 | BAD_REQUEST | "Project with id '$id' is not enabled" | | 400 | BAD_REQUEST | "Project with id '$id' already exists" | | 400 | BAD_REQUEST | "$parent cannot be deleted while there are one or more ${child}s attached" | | 400 | BAD_REQUEST | "$child cannot be deleted while attached to a $parent" | | 400 | BAD_REQUEST | "Invalid timestamp format, must match $CALL_RECORD_TIME_STAMP_FORMAT" | | 400 | BAD_REQUEST | "Access control list with id '$aclId' is already added to trunk '$trunkId'" | | 400 | BAD_REQUEST | "Credential list with id '$clId' is already added to trunk '$trunkId'" | | 400 | BAD_REQUEST | "Access Control Lists must contain at least one IP Range" | | 400 | BAD_REQUEST | "Credential Lists must contain at least one Credential" | | 400 | BAD_REQUEST | "Cannot delete SIP Trunk $trunkId when there are phone numbers assigned." | | 400 | BAD_REQUEST | "Credential '$username' is already being used by a SIP Endpoint on SIP Trunk '$trunkId'" | | 400 | BAD_REQUEST | "Phone number $number is already assigned to SIP Trunk $trunkId" | | 400 | BAD_REQUEST | "Blocking rule already exists with the same parameters" | | 400 | BAD_REQUEST | "Invalid $fieldName: $countryCode. Must be a valid ISO 3166-1 alpha-2 code." | | 400 | BAD_REQUEST | "Invalid direction type: $direction. Must be INBOUND or OUTBOUND." | | 400 | BAD_REQUEST | "Direction field cannot be null or empty" | ### 403 - Forbidden | HTTP Code | Status | Message | | --- | --- | --- | | 403 | FORBIDDEN | ### 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 Code | Status | Message | | --- | --- | --- | | 404 | NOT_FOUND | "Could not find SIP Trunk with id '$id'" | | 404 | NOT_FOUND | "Could not find SIP Trunk with domain '$domain'" | | 404 | NOT_FOUND | "Could not find SIP Endpoint with id '$id'" | | 404 | NOT_FOUND | "Could not find phone number with id '$id'" | | 404 | NOT_FOUND | "Could not find phone number '$number'" | | 404 | NOT_FOUND | "Could not find Customer with id '$id'" | | 404 | NOT_FOUND | "Could not find Project with id '$id'" | | 404 | NOT_FOUND | "Could not find project config with key '$key'" | | 404 | NOT_FOUND | "Could not find Access Control List with id '$id'" | | 404 | NOT_FOUND | "Could not find IP Range with id '$id' in access control list with id '$aclId'" | | 404 | NOT_FOUND | "Access control list '$aclId' is not associated with trunk '$trunk'" | | 404 | NOT_FOUND | "Could not find Credential List with id '$id'" | | 404 | NOT_FOUND | "Could not find Credential with username '$username'" | | 404 | NOT_FOUND | "Could not find call ID '$callId'" | | 404 | NOT_FOUND | "BlockingRule with ID $id not found for project $projectId" | | 404 | NOT_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 Code | Status | Message | | --- | --- | --- | | 500 | INTERNAL_SERVER_ERROR | "Internal Server Error" |