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

# API keys

> Create, limit and revoke the keys your agents use to connect to Agent Vault, and the apps connected through the hosted MCP server.

Give each agent its own API key, limited to the cards and logins it needs.
Creating a key takes about 2 minutes.

<Frame caption="The API keys page with two keys.">
  <img className="block dark:hidden" src="https://mintcdn.com/self-labs/qQvThJRMtr_jh7i3/images/dashboard/api-keys-light.webp?fit=max&auto=format&n=qQvThJRMtr_jh7i3&q=85&s=78a99566a8000fb42432d4602ad1f7f1" alt="The API keys page listing two keys, Shopping agent and Claude Code on laptop, each with its masked prefix, Full access, and whether its agent has connected: Connected 12m ago and Waiting to connect." width="2880" height="1800" data-path="images/dashboard/api-keys-light.webp" />

  <img className="hidden dark:block" src="https://mintcdn.com/self-labs/qQvThJRMtr_jh7i3/images/dashboard/api-keys-dark.webp?fit=max&auto=format&n=qQvThJRMtr_jh7i3&q=85&s=2a254a399b8616cab760a9fd87fdd072" alt="The API keys page listing two keys, Shopping agent and Claude Code on laptop, each with its masked prefix, Full access, and whether its agent has connected: Connected 12m ago and Waiting to connect." width="2880" height="1800" data-path="images/dashboard/api-keys-dark.webp" />
</Frame>

