# Create an API key

Create an [API key](/docs/authentication.md) so code can act for you, with the access, expiry and limits it needs. A project key reaches that project and no other.

## Before you start

You need a Veryfront account. [Sign in](/sign-in) or create one. The project is the one the key is for.

## Create a key

**Studio**

1. In your project, open **Settings** > **API keys**.
2. Click **Create key**.
3. Enter `Support bot` as the **Name**.
4. Keep **Expires** on **Never**.
5. Under **Permissions**, keep **Read** and **Write** ticked.
6. Click **Create key**. Studio shows the key once.
7. Click the copy button beside the key.
8. Click **Done**. Studio lists the key.

Call the API with it and your project's ID ([Find your IDs](#find-your-ids)) as `PROJECT`. You should now see the answer `200`:

```bash
export VERYFRONT_API_KEY=vf_…
export PROJECT=<id>
curl -o /dev/null -w "%{http_code}\n" https://api.veryfront.com/projects/$PROJECT \
  -H "Authorization: Bearer $VERYFRONT_API_KEY"
```

**API**

1. Set `PROJECT` to your project's ID ([Find your IDs](#find-your-ids)): `export PROJECT=<id>`.
2. Create the key with a key that can manage the project:

```bash
curl -X POST https://api.veryfront.com/api-keys \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"project_reference": "'$PROJECT'", "name": "Support bot", "scopes": ["read", "write"]}'
```

3. Set `NEW_KEY` to the `key` in the answer: `export NEW_KEY=<key>`. Save it too: it is shown once.
4. Call the API with the new key. You should now see the answer `200`:

```bash
curl -o /dev/null -w "%{http_code}\n" https://api.veryfront.com/projects/$PROJECT \
  -H "Authorization: Bearer $NEW_KEY"
```

## Find your IDs

1. In your project, open **Settings** > **Project information**.
2. Click the copy button beside the **Project ID**. You should now see a check mark in its place.

For an agent or a run:

1. Open the agent or the run in your project.
2. Click the copy button beside its ID. You should now see a check mark in its place.

## With MCP

1. Call `veryfront__create_api_key` with `{ "project_reference": "my-project", "name": "Support bot" }`. The key is shown once, and it can only read: for a key that writes (the AI Gateway needs one), create it in Studio or with the API.
2. Call `veryfront__list_api_keys` with `{ "project_reference": "my-project" }`. It worked when "Support bot" is listed.

## Next steps

* [Revoke access](/docs/authentication/revoke-access.md)
* [Connect a coding agent](/docs/mcp/connect.md)
