Skip to main content
Aivastark

Developer reference

Last updated:

Aivastark has one REST API, for support tickets, plus signed webhooks, a configurable website widget, server-side Visitor Lenz endpoints and two ways for the agent to call your own systems. There is no general REST API for querying the agent, adding knowledge or reading conversations.

Ticket API

A REST API for support tickets, available from the Starter plan. Use it to open tickets from your own forms or apps, sync them with another system, or post replies.

  • Base URL: https://xckrihmmdwddvcwohvaz.supabase.co/functions/v1/tickets-public-api
  • Authentication: Authorization: Bearer ask_live_…
  • Create a key in the dashboard under Tickets → Settings → API keys. It is shown once; Aivastark stores only a hash of it. Each key belongs to one project and can be revoked at any time.

Endpoints

MethodPathScopeWhat it does
GET/ticketsreadList tickets, newest update first. Query: limit (default 50, max 200), status and priority (comma lists), requester_email, updated_since (ISO time). Returns { tickets, updated_since }.
POST/ticketswriteCreate a ticket. Body: subject (required), description, requester_email, requester_name, priority (low, normal, high, urgent), type (question, incident, problem, task), category, tags, custom_fields, notify_customer.
GET/tickets/{ref}readFetch one ticket. {ref} is the ticket id or its number, such as 1042.
PATCH/tickets/{ref}writeUpdate status (new, open, pending, hold, solved, closed), priority, type, category, tags, subject or custom_fields.
GET/tickets/{ref}/commentsreadList comments, oldest first. Includes internal notes (public: false), so keep the response on your server.
POST/tickets/{ref}/commentswriteAdd a comment. Body: body (required), author_type ("visitor" relays a customer message), author_name, public (default true), notify_customer.

Ticket object

id, number, subject, description, status, priority, type, category, channel, tags, requester { name, email }, assignee_name, created_by_ai, sla { first_response_due_at, resolution_due_at, first_response_at, breached_at }, csat_score, external_refs, custom_fields, created_at, updated_at, resolved_at

Example: create a ticket

curl -X POST "https://xckrihmmdwddvcwohvaz.supabase.co/functions/v1/tickets-public-api/tickets" \
  -H "Authorization: Bearer $AIVASTARK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"subject":"Order 1182 arrived damaged","requester_email":"ada@example.com","priority":"high"}'

Errors

  • 400 invalid_json, invalid_request
  • 401 unauthorized
  • 402 plan_upgrade_required (writes need Starter or above; reads keep working)
  • 403 insufficient_scope
  • 404 not_found
  • 405 method_not_allowed
  • 500 internal_error, query_failed
  • Errors return { "error": "<code>", "message": "…" }.
  • Creating a ticket with the same requester email and subject as an open ticket from the last 24 hours adds a comment to that ticket instead, and returns deduplicated: true.
  • When listing with updated_since, more than `limit` changes between two polls can be missed. Poll with limit=200, and often enough that fewer than 200 tickets change in between.
  • No rate limits are published.

Webhooks

Ticket sync webhook (Starter, signed)

Set it up under Tickets → Settings → CRM sync → Custom CRM (webhook).

  • Headers: X-Aivastark-Event, X-Aivastark-Delivery (an idempotency key), X-Aivastark-Timestamp (Unix seconds) and X-Aivastark-Signature.
  • Signature: sha256=<hex HMAC-SHA256 of "<timestamp>.<raw body>"> with the signing secret shown once when you create the target. Reject deliveries older than 5 minutes.
  • Events: ticket.created, status_changed, priority_changed, assigned, unassigned, comment_added, tags_changed, reopened, solved, closed, merged, sla_warned, sla_breached, csat_received.
  • Body: { event, event_id, occurred_at, actor, changes, ticket }.
  • Retries: up to 6 attempts with growing backoff, capped at 6 hours. A 4xx other than 408, 425 or 429 is not retried, and a target is paused after 20 failures in a row. The dashboard keeps a delivery log with Retry now.

Automation webhook step (Starter, signed)

Set it up under Automations → a Webhook step.

  • Headers: X-Aivastark-Signature: sha256=<hex HMAC-SHA256 of the raw body> and X-Aivastark-Timestamp (ISO time). The secret is shown once, after the first save.
  • Body: { event: "workflow.submission", workflow_id, workflow_name, run_id, conversation_id, fields, submitted_at }.
  • Retried once, and only when the request never reached your server.

Lead webhook (Solo, not signed)

Set it up under Leads → Form → Webhook URL.

  • Not signed: use an endpoint URL that carries a secret token you check.
  • Body: { event: "lead.created", lead_id, project_id, fields, session_id, conversation_id, created_at, category, intent_score, intent_band, tags, capture_summary, page_path, utm }.
  • Retries: up to 6 attempts with growing backoff. A 4xx other than 408 or 429 is not retried.

