Errors
Velstack uses conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, an SMS failed to send, etc.). Codes in the 5xx range indicate an error with Velstack's servers (these are rare).
HTTP codes
Whenever a request is unsuccessful, the Velstack API will return an error response with false status and message. You can use this information to understand better what has gone wrong and how to fix it. Most of the error messages are pretty helpful and actionable.
Here is a list of errors supported by the Velstack API — use these to understand what you have done wrong.
- Name
200- Type
- Description
Request was successful. Note that we will always respond with 200 if an SMS send or verify request was made. Do check the data object to know how the request went (i.e. successful or failed).
- Name
201- Type
- Description
Request went through and resource has successfully been created.
- Name
202- Type
- Description
Request has been accepted for further processing by Velstack.
- Name
400- Type
- Description
Bad request. No proper response was returned by the Velstack API and the request was not fulfilled.
- Name
401- Type
- Description
The request was not authorized. This occurs when a valid API_KEY is not included in the Authorization header. Additionally, this status will be returned if you are using the incorrect key. For example, attempting to access a backend endpoint with your PUBLIC_KEY will fail, as backend endpoints require a SECRET_KEY. In this documentation, we will specify the required API_KEY for each endpoint.
- Name
422- Type
- Description
Unprocessable contents. A validation or required parameter error from client side occurred and the request was not fulfilled.
- Name
404- Type
- Description
Resource not found or does not exist.
- Name
5xx- Type
- Description
There was an error from Velstack's end and the request failed. This is rare so please report as soon as you encounter any instance of this.
Response sample
<span><span style="color: var(--shiki-color-text)">{</span></span> <span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">"status"</span><span style="color: var(--shiki-color-text)">: false,</span></span> <span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">"message"</span><span style="color: var(--shiki-color-text)">: </span><span style="color: var(--shiki-token-string-expression)">"Bad request parameters"</span><span style="color: var(--shiki-color-text)">,</span></span> <span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">"errors"</span><span style="color: var(--shiki-color-text)">: {</span></span> <span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">"name"</span><span style="color: var(--shiki-color-text)">: [</span></span> <span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">"Please provide the customer name."</span></span> <span><span style="color: var(--shiki-color-text)"> ]</span></span> <span><span style="color: var(--shiki-color-text)"> }</span></span> <span><span style="color: var(--shiki-color-text)">}</span></span> <span></span>