Apps
Register applications, manage settings, rotate API keys, and test webhook delivery.
/v1/apps/registerappRegister a new application and receive an API key. You can also create apps from the dashboard.
Request body
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Required | App display name, 1–100 characters. |
tenantId | string | Required | Tenant to associate the app with. Format: tenant_ + 16 hex characters. |
webhookUrl | string | null | Optional | URL to receive inbound SMS webhooks. Must be HTTPS in production, max 2000 characters. |
role | string | Optional | "app" (default). Each app key is scoped to your account. |
curl -X POST https://smsgateway-api.onrender.com/v1/apps/register \-H "Authorization: Bearer YOUR_API_KEY" \-H "Content-Type: application/json" \-d '{"name": "My CRM Integration","tenantId": "tenant_abc123def456abcd","webhookUrl": "https://my-app.example.com/webhooks/sms"}'
Success response
{"appId": "app_f1e2d3c4b5a69870","name": "My CRM Integration","apiKey": "sgw_a1b2c3d4e5f6789012345678abcdef90","apiKeyPrefix": "sgw_a1b2","webhookSecret": "whsec_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2","role": "app","tenantId": "tenant_abc123def456abcd"}
apiKey and webhookSecret are returned once and cannot be retrieved again. The gateway stores only hashed/encrypted versions. Use the webhook secret to verify webhook signatures.Error responses
{"error": "name must be 1-100 characters"}
{"error": "tenantId is required when registering new apps"}
{"error": "Invalid tenantId format"}
{"error": "Tenant not found or not active"}
{"error": "Invalid webhookUrl: must be https:// in production, max 2000 chars"}
/v1/appsappList all apps in your account.
Returns all apps in your account. The apiKeyHash field is never returned.
curl https://smsgateway-api.onrender.com/v1/apps \-H "Authorization: Bearer YOUR_API_KEY"
Success response
{"apps": [{"appId": "app_abc123def456abcd","tenantId": "tenant_abc123def456abcd","name": "My CRM Integration","webhookUrl": "https://my-app.example.com/webhooks/sms","role": "app","isActive": true,"apiKeyPrefix": "sgw_a1b2","lastUsedAt": "2026-03-01T09:30:00.000Z","createdAt": "2026-02-15T12:00:00.000Z","updatedAt": "2026-03-01T09:30:00.000Z"}]}
/v1/apps/:appIdapp (own app)Update an app's webhook URL or active status.
Request body
| Name | Type | Required | Description |
|---|---|---|---|
webhookUrl | string | null | Optional | New webhook URL, or null to remove. Must be HTTPS in production, max 2000 characters. |
isActive | boolean | Optional | Set to false to deactivate the app (API key stops working). |
curl -X PUT https://smsgateway-api.onrender.com/v1/apps/app_abc123def456abcd \-H "Authorization: Bearer YOUR_API_KEY" \-H "Content-Type: application/json" \-d '{"webhookUrl": "https://my-app.example.com/webhooks/sms"}'
Success response
{"ok": true}
Error responses
{"error": "Invalid appId format"}
{"error": "Invalid webhookUrl: must be https:// in production, max 2000 chars"}
{"error": "App not found"}
/v1/apps/:appIdapp (own app)Deactivate an app (soft delete). The API key stops working immediately.
curl -X DELETE https://smsgateway-api.onrender.com/v1/apps/app_abc123def456abcd \-H "Authorization: Bearer YOUR_API_KEY"
Success response
{"ok": true}
Error responses
{"error": "Invalid appId format"}
{"error": "App not found"}
/v1/apps/:appId/rotate-keyapp (own app)Generate a new API key, immediately invalidating the old one.
curl -X POST https://smsgateway-api.onrender.com/v1/apps/app_abc123def456abcd/rotate-key \-H "Authorization: Bearer YOUR_API_KEY"
Success response
{"apiKey": "sgw_new1a2b3c4d5e6f7a8b9c0d1e2f3a4b5","apiKeyPrefix": "sgw_new1"}
Error responses
{"error": "Invalid appId format"}
{"error": "App not found"}
/v1/apps/:appId/rotate-webhook-secretapp (own app)Generate a new webhook secret, immediately invalidating the old one.
curl -X POST https://smsgateway-api.onrender.com/v1/apps/app_abc123def456abcd/rotate-webhook-secret \-H "Authorization: Bearer YOUR_API_KEY"
Success response
{"webhookSecret": "whsec_new1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1"}
Error responses
{"error": "Invalid appId format"}
{"error": "App not found"}
/v1/apps/:appId/test-webhookapp (own app)Send a test payload to the app's configured webhook URL.
Sends a POST request with a test payload to the app's webhookUrl. The test payload has the following shape:
{"type": "test","timestamp": "2026-03-01T12:00:00.000Z","source": "smsgateway"}
curl -X POST https://smsgateway-api.onrender.com/v1/apps/app_abc123def456abcd/test-webhook \-H "Authorization: Bearer YOUR_API_KEY"
Success response
If your webhook responds with a 2xx status:
{"ok": true}
If your webhook responds with a non-2xx status or times out (5 second timeout):
{"ok": false,"status": 500,"error": "Internal Server Error"}
Error responses
{"error": "Invalid appId format"}
{"error": "App has no webhookUrl configured"}
{"error": "App not found"}
Related docs
- Authentication — API key format and roles
- Webhooks Guide — Webhook URL setup and payload format
- Receiving SMS — Inbound SMS webhook delivery