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

# API Reference

> Base URL, authentication, response format, error codes, pagination, and rate limits for the Autoposting API.

## Base URL

| Environment | URL                                    |
| ----------- | -------------------------------------- |
| Production  | `https://app.autoposting.ai/api-proxy` |

All API paths below are relative to this base. The interactive playground on each endpoint page is pre-configured with it.

## Authentication

Pass your API key on every request:

<CodeGroup>
  ```bash Bearer Token theme={null}
  Authorization: Bearer sk-social-your-key
  ```

  ```bash API Key Header theme={null}
  x-api-key: sk-social-your-key
  ```
</CodeGroup>

Generate keys in the dashboard or via `POST /api-keys`. Keys are org-scoped and work for all content operations.

## Response Format

Every endpoint returns a consistent JSON envelope:

<CodeGroup>
  ```json Success theme={null}
  {
    "success": true,
    "data": { }
  }
  ```

  ```json Error theme={null}
  {
    "success": false,
    "error": "error_code",
    "message": "Human-readable description"
  }
  ```
</CodeGroup>

## Error Codes

| Status | Code                   | Meaning                                                    |
| ------ | ---------------------- | ---------------------------------------------------------- |
| `400`  | —                      | Bad request — missing or invalid parameters                |
| `401`  | —                      | Unauthorized — invalid or missing API key                  |
| `402`  | `insufficient_credits` | Not enough credits for this operation                      |
| `403`  | `billing_suspended`    | Subscription expired or suspended                          |
| `404`  | —                      | Resource not found or not owned by your org                |
| `409`  | —                      | Conflict — missing connection, expired token, or duplicate |
| `429`  | —                      | Rate limited — back off and retry                          |
| `500`  | —                      | Internal server error                                      |

<Warning>
  All mutation endpoints enforce billing status. Suspended orgs receive `403 billing_suspended` on all content-creation routes.
</Warning>

## Pagination

Offset-based pagination on all list endpoints:

| Parameter | Default | Max   | Description    |
| --------- | ------- | ----- | -------------- |
| `limit`   | `50`    | `100` | Items per page |
| `offset`  | `0`     | —     | Items to skip  |

Responses include a `total` count for computing page ranges:

```
GET /posts?brandSlug=my-brand&limit=20&offset=40
```

## Rate Limiting

Signup is limited to 5 requests per IP per hour. General API requests are subject to per-org limits. On `429`, back off and retry after the interval indicated in the response.

## Health Check

```bash theme={null}
curl https://app.autoposting.ai/api-proxy/health
# { "success": true }
```

No authentication required. Returns `200 OK` when the API is operational.

<CardGroup cols={2}>
  <Card title="TypeScript SDK" icon="brackets-curly" href="/sdks/typescript">
    Zero-dependency TypeScript client for Node.js 20+.
  </Card>

  <Card title="MCP Tools" icon="robot" href="/mcp/tools">
    Call the API through AI assistants.
  </Card>

  <Card title="CLI Commands" icon="terminal" href="/cli/commands">
    Terminal access to all operations.
  </Card>

  <Card title="Authentication" icon="key" href="/authentication">
    Session tokens, OAuth flows, and API keys.
  </Card>
</CardGroup>
