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
2xxresponse within 4 seconds. - Reply using
POST /messageswithconversation_idfromdata.conversation.idin the webhook and anagent_idfromGET /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 |
| Installation code | GET /installation/code |
200. script_html contains widget.js?id= followed by installation_id, and no API key. installation_id is not one of the IDs from GET /widgets, which lists inbox widgets for the conversation APIs. |
| Installation status | GET /installation/status?domain=your-site.com after deploying |
200 with widget_operational or script_detected. Any other status means the installation is not confirmed. |
| 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. |
| Resolve limit | Simulate a 429 with retry_after from POST /conversations/{id}/resolve in your client tests. |
The client waits that many seconds and does not treat the conversation as resolved. |
| Shared budgets | Check how your workers pace resolves when several API keys or AI assistant connections belong to one account. | Combined traffic stays within the account's limits; adding a key does not add allowance. |
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.