API Reference · v1

Fluxy API

The Fluxy API lets you integrate a Fluxy bot into any website, app, or backend you control. Create conversations, send messages, and list or read every conversation your bot has had — web and WhatsApp — on the exact same AI pipeline that powers Fluxy's own web widget and WhatsApp integration.

All requests are made server-to-server. Never call the Fluxy API directly from client-side code — your API secret would be exposed to anyone who opens their browser's network tab. Route requests through your own backend instead.

Base URL

https://flux-backend-y9vv.onrender.com

Authentication

Every request must include an API secret in the Authorization header, as a Bearer token. Each secret is scoped to a single bot — there's no need to also pass a bot ID or slug, the secret identifies it.

Generate a secret from your Fluxy dashboard: open a bot, go to its API tab, and click Generate secret. The plaintext value is shown exactly once — store it in your backend's environment variables or secret manager. If it's ever exposed, revoke it from that same screen and generate a new one.

http
Authorization: Bearer fxk_a01abde6b4b1b1efb96fa133d831a0fa...

Errors

Errors are returned as JSON with a machine-readable code and a human-readable message:

json
{
  "error": {
    "code": "invalid_api_secret",
    "message": "This API secret is invalid or has been revoked."
  }
}
StatusCodeDescription
401missing_api_secretNo Authorization header was sent.
401invalid_api_secretThe secret doesn't exist or was revoked.
403bot_inactiveThe bot this secret belongs to is currently inactive.
404conversation_not_foundNo conversation with that ID exists for this bot.
400invalid_requestA required field is missing or has the wrong type.
400invalid_cursorThe cursor is malformed. Use the exact next_cursor value from a previous response.
429rate_limitedToo many requests — see Rate limits below.
500internal_errorSomething went wrong on our end.

Rate limits

Sending messages is limited to 60 requests per minute per bot, since each one triggers an OpenAI call billed to your account. Listing and retrieving conversations is limited to 120 requests per minute per bot. Creating conversations and reading message history are not rate limited. If you exceed a limit, you'll get a 429 with code rate_limited — back off and retry.

Pagination

List endpoints use cursor-based pagination. Every list response has the same envelope:

json
{
  "data": [ ... ],
  "has_more": true,
  "next_cursor": "eyJ0IjoiMjAyNi0xMC0xN1QxODo1Nzo1Mi4wMDYwMDBaIiwiaSI6Ii4uLiJ9"
}

To get the next page, send the same request again with cursor set to the next_cursor you received. Keep going until has_more is false (at that point next_cursor is null).

  • Treat the cursor as an opaque string — don't parse or build it yourself, its format can change.
  • Keep the same filters on every page of a walk; a cursor only makes sense together with the filters it was issued for.
  • Pages stay fast however deep you go. If a conversation receives a new message while you're paging, it moves to the top of the list: it will never appear twice in one walk, but a walk that is already past the top won't see it until you start over. For keeping a copy in sync, poll with updated_after instead of re-walking everything.
  • limit defaults to 20 for conversations (max 100) and 50 for messages (max 200).
GET/api/v1/bots/me

Get bot info

Returns public information about the bot your API secret belongs to. Useful for rendering a chat header (name, theme) without hardcoding it in your integration.

Example request

bash
curl https://flux-backend-y9vv.onrender.com/api/v1/bots/me \
  -H "Authorization: Bearer fxk_..."

Example response

json
{
  "id": 24,
  "name": "_luma",
  "company_name": "_luma",
  "theme": "default",
  "language": "es",
  "initial_message": "Hi! I'm Luma from _luma...",
  "active": true
}
POST/api/v1/conversations

Create a conversation

Starts a new conversation for the authenticated bot. If you already know who you're talking to (e.g. a logged-in user on your site), pass their identity here — it's fixed for the lifetime of this conversation and can't be changed by later messages. If the actual person changes mid-conversation, create a new conversation rather than reusing this one.

Any identity you provide is immediately visible to the bot itself — it won't ask the user for their name again if you already passed it here, the same way it already knows a WhatsApp user's profile name and number without asking.

