> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flowyte.com/llms.txt
> Use this file to discover all available pages before exploring further.

# For AI agents

> How an LLM or coding agent builds and operates a Flowyte agent end to end, via the API.

This page is written for an **AI agent** (or a developer's coding assistant) building against
Flowyte programmatically. Everything a person can do in the dashboard is available over the API,
so an agent can create, configure, publish, and test a Flowyte agent on its own.

## Machine-readable resources

| Resource                       | URL                                                             |
| ------------------------------ | --------------------------------------------------------------- |
| Plain-text index of every page | [`/llms.txt`](https://flowyte.mintlify.site/llms.txt)           |
| Full docs as one file          | [`/llms-full.txt`](https://flowyte.mintlify.site/llms-full.txt) |
| Markdown of any page           | append `.md` to its URL                                         |
| Docs MCP server                | `https://flowyte.mintlify.site/mcp`                             |
| OpenAPI contract               | the **API Reference** tab                                       |

## Authentication

Every request uses a secret API key as a bearer token:

```
Authorization: Bearer flowyte_sk_…
```

Base URL: `https://builder.flowyte.com/api/v1`. The first key is created in the dashboard's
Developer page; the key alone determines your organization (no other headers needed). Each
endpoint lists the **scope** the key must hold — request only what you need.

## The build sequence

<Steps>
  <Step title="Create an agent">
    `POST /agents` → capture `data.id`.
  </Step>

  <Step title="Give it knowledge">
    `POST /agents/{id}/knowledge/sources`, then **poll** `GET …/sources/{id}` until
    `status` is `indexed` (ingestion is asynchronous).
  </Step>

  <Step title="Add skills">
    `POST /agents/{id}/skills` for actions like transfer or booking.
  </Step>

  <Step title="Publish">
    `POST /agents/{id}/publish` — freezes the version that channels will serve.
  </Step>

  <Step title="Test">
    `POST /agents/{id}/simulate` — streams the conversation over SSE.
  </Step>

  <Step title="Go live">
    `POST /agents/{id}/publishable-keys` for the chat widget, or assign a phone number.
  </Step>
</Steps>

## Rules that prevent the common mistakes

<Note>
  * **Test with `POST /agents/{id}/simulate`** (SSE) — not `/chat/completions`.
  * **Phone and chat serve the last *published* version.** Edits change the *draft*. Always publish before going live; `409 no_published_version` means "publish first."
  * **Knowledge ingestion is async** — poll a source until `status: indexed` before relying on it.
  * **Responses** are the `ApiResponse<T>` envelope (`{ success, data }`). **Lists** use cursor pagination — follow the returned cursor, not page numbers.
  * **Errors** are RFC 9457 problem+json — branch on the `type` / `status`.
  * **Streaming** endpoints are Server-Sent Events: read frames `event:<type>\ndata:<json>`, stop on `event: done`.
</Note>

Start with the [Quickstart](/quickstart), then browse the [API Reference](/api-reference/introduction).
