Building an AI agent? The
@defaulthq/ai-tools package wraps this whole flow
as ready made Vercel AI SDK tools.Authentication
Create an API key in Settings → API Keys with thetriggers:write and
scheduling:write permissions. A write key also covers reads for its surface, so these two are
enough for the whole flow. Send it on every request as Authorization: Bearer <key>.
This is a server to server API. It sends no CORS headers, so it cannot be called from a browser.
Your API key should be kept private.
Before you start
You need a published workflow with an API trigger. In the workflow editor, add the API trigger, connect a form to it, and publish. The form’s fields define what your requests send. The workflow needs a Display Scheduler step on the path you expect to book from.The flow
1
Find your trigger
List the API triggers in your workspace to get the trigger id and the fields its form expects.Each field’s
name is the key you send in the next step. Fields marked required must have a
value before the workflow will run. For select fields, send one of the option values. You can
skip the email field, the next step fills it for you.Full reference: GET /v1/triggers2
Fire the trigger
Send the lead’s email and their responses. The The workflow runs your routing rules and responds with an execution id and an outcome.Keep both values.
email input is the lead’s identity, and it
automatically fills the form’s email field, so you never send it twice.If you know web context about the lead, send it in the optional context object: utmParams,
gclid, pageUrl, referrer, userAgent, and ipAddress, all optional. The workflow can
reference it as form submission data, and it records as attribution on the booked meeting.outcome.type tells you what the workflow decided:If you would rather show the calendar in a browser than book through the API,
schedulerUrl is a
ready to use booking page and you can stop here.Full reference: POST /v1/triggers/{trigger}3
Get available times
Ask for open slots, passing The range can span up to 63 days, nine weeks from whatever start you choose, roughly two months
of availability per request. Keep the
outcome.schedulingLinkId as the event. The link carries the routing
decision, so the times you get back belong to the rep the workflow chose. Booking without a
workflow works the same way, pass an event id or slug from your workspace instead and the times
come from the event’s own hosts.reservationId and pass it back if you query more date
ranges, so the same host selection holds while the lead decides. Book before expiresAt or
request slots again.Full reference: POST /v1/scheduling/events/{event}/slots4
Book the meeting
Book a returned slot. Pass the same link id as The
event, the same email as personEmail, and the
executionId from Step 2 as workflowExecutionId.workflowExecutionId is what ties the meeting back to the routing decision. It resumes the
workflow, so CRM writeback, notifications, and routing fairness all record against this booking.
Without it the meeting still books, but the workflow never learns about it.Full reference: POST /v1/scheduling/meetingsHandling errors
Every error comes back as{ "error": { "code", "message" } }.
Each endpoint’s reference page lists the exact codes it can return per status, with example payloads.
When a book response is lost. If your book request times out, do not book again. The booking
almost always succeeded, and the meeting invite reaches the lead’s calendar either way. A retry
with the same
workflowExecutionId returns CONFLICT or RESERVATION_USED and can never create
a second meeting for the same workflow run. A retry without a workflow can even return
RESERVATION_EXPIRED after the hold lapses, so treat any of these three codes after a timeout as
a sign the meeting exists, not an invitation to rebook.
Every fire starts a new workflow run, so nodes before the scheduler run again. If your workflow
writes to a CRM or sends notifications, expect a repeat fire to do that work again, and a step
that assigns the routed rep, like writing an owner to your CRM, counts against routing fairness
on each run. The booking itself is safe to retry, a meeting only counts once it actually books.
When you already have a scheduler outcome, reuse it instead of firing again.