Response Codes and Data
When interacting with the HelloSMS API, it's important to understand how to interpret the responses you receive. This page presents the standard response codes and data structures you'll encounter, helping you effectively handle both successful operations and potential errors.
Response Codes
The HelloSMS API uses standard HTTP status codes to communicate the outcome of your requests. These codes provide immediate feedback about whether your request was successful, encountered an error, or requires additional action. Here are the common status codes you'll encounter:
| Status Code | Description |
|---|---|
| 200 OK | The request was successful and the expected data was returned. |
| 400 Bad Request | The request could not be processed due to invalid syntax or missing parameters. Check the statusText field in the response for specific details about the error. |
| 401 Not Authorized | Authentication failed. This happens when the username or password is wrong, or when the user is not an API user. The response body is {"status":"failed","statusText":"Invalid user or account"}. |
| 404 Not Found | The request path does not match any API endpoint. The response body is {"status":"failed","statusText":"Unknown API path"}. Your credentials are checked first, so wrong credentials give a 401 even on an unknown path. |
| 405 Method Not Allowed | The endpoint does not accept the HTTP method you used (for example GET on an endpoint that only accepts POST). The Allow response header lists the methods it accepts, and the response body is {"status":"failed","statusText":"Method not allowed"}. |
API Response Data
All API responses include a JSON object containing standard fields that provide information about the request outcome, regardless of the specific endpoint called. Here are the fields you'll always receive:
| Field | Description |
|---|---|
status | Indicates the overall outcome of the request: • "success" - The call completed successfully• "failed" - The call encountered an error |
statusText | A human-readable message providing additional context about the request outcome. This field contains either: • Success information for completed requests • Error details explaining why a request failed |