An API key is a secret starting `av_` that your agent uses to connect. It is
shown once, when you create it. Agent Vault keeps only a scrambled form of the
secret that cannot be turned back into the key, plus its first 12 characters in
readable form so you can tell your keys apart. See
[What is stored](/dashboard/data-and-deletion#what-is-stored).

## Create a key

<Steps>
  <Step title="Open API keys">
    In the sidebar, under **Vault**, click **API keys**, then click **New key**.
  </Step>

  <Step title="Enter a Name">
    Only you see the name. Name it after the agent, such as `grocery-agent`.

    <Note>
      Names are limited to 200 characters (leading and trailing spaces are not
      counted). If the dialog shows **Failed to create key**, the name may be too
      long: shorten it and click **Create key** again. The error code is
      `api_key_label_too_long`.
    </Note>
  </Step>

  <Step title="Choose card access">
    Under **Cards**, keep **All cards**, or pick **Only selected** and tick cards.
  </Step>

  <Step title="Choose login access">
    Under **Logins**, keep **All logins**, or pick **Only selected** and tick logins.
  </Step>

  <Step title="Leave signups off">
    Under **Signing up**, leave **Let this key create and change its own logins**
    off unless this agent should open accounts for you. See [Let a key create logins](#let-a-key-create-logins).
  </Step>

  <Step title="Choose verification">
    Under **Verification**, tick **Fill a test card instead of my card** only for
    a key that tests checkouts. See [Fill a test card instead](#fill-a-test-card-instead).
  </Step>

  <Step title="Click Create key" />

  <Step title="Copy the key">
    In the **Copy your key now** panel, click **Copy** and store the key safely.
    It is never shown again.
  </Step>
</Steps>

<Frame caption="The New API key dialog.">
  <img className="block dark:hidden" src="https://mintcdn.com/self-labs/qQvThJRMtr_jh7i3/images/dashboard/api-keys-create-light.webp?fit=max&auto=format&n=qQvThJRMtr_jh7i3&q=85&s=63c0492842e6b043a6ae5f3d14c1f7e6" alt="The New API key dialog with a Name field, Cards and Logins access each set to All or Only selected, and the signup checkbox turned off." width="2880" height="1800" data-path="images/dashboard/api-keys-create-light.webp" />

  <img className="hidden dark:block" src="https://mintcdn.com/self-labs/qQvThJRMtr_jh7i3/images/dashboard/api-keys-create-dark.webp?fit=max&auto=format&n=qQvThJRMtr_jh7i3&q=85&s=cd506e7bb0a54692d00ce51df915d6ef" alt="The New API key dialog with a Name field, Cards and Logins access each set to All or Only selected, and the signup checkbox turned off." width="2880" height="1800" data-path="images/dashboard/api-keys-create-dark.webp" />
</Frame>

<Frame caption="The key is shown once, right after you create it.">
  <img className="block dark:hidden" src="https://mintcdn.com/self-labs/qQvThJRMtr_jh7i3/images/dashboard/api-keys-new-key-light.webp?fit=max&auto=format&n=qQvThJRMtr_jh7i3&q=85&s=1510f64dd325df95671fc81afad47883" alt="The Copy your key now panel showing the new key masked, with a Copy button and a pointer to the setup steps on the Overview." width="2336" height="482" data-path="images/dashboard/api-keys-new-key-light.webp" />

  <img className="hidden dark:block" src="https://mintcdn.com/self-labs/qQvThJRMtr_jh7i3/images/dashboard/api-keys-new-key-dark.webp?fit=max&auto=format&n=qQvThJRMtr_jh7i3&q=85&s=ebdad16a8730419fa7282836a109ad91" alt="The Copy your key now panel showing the new key masked, with a Copy button and a pointer to the setup steps on the Overview." width="2336" height="482" data-path="images/dashboard/api-keys-new-key-dark.webp" />
</Frame>

To hand the key to your agent, open the setup steps on
[Overview](/dashboard/overview#connect-your-first-agent). Until you reload or
close the dashboard tab, those steps show this key filled in.

When the agent first connects, its row shows **Connected**. Agent Vault also
tries to notify you, if **An agent connects for the first time** is on in
[notification settings](/dashboard/approvals-and-notifications). That
notification is best effort.

<Warning>
  An API key works like a password. Anything holding it can act as your agent,
  within the key's access and your agent card rules. Keep it out of code
  repositories and shared documents.
</Warning>

## The keys list

| Column | What it shows |
| - | - |
| **Key** | The name, and the first characters of the key |
| **Access** | **Full access**, or which cards and logins it may use. **Can create logins** means signups are on. **Test card only** means it fills a test card |
| **Agent** | **Connected** and when the key was last used successfully (updated at most once a minute), or **Waiting to connect…** |
| **Created** | The date you created it |

The **Agent** column's last-used time updates when the key fetches the token
catalog, opens or resumes a browser session through the proxy, files a signup
request, or changes a login's password or username. A refused request does not
update it. The time can lag by up to a minute.

## Change a key's access

<Steps>
  <Step title="Click Edit access on the key's row">
    The dialog shows the same **Cards**, **Logins**, **Signing up** and
    **Verification** settings as when you created the key.
  </Step>

  <Step title="Click Save access">
    The change applies on the agent's next attempt. The key itself does not change.
  </Step>
</Steps>

| Setting | The key can use |
| - | - |
| **All cards** or **All logins** (default) | Every one you hold, including ones you add later |
| **Only selected**, some ticked | Only the ticked ones. You can tick as many as you hold |
| **Only selected**, nothing ticked | None. The dialog warns you |

<Accordion title="Why did a key lose a card I deleted and added again?">
  Access follows each card or login record, not its name or number. A re-added
  card or login is a new record, so a key limited to the old one cannot use it.
  Tick it again under **Edit access**.
</Accordion>

## Let a key create logins

**Let this key create and change its own logins** is off by default. Turn it on
only for an agent that should sign you up for new accounts. With it on, the agent
can:

* ask to create a login. The vault generates the password. Each request waits
  for your [approval on Logins](/dashboard/logins#approve-an-agent-signup)
  unless the site and email are on your
  [**Pre-approved signups**](/dashboard/logins#pre-approved-signups) list;
* record the username a site assigned to a login it created;
* change the password of a login it created.

The last two work only for this key, not another key on your account, and only
for seven days after the login was created. Seven days is the default; your
deployment can set a different window. They never work on a login you added
yourself, or on one whose password you replaced.

A key set to **Only selected** logins has each login it creates added to its
list automatically. Once that list holds 50 or more logins, the next signup
cannot be approved. Untick logins to bring the list under 50, or switch the key
to **All logins**. The 50 cap applies only to logins the agent adds; logins you
tick yourself under **Edit access** are not capped.

Storing a two-factor secret does not need this setting. Any key allowed to use a
login can store a two-factor secret for it during two-factor setup. It can never
replace an existing secret. Agent Vault tries to notify you each time a secret is
stored, but that alert is best effort. The **2FA** chip on
[Logins](/dashboard/logins) is the reliable record.

## Fill a test card instead

**Fill a test card instead of my card** is off by default. Tick it for a key
that only checks that a site's card fields work, such as a nightly test run,
without buying anything. When this key's agent fills a card number or security
code (CVV), it gets a public Visa test card and a test code, never your card.

* The test-card fills count against no spending limit.
* Test-card fills never auto-pause an agent card and raise no card, limit or
  pause alert.
* Everything else still applies: the key's first use sends **An agent connects
  for the first time**, and an identity or address fill on a site you have not
  authorized still waits for a
  [new-site approval](/dashboard/destinations#approve-a-new-site).
* Your real card is never used or charged.
* The agent cannot tick or clear it. Only you can, under **Edit access**.
* An agent using it cannot run an [attested checkout](/security/attested-detokenization).

<Warning>
  The test card does not make a merchant refuse the order. The practice checkout
  and some payment sandboxes accept it and place the order. Let a test agent
  submit only on a checkout meant for testing.
</Warning>

The setting is read when the agent starts a session. A session already open
keeps the old setting until the agent starts a new one. In the meantime:

* if you just ticked it, the open session's card fills are refused with
  `scope_denied`, so your real card is never reached;
* if you just cleared it, the open session keeps filling the test card.

An agent can check the setting with
[`browser.verificationOnly()`](/sdk/api-reference#sdkbrowser) before it fills.
Each test-card fill also reports `card_fields_verified: true` in its
[fill report](/sdk/api-reference#fillreport).

## Revoke a key

<Note>
  Revoking is permanent. A revoked key cannot be turned back on: give the agent a
  new key instead.
</Note>

<Steps>
  <Step title="Click Revoke on the key's row" />

  <Step title="Click Revoke key">
    The key stops working at once. It can no longer fetch tokens, and a browser
    session the agent already has open can no longer fill anything either. That
    open session is closed at the proxy's next key check, within about a minute.
  </Step>
</Steps>

Revoked keys are hidden. Click **Show revoked** to see them, marked **Revoked**
or **Auto-revoked**.

## What happens when…

| When | What happens |
| - | - |
| You revoke a key | It can fill nothing from that moment. An open session closes within about a minute. Agent Vault tries to notify you (best effort) on the channels you have turned on, while **An API key is revoked** is on |
| You change a key's access | The next attempt uses the new access. Nothing to reconnect |
| A key tries another account's token 3 times in 5 minutes | Agent Vault revokes it and shows **Auto-revoked** |
| An agent asks for its tokens too often | It is told to wait a few seconds. The limit depends on your plan, see [Limits](/reference/limits) |
| You click **Pause all agents** | No key can fill anything until you resume |

## Connected apps

An agent connected through the
[hosted MCP server](/mcp/setup#connect-to-the-hosted-server) has no API key.
Each sign-in becomes a connection instead. In the sidebar, under **Vault**,
click **Connected apps** to see them. They are not listed on **API keys**.

A connection appears the first time the app calls Agent Vault with your account
after signing in. Each sign-in is its own connection, so one app can appear more
than once.

| Column | What it shows |
| - | - |
| **App** | The app's name, such as **Muse** or **Claude Code**, and its client id |
| **Access** | **Choose what it may use** until you choose access. Then which cards and logins it may use, such as **All cards** or **2 logins**. **Can sign up** means it may create logins. **Test card** means it fills a test card |
| **Last used** | When the app last used the connection, and the date it is **Revoked if unused by** |
| **Connected** | The date of the sign-in |

The name is the one the app registered with. It is shown as **Connected app**
until you open **Connected apps** or **Sessions** after the app has connected.
Two sign-ins from the same app share the name, and often the client id. Tell
them apart by **Connected** and **Last used**.

### Choose or change a connection's access

<Steps>
  <Step title="Click Choose access on the connection's row">
    Once access has been chosen, the button reads **Change access**.
  </Step>

  <Step title="Set what this app may use">
    The **What this app may use** dialog has the same **Cards** and **Logins**
    settings as a key, plus **Let this app create and change its own logins**
    and **Fill a test card instead of my card**. They work as described above
    for keys.
  </Step>

  <Step title="Click Save access">
    The app's next call uses it.
  </Step>
</Steps>

Until you save access the first time, the app cannot act for you at all. Its
calls are refused with `access_not_chosen`. Whatever you choose here, Agent
Vault still asks you before a purchase at or above the agent card's **Require
confirmation above** amount.

### Revoke a connection

<Note>
  Revoking a connection is permanent. To use the app again, sign in again, which
  creates a new connection. Revoking in the app itself, or in your sign-in
  settings, does not end the access the connection already has: revoke it here.
</Note>

<Steps>
  <Step title="Click Revoke on the connection's row" />

  <Step title="Click Revoke connection">
    The connection stops working at once. A browser session it already has open
    closes within about a minute.
  </Step>
</Steps>

Agent Vault tries to notify you (best effort), as for a revoked key, while **An
API key is revoked** is on.

A connection that is not used by its **Revoked if unused by** date is revoked
automatically and shows **Revoked: unused**. By default that date is 31 days
after the last use. Revoked connections are hidden. Click **Show revoked** to see
them.

An account can hold 200 connections in total. Revoked connections, including
ones marked **Revoked: unused**, still count, so revoking does not free a place.
At 200, the first call after
a new sign-in is refused with `too_many_connections`, while the connections you
already have keep working. To clear old connections, contact [team@self.xyz](mailto:team@self.xyz).
See [Limits](/reference/limits#ceilings).

Each connection can hold at most 50 live credentials at once (roughly, 50 open
sessions). If the app is refused with `too_many_credentials`, close finished
sessions, or wait the number of seconds the message gives (at most 75 minutes).
See [Limits](/reference/limits#ceilings) for how credentials are counted.

## For developers

| Need | Where |
| - | - |
| Setting the key by hand (`SELF_AGENT_PAY_API_KEY`, `SELF_AGENT_PAY_PROXY_URL` and `SELF_AGENT_PAY_API_URL`) | [Environment variables](/reference/environment-variables) |
| Key errors: `invalid_api_key`, `key_revoked`, `key_auto_revoked`, `scope_denied`, `cross_user_denied`, `signup_not_enabled`, `rate_limited` | [Error codes](/sdk/error-codes) |
| Catalog rate limits and `Retry-After` | [Limits](/reference/limits) |

**Next:** [Overview](/dashboard/overview#connect-your-first-agent) to connect your agent with its new key.


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