Skip to content

API keys and connections

A program gets into Unspar in one of two ways. Your own code and the unspar CLI use an API key. An AI tool on the hosted MCP server uses a connection that you approve in your browser.

All docs pages

An API key is a long secret string that works like a password for a single program. The program sends it with every request, and Unspar lets it do whatever the key allows. You can create keys in the web app, or let unspar login create one for you.

An MCP connection is what Claude Code or Codex gets when it connects to Unspar’s hosted MCP server. You approve it in your browser, and your AI tool never sees an API key.

Keys and connections belong to a team, and for both you decide what the program can do and which projects it can reach. Only the team owner and members with the Administrator role can create keys and approve connections, including CLI logins. See Teams for details on roles. Keys and connections work on every plan, including the free one.

Which one do I need?

The right option depends on the program connecting to Unspar.

You want to Use
Let Claude Code or Codex write articles, with nothing to install A hosted MCP connection
Use another AI tool, like Cursor or Claude Desktop A CLI login and the local MCP server
Let an agent publish A CLI login with full access, or a key that can publish
Run a script on a server An API key with only what the script needs
Work with Unspar in your own terminal A CLI login

Give each program its own key or connection. That way, you can see which ones are still in use and revoke one without breaking the others.

Create an API key

You create keys on the API tokens screen, which you can open from Settings or from the user menu in the top right corner.

  1. Open Settings and choose API tokens.
  2. Under Create API token, type a Token name that says where the key will live, like “Blog import script”. Each name can only be used once per team.
  3. Check Restrict access. Without it, the key gets Full access to All projects and never expires.
  4. Choose a Preset to decide what the key can do.
  5. Choose the Project scope and the Expiration.
  6. Choose Create.

A window opens with your new key. Copy it and store it in your password manager or your server’s secret store, because Unspar only shows it this once. The same window includes a Display ID. It isn’t secret, and it helps you tell keys apart in places like your logs.

Create API token form with Token name, Restrict access ticked, the Preset choices, Project scope, Expiration and the Create button
Tick Restrict access to choose what the key may do, in which projects and for how long.

Here are the settings you can configure after checking Restrict access:

Setting Choices
Preset Full access, Read-only, Translations (SiteChorus), or Custom. The table below explains each one.
Project scope All projects includes projects you create later. Selected projects limits the key to the projects you check.
Expiration Never, 30 days, 90 days, or a date of your own under Custom. An expired key stops working, and you’ll need to create a new one.

What can a key do?

The preset controls which parts of Unspar the key can reach.

Preset What the key can do
Full access The standard permissions of your plan, including writing and publishing articles. Managing API keys and approving articles require Custom.
Read-only Read data without changing anything.
Translations (SiteChorus) Only what a connected WordPress site needs for its translations.
Custom Only the Capability groups you pick.

With Custom, each capability group covers one area of Unspar. You can leave a group off, or set it to Read or Read and write. The Generation group lets the key start articles, which spends credits. Publishing has its own groups, like Publish execute, so a key can write articles without being able to publish them.

Change, rotate or revoke a key

Your keys appear under Your API tokens. Each row shows what the key can do, which projects it reaches, and when it expires. Last used shows when a program last sent a request with that key, which helps you spot keys nobody needs anymore.

Each row has three buttons.

Button What happens
Edit Opens Edit API key, where you can change the name, access, projects, and Expiration, then choose Save.
Rotate Ends the old key right away and shows a new one with the same settings. Copy it immediately. Use this if a key may have leaked.
Revoke Stops the key from working immediately. You can’t undo this.

You can’t edit a revoked or expired key. Revoked keys stay on record so you can see they existed, and Show revoked keys brings them back into view.

Approve a CLI login

The CLI gets its own API key when you log in. You approve the login in your browser, and the CLI stores the key on your computer. Run this in a terminal:

unspar login

