Error Reference

Complete reference of all error responses returned by the Gravity SMS API. Every error follows the same JSON format. Use this page to look up specific error messages and understand how to resolve them.

Error format

All error responses return a JSON object with a single error key:

Error response
{
"error": "Description of what went wrong"
}

400 Bad Request

The request is malformed, missing required fields, or contains invalid values. Fix the request before retrying.

Error messageEndpointFix
to, from, and body are requiredPOST /v1/sms/sendInclude all three fields in the request body.
to and from must be valid E.164 phone numbersPOST /v1/sms/sendUse E.164 format: + followed by 9–15 digits (e.g., +15551234567).
body must be 1-1600 charactersPOST /v1/sms/sendMessage body must not be empty and must not exceed 1,600 characters.
Invalid messageId formatGET /v1/sms/status/:messageIdUse the format msg_ + 12 hex characters.
name must be 1-100 charactersPOST /v1/apps/registerProvide a non-empty name of 100 characters or fewer.
Invalid tenantId formatPOST /v1/apps/registerUse the format tenant_ + 16 hex characters.
Tenant not found or not activePOST /v1/apps/registerVerify the tenant ID exists and the tenant is in active status.
Invalid webhookUrl: must be https:// in production, max 2000 charsPOST /v1/apps/register, PUT /v1/apps/:appIdProvide a valid HTTPS URL of 2,000 characters or fewer.
Invalid appId formatGET, PUT, DELETE /v1/apps/:appIdUse the format app_ + 16 hex characters.
App has no webhookUrl configuredPOST /v1/apps/:appId/test-webhookSet a webhookUrl on the app before testing.
Missing tokenGET /v1/rc/connectUse the full connectUrl returned by the connect-token endpoint.
Invalid or expired tokenGET /v1/rc/connectGenerate a new connect token. Tokens are single-use and expire quickly.

401 Unauthorized

Authentication failed. The API key is missing, malformed, or does not match any active app.

Error messageCauseFix
Missing or invalid API keyNo Authorization header, or the value does not start with Bearer sgw_.Include the header: Authorization: Bearer sgw_...
Invalid API keyThe key format is correct but it does not match any active app in the system.Verify the key is correct. If lost, rotate the key to generate a new one.

403 Forbidden

The API key is valid but lacks permission for the requested action.

Error messageCauseFix
Admin API key required to register new appsAn app-role key attempted to register a new app.Use an admin-role API key.
Tenant suspended or inactiveThe tenant associated with this API key is not in active status.Contact your platform administrator to restore the tenant.
HTTPS requiredThe request was made over HTTP in a production environment.Use https:// for all API requests.

404 Not Found

The requested resource does not exist or is not accessible with the current API key.

Error messageEndpointFix
Message not foundGET /v1/sms/status/:messageIdVerify the message ID. App-role keys can only access messages within their own tenant.
App not foundGET, PUT, DELETE /v1/apps/:appIdVerify the app ID. App-role keys can only access apps within their own tenant.

413 Payload Too Large

The request body exceeds the maximum allowed size.

Error messageCauseFix
Payload too largeRequest body exceeds 100 KB.Reduce the size of the request body.

429 Too Many Requests

A rate limit has been exceeded. The response includes a Retry-After header with the number of seconds to wait.

Error messageCauseFix
Too many requestsPer-key API rate limit exceeded (100/min for app, 500/min for admin), failed auth IP block (10 attempts in 5 min), or connect token limit (5/tenant/hour).Wait for the number of seconds in the Retry-After header before retrying.
See Rate Limits for a breakdown of all rate limit tiers and handling strategies.

500 Internal Server Error

An unexpected error occurred on the server. This is retryable with exponential backoff.

Error messageCauseFix
Internal server errorUnexpected server-side failure. In production, detailed error information is never exposed.Retry with exponential backoff (start at 1 second). If the error persists, include the X-Request-Id header value when reporting the issue.

WebSocket errors

WebSocket errors are delivered as JSON messages with type: "auth_error". The connection is closed with code 1008 (Policy Violation) after sending the error.

Error messageCauseFix
Invalid JSONThe first message sent was not valid JSON.Send a valid JSON auth message: {"type":"auth","apiKey":"..."}
Invalid API keyThe API key does not match any active app.Verify the API key is correct and the app is active.
Send auth firstA non-auth message was sent before authenticating.Send the auth message immediately after the connection opens.

Message-level errors

These are not HTTP errors. They appear in the error field of a message object when the message has status: "failed". Check via GET /v1/sms/status/:messageId or the sms_status WebSocket event.

Error messageCauseFix
RingCentral not connected for this tenantThe tenant has no active RingCentral connection.Connect a RingCentral account via the OAuth flow before sending messages.
Phone number +15551234567 is not registered in this RingCentral accountThe "from" number is not SMS-enabled or not part of the connected RingCentral account.Use an SMS-enabled number from your RingCentral account. Check status at GET /v1/rc/status.

Retryable vs. permanent errors

StatusRetryableStrategy
400NoFix the request.
401NoCheck your API key.
403NoCheck role and tenant status.
404NoVerify the resource ID.
413NoReduce payload size.
429YesWait for Retry-After seconds.
500YesRetry with exponential backoff.

Related docs