Flows

Trigger Flow

Triggers a flow for a specific contact. The flow must be enabled and the instance connected. Optional variables are available inside the flow as {variable_name}. When it reaches a webhook block, all collected variables (answers, clicks, contact data) are sent to the configured URL.

POSThttps://api.zapzapapi.com/api/v1/flows/{flowId}/trigger

Authentication with the x-api-key and x-api-secret headers.

Parameters

NameTypeInRequiredDescription
flowIdtextpathYesFlow ID
instance_idtextbodyYesInstance ID
phonetextbodyYesContact phone
variablesjsonbodyNoInitial variables (JSON object)

Request example

curl

curl -X POST "https://api.zapzapapi.com/api/v1/flows/{flowId}/trigger" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "x-api-secret: YOUR_API_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"instance_id":"inst-456","phone":"5511999999999"}'

Node.js

const res = await fetch("https://api.zapzapapi.com/api/v1/flows/{flowId}/trigger", {
  method: "POST",
  headers: {
    "x-api-key": "YOUR_API_KEY",
    "x-api-secret": "YOUR_API_SECRET",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "instance_id": "inst-456",
    "phone": "5511999999999"
  }),
});
console.log(await res.json());

Python

import requests

res = requests.post(
    "https://api.zapzapapi.com/api/v1/flows/{flowId}/trigger",
    headers={"x-api-key": "YOUR_API_KEY", "x-api-secret": "YOUR_API_SECRET"},
    json={"instance_id":"inst-456","phone":"5511999999999"},
)
print(res.json())

Response example

JSON

{
  "execution_id": "exec-789",
  "status": "waiting_reply",
  "flow_id": "abc-123",
  "phone": "5511999999999"
}

Values are illustrative; the fields follow the real response format.

Other endpoints in this category

See the full reference

Get your API keys

Create your account, connect a number in minutes and start using the API. R$15 per active number/month, with a welcome credit when you create the account, subject to the current campaign.