Buni.aiDocs
API referenceFlows

Trigger a chatbot flow (async or scheduled)

Queues a chatbot flow run and returns 202 immediately.

POST/flows/{projectId}/trigger-async

Queues a chatbot flow run and returns 202 immediately. Add runAt or delaySeconds to schedule the run for later; the response status is then SCHEDULED and scheduledFor holds the time.

Requires the flow:trigger scope. Chatbot projects only (see POST /flows/{projectId}/trigger).

A scheduled run is not checked against the Trigger node's trigger key and payload schema when it fires; an immediate async run is.

Authorization

AuthorizationBearer <token>

Authorization: Bearer bai_ext_.... Tokens belong to one project and carry scopes: bot:invoke, flow:trigger, automation:trigger.

In: header

Scope: flow:trigger

Path Parameters

projectId*string

The project ID. The token must belong to this project.

Header Parameters

x-idempotency-key?string

Up to 128 characters. A repeat of a key already used for the same project, target and mode returns the original run instead of starting a new one. Longer keys are ignored.

Lengthlength <= 128

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Send at most one of runAt and delaySeconds.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/flows/string/trigger-async" \  -H "Content-Type: application/json" \  -d '{    "event": "checkout.started",    "customerId": "cus_123",    "webhookUrl": "https://api.example.com/buni/callbacks"  }'

{  "invocationId": "clx9km1a40030ab12cd34ef40",  "status": "QUEUED",  "scheduledFor": null}