Body parameters

NameTypeDescription
nameoptionalstringThe end user's name, if known.
emailoptionalstringThe end user's email, if known.
phoneoptionalstringThe end user's phone number, if known.
custom_dataoptionalobjectAny extra structured data you want attached to this conversation (e.g. { "plan": "pro" }). Stored as-is, not read by the AI unless your bot's prompt references it.

Example request

bash
curl -X POST https://flux-backend-y9vv.onrender.com/api/v1/conversations \
  -H "Authorization: Bearer fxk_..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Juan Perez",
    "email": "juan@example.com",
    "custom_data": { "plan_interest": "pro" }
  }'

Example response

json
{
  "conversation_id": "4ccfe5fd-ba65-42c1-a726-b21a3badcf25",
  "created_at": "2026-07-06T17:20:18.874Z"
}
GET/api/v1/conversations

List conversations

Returns every conversation of your bot — web and WhatsApp, including the ones your end users started on their own, not just the ones you created through the API — most recent activity first. It's what you need to show a conversation inbox in your own dashboard. Results are paginated (see Pagination).

Query parameters

NameTypeDescription
limitoptionalintegerItems per page, 1 to 100. Defaults to 20.
cursoroptionalstringThe next_cursor from the previous page.
channeloptionalstringOnly conversations from this channel: web or whatsapp.
searchoptionalstringCase-insensitive match on the contact's name, email or phone number. Max 100 characters.
updated_afteroptionalISO 8601Only conversations whose last activity is after this moment (exclusive). Use it to sync incrementally.
updated_beforeoptionalISO 8601Only conversations whose last activity is before this moment (exclusive).
created_afteroptionalISO 8601Only conversations started after this moment (exclusive).
created_beforeoptionalISO 8601Only conversations started before this moment (exclusive).

Example request

bash
curl "https://flux-backend-y9vv.onrender.com/api/v1/conversations?channel=whatsapp&limit=2" \
  -H "Authorization: Bearer fxk_..."

Example response

json
{
  "data": [
    {
      "id": "d95f2b0b-da84-45e1-a208-96e52e0e615d",
      "channel": "whatsapp",
      "contact": {
        "name": "Maria Lopez",
        "email": null,
        "phone": "5491133445566"
      },
      "summary": null,
      "source": "organic",
      "message_count": 4,
      "last_message": {
        "sender": "bot",
        "content": "Hi Maria! How can I help you today?",
        "media_url": null,
        "created_at": "2026-10-17T18:57:52.006Z"
      },
      "created_at": "2026-10-17T01:24:35.739Z",
      "last_activity_at": "2026-10-17T18:57:52.006Z"
    }
  ],
  "has_more": true,
  "next_cursor": "eyJ0IjoiMjAyNi0xMC0xN1QxODo1Nzo1Mi4wMDYwMDBaIiwiaSI6Ii4uLiJ9"
}

The conversation object

