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

# API and AI assistants

> API tokens, the REST API, and connecting an AI assistant such as Claude over MCP

Everything on this page uses **API tokens**. Open **API Tokens** in the menu, give the token a name and press **Create**. The token is shown **once**: copy it then. Revoke it any time and whatever uses it stops working immediately.

## Read-only tokens

Tick **Read-only** when you create a token and it can look at your accounts, posts, campaigns and media, but **cannot create or schedule posts**. This is the safer choice for anything you are only trying out, and for an AI assistant you want to watch before you trust it. The token list shows each token's access, **Full** or **Read-only**. Tokens made before version 1.2.0 keep full access.

## Connect an AI assistant (MCP)

Azvian Social speaks the **Model Context Protocol (MCP)**, so an assistant that supports it, such as Claude, can work with your social media for you: *"What is scheduled for next week?"*, *"Draft three posts about our spring range for the Facebook page"*, *"Schedule that second one for Tuesday at 9."*

1. Create a token (read-only if the assistant should only look).
2. In the assistant, add a remote MCP server with the address shown on the **API Tokens** page, `https://your-site.example/api/mcp`, and send the token as a bearer token (`Authorization: Bearer <token>`).

For Claude Code the page shows the exact command:

```bash theme={null}
claude mcp add --transport http azvian-social https://your-site.example/api/mcp --header "Authorization: Bearer YOUR_TOKEN"
```

What the assistant can do:

| Tool | What it does | Needs a full-access token |
| - | - | - |
| `list_accounts` | Your connected accounts and their ids | No |
| `list_posts` | Posts, newest first, filtered by status | No |
| `list_campaigns` | Campaigns with status and post counts | No |
| `list_media` | Files in the media library | No |
| `create_post` | A post for one or more accounts. A **draft** unless a time is given | Yes |
| `schedule_post` | Schedules an existing post for a future time | Yes |

> [!NOTE]
>
> The assistant can **draft and schedule**, and a scheduled post is published automatically at its time, like any other. It cannot delete posts, change connections, or see other accounts' data. If you want to read everything before it goes out, ask for drafts, then schedule them yourself.

It follows the same rules as the REST API, because it uses the same code: only your own accounts and media, a post is limited to 5000 characters, and a scheduled time must be in the future. Requests are limited to 120 a minute per user. It works over plain HTTPS, so it runs on ordinary shared hosting. Nothing needs to stay running.

## The REST API

The same token works for the REST API under `/api/v1`, sent as `Authorization: Bearer <token>`:

| Method and path | What it does |
| - | - |
| `GET /api/v1/accounts` | Connected accounts |
| `GET /api/v1/posts?status=scheduled` | Posts (paged, `per_page` up to 100) |
| `POST /api/v1/posts` | Create a post (`content`, `social_account_ids`, optional `media_ids`, `campaign_id`, `scheduled_at`). Needs full access |
| `POST /api/v1/posts/{id}/schedule` | Schedule a post (`scheduled_at`). Needs full access |
| `GET /api/v1/campaigns` | Campaigns |
| `GET /api/v1/media` | Media library |

A read-only token that tries to create or schedule gets a `403` answer. To be told when posts are published, see **Webhooks** in the menu.

## Troubleshooting

* **`401` from the assistant:** the token is wrong, revoked or missing the `Bearer ` prefix.
* **"This token is read-only":** create a new token without the Read-only box ticked.
* **"The request was not valid":** the assistant sent something the API refuses, such as an account id that is not yours or a time in the past. The message says which, and the assistant can correct it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.