API reference

REST API reference

The Vyostra AI REST API has nine endpoints under /v1, covering four resources: leads, chatbots, lead forms and voice agents. Eight are GET requests that read data, and one, POST /v1/forms, creates a lead form. Every request carries an API key in the Authorization header and returns JSON. This page lists each endpoint, its parameters and its response fields.

By Vinayak Tiwari, Co-Founder & Builder. Published .

What are the conventions for every request?

  • Base URL. https://vyostra.com. It is also shown next to your keys in the dashboard under Settings. Examples here call it $VYOSTRA_API_URL, and every request must use HTTPS.
  • Authentication. Authorization: Bearer followed by your key. See API keys and authentication.
  • Format. Responses are JSON with field names in camelCase. Timestamps are ISO 8601 strings in UTC.
  • Missing values. A field with no value is null. It is never left out, so every object of one type has the same keys.
  • Errors. A failed request returns an error object with a code and a message. See Errors and rate limits.
Method and pathReturnsScope
GET /v1/leadsA page of leadsleads:read
GET /v1/leads/:idOne lead with its transcriptleads:read
GET /v1/botsAll chatbotsbots:read
GET /v1/bots/:botIdOne chatbotbots:read
GET /v1/formsAll lead formsforms:read
GET /v1/forms/:formIdOne lead formforms:read
POST /v1/formsThe lead form it createdforms:write
GET /v1/voice-agentsAll voice agentsvoice_agents:read
GET /v1/voice-agents/:agentIdOne voice agentvoice_agents:read

How do you list leads?

GET /v1/leads returns one page of the leads in your account, from every source.

Query parameterTypeMeaning
limitInteger, 1 to 200Leads per page. Defaults to 50.
cursorStringThe nextCursor value from the previous page.
includeArchivedtrueAlso return leads archived in the dashboard. Left out by default.
Shell
curl "$VYOSTRA_API_URL/v1/leads?limit=100" \
  -H "Authorization: Bearer $VYOSTRA_API_KEY"

The response body is the page itself:

FieldTypeMeaning
dataArray of leadsThe leads on this page.
nextCursorString or nullPass it as cursor to get the next page. null on the last page.
totalIntegerHow many leads match across all pages.
incompleteSourcesArray of stringsPresent only when a lead source could not be read. This page is then missing that source's leads.

Leads come back in dashboard inbox order, which is by urgency and not by date. The list covers every chat and form lead, plus the 500 most recent Meta lead ad leads and the 500 most recent voice leads.

What fields does a lead have?

FieldTypeMeaning
idStringThe lead's id, starting with lead_. Treat it as opaque.
sourceStringOne of chat, form, meta, voice.
sourceIdStringThe id of the chatbot, form, Facebook Page or voice agent the lead came through.
nameString or nullThe lead's name.
phoneString or nullThe lead's phone number.
emailString or nullThe lead's email address.
sourceUrlString or nullThe page the lead was captured on.
attributesObjectAnything else captured with the lead, as string values keyed by field name.
statusStringOne of new, contacted, qualified, closed.
outcomeString or nullOne of won, lost, unreachable. Set only on a closed lead.
leadScoreInteger or nullA score from 0 to 100, when one has been assigned.
archivedBooleanWhether the lead has been archived in the dashboard.
createdAtStringWhen the lead was captured.

How do you fetch one lead?

GET /v1/leads/:id returns a single lead wrapped in data. Use the id exactly as the list returned it.

Shell
curl "$VYOSTRA_API_URL/v1/leads/lead_WyJjaGF0IiwiOWYyYzFkN2UtYm90IiwiNWI4ZTQxYWEtbGVhZCJd" \
  -H "Authorization: Bearer $VYOSTRA_API_KEY"

It has every field in the table above, with two differences:

FieldTypeMeaning
transcriptString or nullThe chat conversation, for a lead captured by the chatbot. null when there is none.
attributesObjectAlso includes the answers submitted on a form or a Meta lead ad.

An id that does not exist, or belongs to another account, returns 404 with the code not_found.

How do you read chatbots?

GET /v1/bots returns every chatbot in the account as an array in data. GET /v1/bots/:botId returns one.

Shell
curl "$VYOSTRA_API_URL/v1/bots" \
  -H "Authorization: Bearer $VYOSTRA_API_KEY"
FieldTypeMeaning
botIdStringThe id used in the widget script tag.
nameStringThe chatbot's name.
websiteUrlString or nullThe site the chatbot was trained on.
greetingMessageStringThe first message a visitor sees.
brandColorStringThe widget colour as a hex code.
widgetTriggerStringWhen the widget opens: immediate, delay_5s, scroll_50 or exit_intent.
leadTriggerAfterMessagesIntegerHow many visitor messages before the lead form is offered.
leadFormFieldsArrayThe fields of the in-chat lead form. Each has fieldId, label, type, required and, for a select, options.
supportEmailString or nullThe support address shown in the widget.
createdAt, updatedAtStringWhen the chatbot was created and last changed.