Website widget

Add the widget to any page with two script tags:

<script>
  window.AivastarkConfig = { key: "YOUR_WIDGET_KEY" };
</script>
<script src="https://www.aivastark.com/widget.js" async></script>

Configuration keys:

  • key: your widget key (required).
  • user, or getUser(): the signed-in visitor as { id, name, email, plan, company, traits, signature }. id is required.
  • userToken, or getUserToken(): the visitor's own auth token, forwarded only to MCP servers you set to act on the visitor's behalf.
  • shop: the Shopify store domain, set by the Shopify app embed.

Verified visitor identity

window.AivastarkConfig = {
  key: "YOUR_WIDGET_KEY",
  user: {
    id: "user_123",
    email: "ada@example.com",
    // hex HMAC-SHA256 of the id, computed on your server
    signature: "<64 hex characters>",
  },
};

Visitor identity: compute signature = hex(HMAC-SHA256(signing secret, user id)) on your server, never in the browser. The signing secret is under Integrations → Logged-in visitors → User Identity, with snippets for common auth providers. A visitor with a missing or wrong signature is treated as unverified, not rejected. Listed on the Growth plan.

  • The widget has no JavaScript method API (open, close or send).
  • Configure it with window.AivastarkConfig before the script loads; data- attributes are not read.

Visitor Lenz server endpoints

Server-to-server calls that enrich Visitor Lenz. Sign requests on your server, never in the browser.

  • POST https://www.aivastark.com/api/v1/identify. Auth: key (widget key) and signature over userId. userId, name, email, plan, company, traits. Updates a visitor already seen in the browser.
  • POST https://www.aivastark.com/api/v1/revenue. Auth: key and signature over orderId. orderId, amount, currency, email, userId, provider (stripe, shopify, lemonsqueezy, paddle, polar, manual), status (paid or refunded), occurredAt.
  • POST https://www.aivastark.com/api/v1/ai-crawl. Auth: t: your server ingest token. { t, ua, path }, or { t, hits: [{ ua, path, ts }] } with up to 500 hits. Reports AI crawler visits your server saw.

Let the agent call your systems

MCP servers (Starter)

Remote MCP servers over Streamable HTTP, HTTPS only, with OAuth or up to five custom auth headers (stored encrypted). Each tool can be switched on or off and set to ask the visitor to confirm. Optionally forwards the signed-in visitor's token. Set it up under Agent → Tools → MCP servers.

Connect an API (Starter)

Turns one of your GET endpoints into a tool: a URL template with up to 12 {placeholder} parameters, encrypted headers, an 8-second default timeout (15 seconds at most) and responses cut to 256 KB. Mark it read-only, reversible or irreversible; anything but read-only asks the visitor to confirm. Set it up under Agent → Tools → Connect an API.

Install options

  • Any website: the two script tags above.
  • WordPress: the official plugin, or the shortcode [aivastark key="…"].
  • Shopify: the official app's App Embed.
  • Google Tag Manager: a tag template.
  • Next.js: the snippet with next/script, from the dashboard.
  • GitHub (Starter): a one-click pull request that adds the snippet to a Next.js or React app.

Not available

  • A general REST API to query the agent, add knowledge sources, read conversations or manage widgets.
  • JavaScript methods to open, close or message the widget.
  • A React component or SDK package; use the snippet.
  • Published rate limits.

Need something that isn't here? Email support@aivastark.com.

Developer questions

Does Aivastark have a REST API?

Aivastark has one REST API, for support tickets: list, create, update and comment on tickets with a project API key, from the Starter plan. There is no general REST API for querying the agent, adding knowledge or reading conversations. Signed webhooks, the widget configuration and agent tools cover the other integrations.

How do I authenticate with the ticket API?

Send your key as a Bearer token: Authorization: Bearer ask_live_…. Create keys in the dashboard under Tickets → Settings → API keys. A key is shown once, stored only as a hash, belongs to one project and can be revoked at any time. Keep it on your server.

How do I verify an Aivastark webhook?

For the ticket sync webhook, compute an HMAC-SHA256 of the timestamp header, a dot and the raw body with your signing secret, and compare it with the X-Aivastark-Signature header; reject anything older than 5 minutes. Automation webhooks sign the raw body only. The lead webhook is not signed, so put a secret token in its URL.

Can I tell the widget who the logged-in visitor is?

Yes. Pass the visitor in window.AivastarkConfig.user with an id and a signature: a hex HMAC-SHA256 of the id made on your server with the signing secret from Integrations → Logged-in visitors. The agent then treats the visitor as verified; without a valid signature they are treated as unverified.

Can the AI agent call my own API?

Yes, from the Starter plan. Connect a remote MCP server, or use Connect an API to turn one of your GET endpoints into a tool the agent calls mid-conversation. You choose which tools are on, and anything that is not read-only asks the visitor to confirm first.