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.

Use a dedicated test API key with the minimum access you need. Rotate or revoke the key when you finish experimenting.

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:

Test write operations carefully

Before calling endpoints that create or update data (POST /messages, POST /contacts/initialize, POST /conversations/{id}/resolve, and similar):

  1. Note the resource IDs returned by list endpoints.
  2. Send the smallest valid payload from the schema example.
  3. Re-fetch the resource to confirm the change.

Test webhooks locally

Webhooks are delivered to your server, not to the Chatway API. To test the full receive-and-reply flow locally:

  1. Expose a temporary HTTPS URL with a tunnel (for example ngrok or webhook.site).
  2. Register that URL under Settings → Developer Tools → Webhooks and subscribe to message.received.
  3. Send a test visitor message in your Chatway widget.
  4. Verify your endpoint receives the signed JSON envelope and returns a 2xx response within the timeout.
  5. Reply using POST /messages with conversation_id from data.conversation.id in the webhook (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 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 Repeat the same request rapidly Eventually 429 if you exceed the per-key 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.