How do you read lead forms?

GET /v1/forms returns every lead form as an array in data. GET /v1/forms/:formId returns one.

FieldTypeMeaning
formIdStringThe id used in the form widget script tag.
nameStringThe form's name.
descriptionString or nullThe text shown under the name.
submitButtonTextStringThe label on the submit button.
fieldsArrayEach field has fieldId, label, type, required and optionally placeholder and options. type is one of text, number, email, phone, options.
createdAt, updatedAtStringWhen the form was created and last changed.

How do you create a lead form?

POST /v1/forms creates a lead form and returns it in data, including the formId your page needs. It takes a key with the forms:write scope, on a plan with full API access.

Creating a form is a setup step. Call it once from a script or a deploy job, store the formId, and use that id on your site. Do not call it when a visitor submits: a submission only sends the formId, and it never needs your API key.

Shell
curl -X POST "$VYOSTRA_API_URL/v1/forms" \
  -H "Authorization: Bearer $VYOSTRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Site visit",
    "submitButtonText": "Book a visit",
    "fields": [
      { "label": "Name", "type": "text", "required": true },
      { "label": "Phone", "type": "phone", "required": true },
      { "label": "Email", "type": "email" },
      { "label": "Interested in", "type": "options", "options": ["2 bedroom", "3 bedroom"] }
    ]
  }'
Body propertyTypeMeaning
nameString, requiredThe form's name, up to 120 characters.
descriptionStringThe text shown under the name, up to 500 characters.
submitButtonTextStringThe label on the submit button. Defaults to Submit.
fieldsArray, required1 to 30 fields, shown in this order.

Each field takes these properties:

Field propertyTypeMeaning
labelString, requiredThe label shown above the input.
typeString, requiredOne of text, number, email, phone, options.
requiredBooleanWhether the visitor must fill it in. Defaults to false.
placeholderStringHint text inside the input.
optionsArray of stringsThe choices, 1 to 50 of them. Required when type is options, and not allowed otherwise.

A property that is not in these tables is rejected with 400 invalid_request, so a misspelt name is caught instead of ignored. The message names the property.

What happens if you send the same request twice?

You get the same form back. A request whose name and definition match a form that already exists returns that form with status 200, instead of creating a second one with 201. A setup script can therefore run on every deploy and still own exactly one form.

A request that reuses a name with different fields returns 409 with the code form_name_taken. The API does not change an existing form, so pick another name. An account can hold 200 forms; past that the code is form_limit_reached.

How do you read voice agents?

GET /v1/voice-agents returns every voice agent as an array in data. GET /v1/voice-agents/:agentId returns one.

FieldTypeMeaning
agentIdStringThe id used in the voice widget script tag.
nameStringThe voice agent's name.
voiceStringThe voice it speaks with, for example coral or sage.
greetingMessageStringWhat the agent says first.
brandColorStringThe widget colour as a hex code.
widgetPositionStringOne of bottom-left, bottom-right, bottom-center.
maxSessionDurationIntegerThe longest a session can run, in minutes: 5, 10 or 15.
enabledBooleanWhether the agent is switched on.
createdAt, updatedAtStringWhen the agent was created and last changed.

What is not in the API yet?

Creating a lead form is the only write. The API cannot change or delete a form, cannot create or change leads, chatbots or voice agents, does not send webhooks, and has no official SDK. Fields may be added to a response over time, so write clients that ignore fields they do not recognise.

Common questions

Can the Vyostra AI API create or update leads?

Not yet. The Vyostra AI API can list and fetch leads but cannot create or change them. Leads are created by the chatbot, form and voice widgets and by connected Meta lead ads. The one thing the API can create is a lead form, with POST /v1/forms, and submissions to that form then arrive as leads.

Can I create a Vyostra AI lead form from code?

Yes. POST /v1/forms creates a Vyostra AI lead form from a JSON list of fields and returns its formId. It needs an API key with the forms:write scope on a Growth or Agency plan. Call it once during setup, not on every submission: sending the same request again returns the existing form instead of a duplicate.

Does the Vyostra AI API have webhooks?

No. The Vyostra AI API does not send webhooks today, so an integration that needs new leads has to poll GET /v1/leads on a schedule. The sync guide in these docs shows a polling loop that stays inside the rate limit.

In what order does GET /v1/leads return leads?

In the same order as the Vyostra AI dashboard inbox, which is by urgency rather than by date: overdue follow-ups first, then untouched leads, then scheduled, in-progress and closed ones. To get every lead, follow nextCursor until it is null instead of relying on the order.