API Reference

Wapzi API for External Service

This page covers API-key authentication, how to get the key in the dashboard, and usage examples for the public external-service endpoint.

Public URL for this documentation: /docs

Base URL and authentication

Base URL for your environment: https://api.wapzi.com.br

Authentication headers:

x-api-key: ak_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Content-Type: application/json

How to get the API key in the dashboard

  1. Open /dashboard/settings.
  2. In the API Key section, click Show.
  3. Click Copy and store the key securely.
  4. To rotate the key (admin), use the account dashboard at /dashboard/accounts/:id and the Generate new button.

Rotating the key immediately invalidates old integrations using the previous key.

Basic endpoints

Execute service by connection

Uses the active connection from the account identified in the URL and automatically chooses an available agent to respond.

Endpoint

POST /v1/entry-points/:entryPointId/execute

Request body

{
  "message": "Hello, I need help with my order"
}

cURL

curl -X POST "https://api.wapzi.com.br/v1/entry-points/entry_point_123/execute" \
  -H "Content-Type: application/json" \
  -H "x-api-key: ak_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
  -d '{
    "message": "Hello, I need help with my order"
  }'

Response

{
  "conversationId": "conv_123",
  "executionId": "exec_123",
  "status": "queued"
}

Common errors

  • 400 entryPointId is required
  • 400 Invalid entryPointId
  • 400 Entry point has no attendants configured
  • 400 Entry point has no available agent attendant
  • 401 Missing API key
  • 401 Invalid API key

Check execution

Checks the result of the latest conversation execution. Older executions can return as superseded.

Endpoint

GET /v1/executions/:executionId

Request body

{}

cURL

curl -X GET "https://api.wapzi.com.br/v1/executions/exec_123" \
  -H "Content-Type: application/json" \
  -H "x-api-key: ak_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

Response

{
  "conversationId": "conv_123",
  "executionId": "exec_123",
  "status": "completed",
  "response": "Hello! I can help with the order status. Please send your number."
}

Common errors

  • 400 Invalid executionId for this account
  • 401 Missing API key
  • 401 Invalid API key

Quick example (Node.js)

const response = await fetch('https://api.wapzi.com.br/v1/entry-points/entry_point_123/execute', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'x-api-key': process.env.WAPZI_API_KEY,
    },
    body: JSON.stringify({
        message: 'Hello, I want to talk about pricing.',
    }),
});

if (!response.ok) {
    const error = await response.json();
    throw new Error(error.message || 'Wapzi integration error');
}

const data = await response.json();
console.log(data.executionId);

const result = await fetch(`https://api.wapzi.com.br/v1/executions/${data.executionId}`, {
    headers: {
        'Content-Type': 'application/json',
        'x-api-key': process.env.WAPZI_API_KEY,
    },
});

console.log(await result.json());

Best practices

  • Do not expose the key in the public frontend.
  • Keep the key only in your integration backend.
  • Treat the POST as asynchronous and check the execution using the returned executionId.
  • Send the same conversationId to preserve the latest-wins policy per conversation.
  • Rotate the key periodically.
  • Monitor 401 and 403 errors to detect invalid keys or inactive accounts.

Homologation checklist

  • Valid key copied from the dashboard.
  • Correct and active entryPointId present in the URL.
  • Entry point with an attendant/agent configured and available.
  • POST returning 202 with executionId in the homologation environment.
  • GET query returning completed, failed, or superseded correctly.