---
title: "API keys, OAuth and permissions"
description: "Where a key reaches, what each permission allows, expiry, apps connected by OAuth, the activity log, and 401, 403 and 404."
url: "https://docs.yoagent.dev/account/api-keys-oauth-and-permissions"
---

# API keys, OAuth and permissions

Agents and code reach YoAgent in two ways:

- **An API key** works on REST and MCP. You create it in the dashboard, choosing where it reaches and what it may do.
- **An app connected by OAuth** — an MCP client you signed in from the browser — works on MCP only, and acts as you, with your role and access ([Quickstart: MCP](https://docs.yoagent.dev/start/quickstart-mcp)).

## Create an API key

**API keys → Create key** in the dashboard. A key reaches exactly one place:

| Scope            | Reaches                                                        |
| ---------------- | -------------------------------------------------------------- |
| **Organization** | Every project, present and future. The broadest key.           |
| **One project**  | Its inboxes, mail, domains and webhooks.                       |
| **One inbox**    | Only this address, its mail and its domain. The narrowest key. |

Then its **access**: one of the ready sets — **Full access**, **Send and read**, **Read-only**, **Manage inboxes** — or **Custom** permissions. Give each agent and each CI job its own key with the least it needs: a key for sign-up tests needs `inbox_create`, `inbox_delete` and `message_read`, nothing else.

![The New API key dialog: the name, the expiry, the scope and the permissions](https://docs.yoagent.dev/_astro/api-key-new.CdcYyQBu_ZMya2c.webp)

A key starts with `da_` and is sent as `Authorization: Bearer <api key>`. The person who created it can open it again later; others see only its first characters. **Expires** (Never by default) ends it on a date you choose; past it, the key answers `401`. **Revoke** ends it at once, everywhere. Keys are made in the dashboard by people, not by other keys.

## Permissions

| Permission       | Allows                                                                                                   | Brings                                          | One inbox |
| ---------------- | -------------------------------------------------------------------------------------------------------- | ----------------------------------------------- | --------- |
| `inbox_read`     | See inboxes: address, name, metadata.                                                                    | `domain_read`                                   | Yes       |
| `inbox_create`   | Create inboxes, within the plan's limit.                                                                 | `inbox_read`                                    |           |
| `inbox_update`   | Rename inboxes and change their metadata.                                                                | `inbox_read`                                    | Yes       |
| `inbox_delete`   | Delete inboxes with all their mail.                                                                      | `inbox_read`                                    |           |
| `message_read`   | Read threads, messages and attachments; wait for new mail.                                               | `inbox_read`                                    | Yes       |
| `message_update` | Change labels, mark mail read or unread.                                                                 | `message_read`                                  | Yes       |
| `message_delete` | Delete threads and messages.                                                                             | `message_read`                                  | Yes       |
| `message_send`   | Send new mail. Reply and forward also need Read: they show the message they answer.                      | `inbox_read`                                    | Yes       |
| `webhook_read`   | See webhook subscriptions.                                                                               |                                                 |           |
| `webhook_create` | Subscribe webhooks. Their bodies carry mail, so it includes reading mail.                                | `message_read`, `webhook_read`                  |           |
| `webhook_update` | Pause or turn on webhooks, change their events or inboxes. They carry mail, so it includes reading mail. | `message_read`, `webhook_read`                  |           |
| `webhook_delete` | Delete webhooks.                                                                                         | `webhook_read`                                  |           |
| `domain_read`    | See the project's mail domains.                                                                          |                                                 | Yes       |
| `domain_create`  | Add custom domains, within the plan's limit.                                                             | `domain_read`                                   |           |
| `domain_update`  | Check custom domains' DNS records again, and turn their sending on or off.                               | `domain_read`                                   |           |
| `domain_delete`  | Delete custom domains with their inboxes and mail, so it includes deleting those.                        | `inbox_delete`, `message_delete`, `domain_read` |           |

A permission brings what it cannot work without (**Brings**): reading mail brings seeing inboxes, deleting a domain brings deleting its inboxes and mail. An organization key can also get `project_create`, `project_update` and `project_delete`. A key for one inbox takes only the permissions marked **One inbox**.

**No key reaches further than the person who made it.** A member cannot create a key with more than their own access, and when their access is narrowed later, their keys narrow with it. When they leave the organization, their keys stop working.

## Apps connected by OAuth

When you allow an MCP client in the browser, you check the organizations it may use. It acts as you: with your role and access, never more, in one of those organizations at a time. Its sign-in lasts a while and renews itself; when it ends, the client asks you to sign in again. OAuth tokens work only on MCP: REST answers them with `401`.

**API keys → Connected apps** lists every app someone allowed in the organization, with its person, when it was connected and last used. **Revoke** stops it in this organization until its person allows it again; their other organizations keep it. Owners and admins see and revoke every key and app; members, their own.

## Activity

**Activity** in the dashboard shows every call made with an API key or a connected app, REST and MCP: which operation or tool, where (the project and inbox), and how it ended — with the error’s code when it failed. It is kept for the last 30 days on Free and 90 days on Pro. Owners and admins see every caller’s calls in the projects they reach; members, those of their own keys and apps. Calls people make in the dashboard are not listed, nor calls refused by the limit of calls a minute.

## 401, 403 or 404?

| Answer             | Means                                                                                                                                             | What to do                                       |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
| `401 unauthorized` | No key, a wrong, revoked or expired one — or an OAuth token on REST                                                                               | Check the header; create a new key               |
| `403 forbidden`    | The key reaches the place but may not do this; the message names the permission: `Your access to this project does not allow this (message_send)` | Give the key that permission, or use another key |
| `404 not_found`    | It does not exist — or the key cannot see it: another organization’s, or a project or inbox outside the key’s scope                               | Check the id; check the key’s scope              |

A key never learns whether something it cannot see exists: outside its reach, the answer is always `404`. The same holds for permissions that let you see a thing: without `webhook_read`, a webhook is `404`; with it but without `webhook_update`, changing it is `403`. One exception: a webhook’s `client_id` is unique in the whole organization, so creating a webhook with one already taken in a project the key does not reach answers `403`.
