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

# API Reference

> Base URL, authentication, pagination and error handling for the Starleads public API.

Every endpoint of the Starleads public API is documented in this section, grouped by resource.

<Note>**Base URL**: `https://api.starleads.co` — every request requires the `X-Api-Key` header.</Note>

## Where to start

Most integrations only need the campaign endpoints: create a campaign, push your prospects into it, then receive the results via webhook.

<CardGroup cols={2}>
  <Card title="Campaigns" icon="bullhorn" href="/api-reference/campaign/get-all-campaigns">
    List and create the campaigns your AI agents run.
  </Card>

  <Card title="Campaign Items" icon="user-plus" href="/api-reference/campaignitem/get-campaign-items-with-filters">
    Add, retrieve and remove the prospects of a campaign.
  </Card>

  <Card title="Campaign Fields" icon="table-columns" href="/api-reference/campaignfield/get-campaigns-fields">
    Read the custom fields expected in an item's `databag`.
  </Card>

  <Card title="Agents" icon="robot" href="/api-reference/agent/get-the-prompt-of-an-agent">
    Read and update an agent's prompt, and connect it to a knowledge base.
  </Card>
</CardGroup>

## Knowledge base (RAG)

Optional. Use these endpoints only if you want your agents to answer from your own documents. Start with the [Knowledge Base guide](/documentation/rag-knowledge-base) rather than the raw endpoints — the objects have to be created in order.

<CardGroup cols={2}>
  <Card title="Datasets" icon="database" href="/api-reference/dataset/list-datasets">
    Containers holding the documents your agents draw answers from.
  </Card>

  <Card title="Documents" icon="file-lines" href="/api-reference/document/list-documents-in-a-dataset">
    Upload, parse and manage the files inside a dataset.
  </Card>

  <Card title="Knowledge Base Chats" icon="comments" href="/api-reference/knowledgebasechat/list-knowledge-base-chats">
    The retrieval configuration an agent is connected to.
  </Card>

  <Card title="Knowledge Graph" icon="diagram-project" href="/api-reference/knowledgegraph/get-the-knowledge-graph">
    Extract entities and relations from a dataset.
  </Card>
</CardGroup>

## Conventions

**Authentication** — pass your key in the `X-Api-Key` header on every call. See the [Authentication guide](/documentation/authentification) to retrieve it.

**Pagination** — list endpoints accept `pageNumber` (starts at 1) and `pageSize` (1 to 100, default 50). Responses carry `data`, `total`, `pageNumber` and `pageSize`.

**Errors** — failures return an [RFC 7807](https://datatracker.ietf.org/doc/html/rfc7807) problem object.

| Status | Meaning                                                     |
| ------ | ----------------------------------------------------------- |
| `400`  | The request payload or a parameter is invalid.              |
| `401`  | The `X-Api-Key` header is missing, unknown or inactive.     |
| `403`  | The resource exists but your API key cannot act on it.      |
| `404`  | The resource does not exist, or belongs to another company. |
| `429`  | Rate limit exceeded — see `Retry-After`.                    |

<Note>A resource owned by another company answers `404`, not `403`, so the API never discloses that it exists.</Note>

**Rate limiting** — responses carry `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. Heavy operations (uploads, parsing, knowledge graph builds) have tighter limits than plain CRUD calls.
