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

# Create an API key

> Make an API key for the PublishBuddy API or an AI assistant over MCP, and pick what it's allowed to do.

An API key lets your own scripts, or an AI assistant like Claude or Cursor, work with your PublishBuddy workspaces. Each key acts as you, inside the limits you set for it.

<Note>
  API keys need Pro or Business, or the 14-day trial. A key follows the plan of each workspace's owner. So if you're on Free but belong to a Pro or Business workspace, your key works there. If no plan gives you API access, you'll see "API access is not included in your current plan. Please upgrade to continue."
</Note>

## Create a key

<Steps>
  <Step title="Open your settings">
    Click your avatar at the top right and choose **Settings**.
  </Step>

  <Step title="Go to Login & Security">
    Open the **Login & Security** tab and scroll down to **API Keys**.
  </Step>

  <Step title="Click Generate API Key">
    Give the key a **Name** you'll recognize later, like "Marketing automation". Tick the **Scopes** it needs (see below). Click **Generate**.
  </Step>

  <Step title="Copy the key now">
    The key appears once, under **Your new API Key**. Click the copy icon and store it somewhere safe, like a password manager. Then click **Done**.
  </Step>
</Steps>

<Warning>
  You can't see the key again after you close that window. If you lose it, revoke it and make a new one. Treat it like a password. Anyone who has it can act on your account within its scopes.
</Warning>

## Pick the right scopes

Scopes decide what a key can do. Tick only what the job needs.

| Scope | What the key can do |
| - | - |
| **Workspaces** | List the workspaces you belong to. |
| **Profiles** | List the social accounts in a workspace. |
| **Posts** | Create, read, change, delete and retry posts. |
| **Media contents** | Upload and manage files and folders in the media library. |
| **Analytics** | Read analytics, best times and hashtags. |
| **MCP (AI clients)** | Connect an AI assistant like Claude or Cursor. MCP is the standard these assistants use to work with other apps. See [Connect an MCP client](/mcp-server/connect). |

Most jobs need **Workspaces** and **Profiles** as well, so the key can find where to post. You can't add scopes to a key later. Make a new key instead.

Some API features need more than API access. The media library and analytics need Pro or Business. Best times to post and demographics need Business. The [Authentication](/authentication#plans) page has the details.

## Revoke a key

On **Login & Security**, find the key under **API Keys** and click the trash icon (tooltip "Revoke API key"). Click **Revoke** to confirm. Anything using that key loses access straight away, and you can't undo it.

The **Last used** column helps you spot keys nobody uses anymore.

<Tip>
  Keys made in the app don't expire. Revoke any you no longer need. If you move to the Free plan and aren't in a Pro or Business workspace, your keys stop working until you upgrade again.
</Tip>

## What next

<CardGroup cols={2}>
  <Card title="API quickstart" icon="rocket" href="/quickstart">
    Make your first request and publish a post.
  </Card>

  <Card title="Connect an AI assistant" icon="plug" href="/mcp-server/introduction">
    Use your key with Claude, Cursor and other MCP clients.
  </Card>
</CardGroup>


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