# API Reference — SMS Survey All endpoints accept and return JSON. Base URL in local development: `http://localhost:5000`. --- ## `POST /surveys/start` Submit data to `/surveys/start`. ### Request ```json { "example": "see source code for full schema" } ``` ### Response `200` ```json { "status": "ok" } ``` ### Try it ```bash curl -X POST http://localhost:5000/surveys/start \ -H "Content-Type: application/json" \ -d '{}' ``` --- ## `POST /webhooks/sms` Inbound webhook endpoint called by Telnyx when an event occurs. ### Request ```json { "example": "see source code for full schema" } ``` ### Response `200` ```json { "status": "ok" } ``` ### Try it ```bash curl -X POST http://localhost:5000/webhooks/sms \ -H "Content-Type: application/json" \ -d '{}' ``` --- ## `GET /surveys/results` Retrieve data from `/surveys/results`. ### Request ```json { "example": "see source code for full schema" } ``` ### Response `200` ```json { "status": "ok" } ``` ### Try it ```bash curl http://localhost:5000/surveys/results ``` --- ## Error Handling All endpoints return JSON. On error: ```json {"error": "Description of what went wrong"} ``` | Status | Meaning | |--------|---------| | `200` | Success | | `400` | Bad request — missing or invalid fields | | `401` | Invalid API key or webhook signature | | `429` | Rate limit exceeded | | `500` | Server error | | `503` | Upstream network error talking to Telnyx |