NameTypeDescription
idoptionalstringConversation ID. Use it with the message-history and get-conversation endpoints.
channeloptionalstringweb or whatsapp.
contactoptionalobjectname, email and phone of the end user, each null when unknown. For WhatsApp, phone is the user's WhatsApp number.
summaryoptionalstring | nullA short summary of the conversation, when one was generated.
sourceoptionalstring | nullad when a WhatsApp conversation started from a Click-to-WhatsApp ad, organic when it didn't, null when unknown (web, older conversations).
message_countoptionalintegerNumber of messages in the conversation (yours and the user's).
last_messageoptionalobject | nullThe most recent message: sender (customer, bot or agent), content, media_url and created_at.
created_atoptionalISO 8601When the conversation started.
last_activity_atoptionalISO 8601When the last message was sent (or when it started, if it has none). This is what the list is ordered by.

A WhatsApp contact can have more than one conversation over time. If you want one thread per person, group the results by contact.phone. A sender of agent is a message written by a human from the Fluxy dashboard (WhatsApp's manual mode) rather than by the bot.

Example: fetch everything

javascript
async function fetchAllConversations() {
  const all = []
  let cursor = null

  do {
    const url = new URL("https://flux-backend-y9vv.onrender.com/api/v1/conversations")
    url.searchParams.set("limit", "100")
    if (cursor) url.searchParams.set("cursor", cursor)

    const res = await fetch(url, {
      headers: { Authorization: `Bearer ${process.env.FLUXY_API_SECRET}` },
    })
    if (!res.ok) throw new Error(`Fluxy API error ${res.status}`)

    const page = await res.json()
    all.push(...page.data)
    cursor = page.has_more ? page.next_cursor : null
  } while (cursor)

  return all
}

To keep a local copy fresh, store the highest last_activity_at you've seen and next time ask only for what changed: ?updated_after=<that value>.

GET/api/v1/conversations/{id}

Get a conversation

Returns one conversation: the same fields as a list item, plus custom_data — the structured data the bot collected during the chat (for example a name, an email or any custom field configured for your bot), together with whatever you passed as custom_data when you created it. Fetch the messages with Get message history.

Path parameters

NameTypeDescription
idrequiredstringThe conversation ID.

Example request

bash
curl https://flux-backend-y9vv.onrender.com/api/v1/conversations/d95f2b0b-da84-45e1-a208-96e52e0e615d \
  -H "Authorization: Bearer fxk_..."

Example response

json
{
  "id": "d95f2b0b-da84-45e1-a208-96e52e0e615d",
  "channel": "whatsapp",
  "contact": { "name": "Maria Lopez", "email": null, "phone": "5491133445566" },
  "summary": null,
  "source": "organic",
  "message_count": 4,
  "last_message": {
    "sender": "bot",
    "content": "Hi Maria! How can I help you today?",
    "media_url": null,
    "created_at": "2026-10-17T18:57:52.006Z"
  },
  "created_at": "2026-10-17T01:24:35.739Z",
  "last_activity_at": "2026-10-17T18:57:52.006Z",
  "custom_data": {
    "nombre_usr": "Maria Lopez",
    "phone_usr": "5491133445566",
    "email_usr": ""
  }
}
POST/api/v1/conversations/{id}/messages

Send a message

Sends a message on behalf of the end user and returns the bot's reply. This runs through the exact same AI pipeline as Fluxy's own web widget and WhatsApp integration — same prompt, same tools, same behavior.

Path parameters

NameTypeDescription
idrequiredstringThe conversation ID returned by Create a conversation.

Body parameters

NameTypeDescription
messagerequiredstringThe end user's message. Max 600 characters.
media_urloptionalstringA publicly reachable URL to an image the end user is attaching to this message (e.g. a photo uploaded on your site). Same mechanism used when a WhatsApp user sends a picture — this endpoint doesn't accept file uploads directly, you host the image and pass its URL.

Example request

bash
curl -X POST https://flux-backend-y9vv.onrender.com/api/v1/conversations/4ccfe5fd-ba65-42c1-a726-b21a3badcf25/messages \
  -H "Authorization: Bearer fxk_..." \
  -H "Content-Type: application/json" \
  -d '{ "message": "What web services do you offer?" }'

Example response

json
{
  "conversation_id": "4ccfe5fd-ba65-42c1-a726-b21a3badcf25",
  "message": "We build custom websites, e-commerce platforms..."
}

Note: attaching media_url stores the image and makes it available to specific bot features that expect one (like attaching a photo to a report). The bot does not visually analyze arbitrary images sent in normal conversation — it won't describe what's in a photo unless a feature built for that image explicitly handles it.

The events field

Some turns do more than reply with text — for example, if your bot has Contact requests enabled and the end user just finished leaving their details, this exact response also includes an events array describing what happened, so you don't have to poll or guess. Most responses don't include it at all — check for it with if (response.events?.length).

json
{
  "conversation_id": "4ccfe5fd-ba65-42c1-a726-b21a3badcf25",
  "message": "Thanks! Someone from the team will reach out soon.",
  "events": [
    {
      "type": "contact_request.created",
      "data": {
        "status": "pendiente",
        "created_at": "2026-07-18T16:57:36.620Z",
        "fields": [
          { "key": "nombre_usr", "label": "Nombre", "required": true, "value": "Maria" },
          { "key": "phone_usr", "label": "WhatsApp", "required": true, "value": "5491133445566" },
          { "key": "motivo", "label": "Motivo de la consulta", "required": false, "value": "Quiero saber sobre ecommerce" },
          { "key": "empresa", "label": "Nombre de la empresa", "required": false, "value": null }
        ]
      }
    }
  ]
}

contact_request.created fires the moment a contact request is saved (see Contact requests below). Its fields array mirrors exactly what you configured for this bot in the dashboard — required tells you whether that field was mandatory, and value is null when the user skipped an optional one.

Contact requests

Web conversations don't have a live human-handoff mode the way WhatsApp does — there's no agent who can jump into the chat in real time. Contact requests are the web equivalent: when an end user wants to talk to a person, the bot collects a few details conversationally and saves them so your team can follow up outside the chat (by phone, WhatsApp, email — whatever you configured).

This is entirely configured from the Fluxy dashboard, per bot — open the bot, go to its Contact requests tab, turn it on, and pick which fields to ask for (name, WhatsApp, email, reason for contact, etc.) and which of those are required. There's nothing to call in the API to set this up, and nothing to configure per request — it runs automatically as part of the normal conversation once it's turned on for that bot.

When it fires during a conversation, you find out through the same Send a message call that was already in progress — that response includes a contact_request.created event (see the events field above) with everything that was collected. You can also see the same information later in the dashboard, under Solicitudes.

Note: this only applies to web conversations. WhatsApp conversations already have a real human takeover mode in the dashboard, so this feature doesn't apply there.

Message formatting

The message field returned by Send a message (and by Get message history) is plain text with lightweight Markdown — currently just bold, using double asterisks. Render it with a Markdown parser rather than displaying it as-is, or you'll show the raw asterisks to your users.

text
"We build **custom websites**, **e-commerce platforms**, and web apps."

Bot replies can also include links in the text (for example, pointing to a product page or a booking confirmation) — by default as a plain URL, e.g. https://example.com/product, rather than Markdown link syntax. Detect and linkify URLs on your end if you want them clickable in your UI.

GET/api/v1/conversations/{id}/messages

Get message history

Returns the messages of a conversation. By default you get the full history, oldest first — useful for rebuilding a chat UI after a page refresh. For long conversations (a busy WhatsApp thread can have hundreds of messages), pass limit to paginate (see Pagination), and order=desc to load the newest messages first.

Path parameters

NameTypeDescription
idrequiredstringThe conversation ID.

Query parameters

NameTypeDescription
limitoptionalintegerMessages per page, 1 to 200. If you send neither limit nor cursor, the whole history is returned in one response.
cursoroptionalstringThe next_cursor from the previous page. Sending it without limit uses a page size of 50.
orderoptionalstringasc (oldest first, the default) or desc (newest first).

Example request

bash
curl "https://flux-backend-y9vv.onrender.com/api/v1/conversations/4ccfe5fd-ba65-42c1-a726-b21a3badcf25/messages?limit=50&order=desc" \
  -H "Authorization: Bearer fxk_..."

Example response

json
{
  "conversation_id": "4ccfe5fd-ba65-42c1-a726-b21a3badcf25",
  "messages": [
    {
      "id": 35750,
      "role": "assistant",
      "sender": "bot",
      "content": "We build custom websites, e-commerce platforms...",
      "media_url": null,
      "created_at": "2026-07-06T17:20:36.950Z"
    },
    {
      "id": 35749,
      "role": "user",
      "sender": "customer",
      "content": "What web services do you offer?",
      "media_url": null,
      "created_at": "2026-07-06T17:20:29.199Z"
    }
  ],
  "has_more": false,
  "next_cursor": null
}

role is user or assistant — handy to feed straight into a chat UI. sender is more specific: customer, bot, or agent (a human replying from the Fluxy dashboard).

    API Documentation | Fluxy IA