Here is what happens next:

  1. The CLI prints a code and opens the Approve sign-in page in your browser. If no browser opens, go to the address the CLI prints and enter the code there.
  2. Check that the code on the page matches the code in your terminal.
  3. Open Advanced settings if you want to give the key less than full access. The table below lists the choices.
  4. Choose Approve.

The page will tell you it’s safe to close the window, and the terminal will show which team you’re logged in to. The code stays valid for 10 minutes.

Advanced settings of the Approve sign-in page with Team, Access, Projects and Expiration
Advanced settings on the sign-in page decide what the CLI key may do, in which projects and for how long.

Clicking Approve right away gives the key full access to all projects for 90 days, including publishing. If you open Advanced settings, you can adjust these options:

Setting Choices
Team The team the key belongs to. Teams where you can’t create keys can’t be picked.
Access Full access, Read only, or Custom. With Custom, you set each group to No access, Read, or Read/write. To stop an agent from publishing, set the publishing groups, like Publish execute, to No access.
Projects All projects, current and future or Only these projects.
Expiration 90 days or 30 days.

The key shows up under API tokens with a name starting with “Unspar CLI”. You can edit, rotate, or revoke it there like any other key.

These commands show and end the CLI login:

unspar whoami     # team, what the key may do, when it expires
unspar logout     # deletes the key from this computer only

unspar logout doesn’t revoke the key in Unspar. It still works until it expires, so revoke it under API tokens as well. When a key expires, the CLI stops with an error, and you’ll need to run unspar login again.

To use a key you created in the web app, run unspar login --api-key and paste it when the CLI asks. If the environment variable UNSPAR_API_KEY is set, the CLI uses that key instead of your login.

What do I approve for an MCP connection?

When Claude Code or Codex connects to the hosted MCP server, Unspar opens a page in your browser showing Connect and the name of your tool. From there, you choose Approve or Deny.

Clicking Approve right away lets the tool read your projects and articles across all current and future projects. It can also create articles and ideas, which spends credits. Use Advanced settings on that page to pick the team, the projects, and each permission group. What do you approve? explains what each group covers.

A connection lasts 30 days from the day you approve it, and using it doesn’t extend that window. Once it expires, reconnect from your AI tool and approve a new connection.

See and revoke MCP connections

The MCP connections page lists your team’s hosted connections. No menu in the app links to it, so you need to open it directly:

https://app.unspar.com/teams/<team-id>/mcp-connections

The quickest way there goes through the API tokens screen.

  1. Open Settings and choose API tokens.
  2. In your browser’s address bar, replace /api-tokens at the end with /mcp-connections and press Enter.
  3. Choose Revoke in the row of the connection you want to end.

The tool’s next call will fail. Team owners and administrators can see every connection for the team and revoke any of them.

Each row shows the AI tool under Client and its Status. A connection with the status Ended also explains why, such as “Ended: left the team”. Access lists the projects it can reach and the tools it can use, by technical names like unspar_article_create. Last used shows when the tool last called Unspar.

A few details about connections are easy to miss:

  • Removing Unspar from your AI tool doesn’t end the connection in Unspar. Revoke it here as well.
  • Each time you reconnect, Unspar creates a new connection. The old one stays active until it expires or you revoke it.
  • When Unspar adds new tools, existing connections don’t get them automatically. The page shows “New since this connection was approved” along with their names. Reconnect your AI tool to add them.
  • A connection ends on its own if the person who approved it leaves the team or loses the owner or Administrator role.

Revoking a connection doesn’t affect any API keys, and revoking a key doesn’t affect any connections. The local MCP server has no connection of its own; it uses the key from your CLI login, which you can revoke under API tokens.

For AI agents

Before it acts, an agent can check which key it uses. whoami --verbose shows what the key may do and which projects it reaches. An agent never asks for the key itself. A person runs unspar login.

unspar auth status
unspar whoami --verbose

unspar <command> --help lists each command's flags and output options. Install and login: the CLI docs.

Last updated 25 November 2026. This page as Markdown: access.md

Try Unspar for free

Create a project, give it a topic and read the article before anything goes live.