# 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: #### 40001 A 40001 error is a parameter validation error. It means you have used the wrong method for the request. You can fix this by using the correct method. ```json 40001 Error { "errorCode": 40001, "message": "Invalid parameters: {result.Message}" } ``` #### 40002 A 40002 error is a missing parameter error. It means there is a missing required parameter in the request. This error generally contains the missing parameter in the error message. You can fix this by providing the missing parameter. ```json 40002 Error { "errorCode": 40002, "message": "Bad request: {result.Message}" // e.g.:"Bad request: TTS callout information missing" } ``` #### 40004 A 40004 error is an invalid authorization key error. It means the application key you are using for the request is invalid. ```json 40004 Error { "errorCode": 40004, "message": "Bad request: Application key is invalid" } ``` #### 40005 A 40005 error is a number missing leading plus error. It means that a phone number included in the request is not in the proper format and is missing the leading plus (`+`) sign. ```json 40005 Error { "errorCode": 40005, "message": "Bad request: Phone number missing leading plus (+)" } ``` ### 401 - Unauthorized 401 errors concern authorization and access. For example, if you do not provide valid credentials in your request. The following examples all show different types of 401 errors: #### 40100 A 40100 error is an authorization header error. It means the authorization header is missing, illegal, or invalid. You can fix this by providing a valid [authorization](/docs/voice/api-reference/authentication) header. ```json 40100 Error { "errorCode": 40100, "message": "Invalid authorization header." } ``` #### 40101 A 40101 error is a timestamp header error. It means that the `x-timestamp` header is invalid or missing. You can fix this by providing a valid [`x-timestamp`](/docs/voice/api-reference/authentication/signed-request#timestamp) header. ```json 40101 Error { "errorCode": 40101, "message": "X-Timestamp required." } ``` #### 40102 A 40102 error is an invalid signature error. It means that the signature in your signed request authentication is invalid or missing. You can fix this by providing a valid [signature](/docs/voice/api-reference/authentication/signed-request) in your signed request. ```json 40102 Error { "errorCode": 40102, "message": "Invalid signature." } ``` ### 402 - PaymentRequired 402 errors concern payment or credit. For example, if your does not have the necessary credit to perform the action. The following example shows a 402 error: #### 40200 A 40200 error is an insufficient credit error. It means that your account does not have sufficient credit to make the request. You can fix this by adding more credit to your account. ```json 40200 Error { "errorCode": 40200, "message": "Not enough credit." } ``` ### 403 - Forbidden 403 errors concern lack of permission. For example, if you as a user do not have the necessary privileges or permissions to perform the action. The following examples all show different types of 403 errors: #### 40300 The 40300 error indicates a forbidden request. The Voice API may return this error in various situations, including: - The specified resource is not available for the requested destination, - The destination number has been blacklisted by internal fraud detection systems. These errors cannot be resolved by the user. If a 40300 error is encountered, please contact support for assistance. ```json 40300 Error { "errorCode": 40300, "message": "result.Message //(result.Result == ServiceReply.Forbidden)" } ``` ### 404 - NotFound 404 errors concern missing resources. For example, if the requested resource can't be found. The following example shows a 404 error: #### 40400 This error can be returned in various circumstances, including: - Attempting to perform actions such as reporting or checking the status of a verification that was not initiated (similar to the 40003 error), - Calling these endpoints with partially invalid parameters (e.g., querying a status endpoint with a correct identity but an incorrect verification method), - Querying various endpoints, such as those related to price lists, using incorrect parameters. ```json 40400 Error { "errorCode": 40400, "message": "Requested resource was not found." } ``` ### 409 - Conflict #### 40900 This error can be returned in one case: - Reference specified in the request is a duplicate ```json 40900 Error { "errorCode": 40900, "message": "Reference already defined." } ``` ### 420 - Unprocessable Entity 420 errors concern not being able to process the request resource due to various factors. The following examples all show different types of 420 errors: #### 42200 This error is related to misconfiguration of the Voice app in the [Build Dashboard](https://dashboard.sinch.com/voice/apps) ```json 42200 Error { "errorCode": 42200, "message": "Application name has not been configured." } ``` #### 42201 The 42201 error indicates that there is no available route to the destination number. Consequently, Sinch is unable to send SMS messages, initiate calls, or perform other actions targeting the specified destination due to internal routing issues. This condition is classified as an internal routing error and is typically permanent, meaning the failure will persist unless the underlying routing problem is resolved by Sinch's internal systems. ```json 42201 Error { "errorCode": 42201, "message": "No route to destination." } ``` #### 42202 A 42202 error is an invalid callback response error. If you receive this error it means that the response you're sending back to a callback event request is not a valid response. Look at the [Callback API](/docs/voice/api-reference/voice/callbacks) documentation for information about the valid responses for each callback event type. ### 429 - Too Many Requests 429 errors concern too many requests occurring within a specific period, either because of a technical limitation or account limitation. The following examples all show different types of 429 errors: #### 42900 This error occurs when rate limit is exceeded. It means that the number of requests sent to the API exceeds the allowed limit. ```json 42900 Error { "errorCode": 42900, "message": "Request capacity exceeded." } ``` ### 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. #### 50000 ```json 50000 Error { "errorCode": 50000, "message": "Internal server error." } ``` ### 503 - Service Unavailable 503 errors are unavailable service errors that are temporary and you usually can't do anything about. Try the request a little later or contact support if you receive these errors repeatedly after a period of time. #### 50300 This error means that service is temporarily down. Try again later. ```json 50300 Error { "errorCode": 50300, "message": "Service is temporarily unavailable, please try again later." } ``` #### 50301 This error means that there is a misconfiguration in the Sinch system related to your account. Contact support to resolve this issue. ```json 50301 Error { "errorCode": 50301, "message": "Configuration error, please contact support." } ``` ## Troubleshooting the Voice API When making phone calls with the Voice API there a few steps in the process to look first if you are experiencing errors: 1. If you code using a Sinch helper library (SDK), ensure the dependencies are available and referenced correctly. 2. Check that the HTTP request is authenticated correctly. 3. If making an outbound call, check if it rings on the phone. 4. Once the call is answered, check that you receive a request to the the callback URL you have specified. 5. Check that SVAML returned from the callback event is parsed and executed. Each of the above steps could have an issue, problems ranging from network outage to invalid SVAML. To help you pinpoint the problem here are a few pointers: ### The phone number I call never rings Below are a few things to check if the call never rings on the phone. 1. Check the number to make sure it's the right number and formatted the [correct way](https://community.sinch.com/t5/Glossary/E-164/ta-p/7537), including the `+` and country code. 2. Look at the error message you received. If you don't have access to those (maybe it's happening in production) try to make a [simple call](/docs/voice/api-reference/voice/callouts) to the phone number using the same application key and secret. ## Common errors - Balance is too low Solution: Add more money to your [account](https://dashboard.sinch.com). - Too many calls `IN_PROGRESS` Solution: Contact your account manager if you need to make more than 10 calls concurrently.