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

# API Reference

> Base URL, conventions, errors, and the resource groups that make up the AutoSage API.

This reference covers the core AutoSage API resources and runtime workflows. For the complete current route and schema inventory, use the OpenAPI explorer at `/swagger`. If you are new to the API, read the [Introduction](/developers/introduction) and [Authentication](/developers/authentication) first, then follow the [Quickstart](/developers/quickstart).

## Base URL

All resource endpoints are served under a versioned prefix:

```
https://api.autosage.ai/api/v1
```

Authentication flows live under `/api/auth`, and invitation endpoints are served at the root (`/invites`). Every endpoint page states its exact path.

## Versioning

The current resource API uses the `/api/v1` path prefix. Write clients that ignore unknown response fields, and use the OpenAPI explorer for the current contract.

## Conventions

<CardGroup cols={2}>
  <Card title="JSON everywhere" icon="brackets-curly">
    Requests and responses are JSON. Send `Content-Type: application/json` on any request with a body.
  </Card>

  <Card title="Bearer auth" icon="key">
    Authenticate with an API key: `Authorization: Bearer sk_...`. See [Authentication](/developers/authentication).
  </Card>

  <Card title="Schema-defined fields" icon="text">
    Field naming follows each endpoint schema and can mix styles. Use the endpoint reference or OpenAPI explorer for the exact shape.
  </Card>

  <Card title="Predictable errors" icon="triangle-exclamation">
    Errors return the right HTTP status with a JSON message. See the table below.
  </Card>
</CardGroup>

## Error codes

| Status | Meaning      | Typical cause                                                            |
| ------ | ------------ | ------------------------------------------------------------------------ |
| `400`  | Bad request  | Validation failed — a field is missing, malformed, or out of range.      |
| `401`  | Unauthorized | Missing, malformed, or invalid credentials.                              |
| `403`  | Forbidden    | Authenticated, but lacking the required role or scope.                   |
| `404`  | Not found    | The resource does not exist or is outside your access.                   |
| `409`  | Conflict     | The request collides with existing state (for example a duplicate name). |

Errors return a JSON body with a human-readable `message`. Treat any non-2xx status as a failure and read the message for detail.

## Who can call what

Endpoints differ in the kind of caller they accept:

<CardGroup cols={2}>
  <Card title="User session required" icon="user">
    Organization, environment, and member administration. These are dashboard operations and are intentionally not exposed to API keys.
  </Card>

  <Card title="API key allowed" icon="robot">
    Content operations — tenants, knowledge bases, documents, chats, and agents — accept API keys so your application can run them directly.
  </Card>
</CardGroup>

Throughout this reference each endpoint is tagged: **\[User]** requires a user session, **\[Key]** accepts an API key, and **\[User+Key]** accepts either.

## Resource groups

<CardGroup cols={2}>
  <Card title="Organizations" icon="building" href="/developers/api/organizations">
    Create organizations and manage members, roles, and invitations.
  </Card>

  <Card title="Environments" icon="layer-group" href="/developers/api/environments">
    Isolate dev, staging, and production inside an organization.
  </Card>

  <Card title="Tenants" icon="box" href="/developers/api/tenants">
    Provision tenants, set limits, and manage tenant memory.
  </Card>

  <Card title="Users" icon="user" href="/developers/api/users">
    Discover the resources and scopes the current caller can reach.
  </Card>

  <Card title="Invites" icon="envelope" href="/developers/api/invites">
    Accept team invitations and read invite details.
  </Card>

  <Card title="API keys" icon="key" href="/developers/api/api-keys">
    Create, list, and revoke the `sk_...` keys your application uses.
  </Card>

  <Card title="Billing" icon="credit-card" href="/developers/api/billing">
    Read credit balances and usage for a tenant.
  </Card>

  <Card title="Knowledge bases" icon="book" href="/developers/api/knowledge-bases">
    Configure retrieval boundaries, prompts, sharing, and restricted memory.
  </Card>

  <Card title="Documents" icon="file" href="/developers/api/documents">
    Upload, discover, inspect, reprocess, download, and delete content.
  </Card>

  <Card title="Chats" icon="comments" href="/developers/api/chats">
    Create conversations, send messages, stream runs, and manage chat access.
  </Card>

  <Card title="Agents" icon="robot" href="/developers/api/agents">
    Configure, deploy, schedule, run, and archive saved agents.
  </Card>

  <Card title="Shared chats" icon="share-nodes" href="/developers/api/shared-chats">
    Read sanitized public or organization-shared transcripts.
  </Card>

  <Card title="Connectors & connections" icon="database" href="/developers/api/connectors">
    Configure connected app access; use `/swagger` for database connection routes.
  </Card>

  <Card title="Skills" icon="book" href="/developers/api/skills">
    Manage the reusable skill library that agents attach at run time.
  </Card>
</CardGroup>

## Interactive explorer

<Tip>
  An OpenAPI-powered explorer is available at `/swagger` on the API host. Use it to see full request and response schemas for any endpoint; these pages add the concepts, roles, and guidance the raw schema can't express.
</Tip>
