Testing the API
Testing the API
Use these approaches to explore the Chatway API safely before wiring it into production.
Try It in the docs
Each endpoint under API Reference includes a Try It panel. Enter your API key in the Auth section (X-API-KEY), fill in any path or query parameters, and send the request directly from the browser.
Try It sends requests to the same base URL shown in the docs server selector, so you can confirm authentication, request shape, and response structure without writing code first.
Try It sends real requests to the selected server. Start with GET /widgets, which only reads data. Use records reserved for testing before trying writes: those requests can change contacts, send messages or invite teammates. Naming a key “test” does not make its requests a simulation.
Test with curl
Copy any endpoint example and run it from your terminal:
curl -X GET "https://developers.chatway.app/api/v1/contacts" \
-H "X-API-KEY: your_api_key" \
-H "Accept: application/json"
Replace method, path, and body to match the operation you are testing. A 401 usually means a missing or invalid key; 422 means the payload or query string failed validation.
Confirm authentication
Run a simple read-only call such as GET /contacts or GET /widgets:
- 200: key is valid and the request succeeded.
- 401: key is missing, malformed, or revoked.
- 403: key is valid but the requested action is not permitted for this account or resource.
Test write operations carefully
Before calling endpoints that create or update data (POST /messages, POST /contacts/initialize, POST /conversations/{id}/resolve, and similar):
- Choose test records and copy their IDs from the relevant list endpoint.
- Check the required fields and intended effect before sending one request. Use a conversation whose recipient expects test messages.
- Save the returned status and resource ID.
- Verify contact changes with Get Chat Contact, messages with List Conversation Messages, and status changes with List Conversations.
- If the request times out, check the result before sending it again. A missing response does not prove that the write failed.
Test webhooks locally
Webhooks are delivered to your server, not to the Chatway API. To test the full receive-and-reply flow locally:
- Expose your local webhook handler through an HTTPS tunnel, such as ngrok. An inspection service such as webhook.site can display deliveries, but does not run your local verification or reply code. Use synthetic messages when testing with an external inspection service.
- Register that URL under Settings → Developer Tools → Webhooks and subscribe to message.received.
- Send a test visitor message in your Chatway widget.
- Verify your endpoint receives the signed JSON envelope and returns a 2xx response within 4 seconds.
- Reply using POST /messages with conversation_id from data.conversation.id in the webhook and an agent_id from GET /agents (see Quickstart → Receive a message and send a reply).
See Webhook docs → Overview for header and signature verification details.
Suggested smoke-test checklist
| Step | Request | Expected |
|---|---|---|
| Auth | GET /widgets with X-API-KEY | 200 and widget list |
| Reply flow | Receive message.received, then POST /messages with data.conversation.id and agent_id | Webhook 2xx, reply 201 |
| Contacts | GET /contacts | 200 and paginated contacts |
| Conversations | GET /conversations/all | 200 and conversation list |
| Messages | GET /conversations/{id}/messages | 200 for a valid conversation ID |
| Rate-limit handling | Simulate a 429 response in your client tests, both with and without Retry-After. | The client waits before retrying and stops after its configured retry limit. |
When something fails
Capture the HTTP status, response body, UTC timestamp, and the exact method + path. See Customer support if you need help from the Chatway team.
Request
- Base URL: https://developers.chatway.app/api/v1
- URL: https://developers.chatway.app/api/v1/guides/testing-the-api
- Auth: none required
Response
Documentation.
Changes
No recorded changes to this operation across all 1 revision of this API.