Choose how to authenticate
Authentication is how Mochi confirms which integration is making a request. Choose one method based on where the integration runs.
| Where the integration runs | Use | Why |
|---|---|---|
| A server, scheduled job, or CI runner | API key | It can read a secret from a server-side secret manager without a person signing in each time. |
| A trusted local computer with a person present | Mochi CLI with OAuth | A browser opens so the person can choose an organization and approve permissions. The CLI stores the result safely. |
| An AI tool already connected to Mochi through MCP | Existing MCP connection | Keep the existing connection. Do not export or convert its credential. |
| A third-party browser application | Registered OAuth application | The app redirects the user to Mochi for approval and never receives the user's password. |
If you are connecting an AI tool, follow Connect an AI agent after choosing the matching row.
The self-serve Developers and Public API OAuth paths are in a controlled pilot. Documentation and a direct URL do not grant access. When Mochi enables the controlled path for an exact organization, follow Create and manage an API key. If you already use MCP, read Already connected through MCP?.
Use an API key on a server
Send the key in the Authorization header of every request:
Authorization: Bearer mochi_sk_live_...Bearer means that anyone who has the key can use it. Protect the key like a password.
Keep an API key safe
- Mochi shows the plaintext key once at creation.
- Store it in a server-side secret manager.
- Never put it in frontend JavaScript, mobile applications, URLs, source control, documentation, or logs.
- Never send it in a query parameter.
- Use separate keys for separate integrations so each can be scoped and revoked independently.
Each key belongs to one Mochi organization. It cannot access another organization's resources. A request for a
resource outside its organization returns 404 without revealing whether that resource exists.
Use browser approval with the Mochi CLI
OAuth lets a person approve a connection in the browser without giving the integration a password. A CLI OAuth connection also belongs to one organization and has only the approved scopes. The CLI stores its credential outside prompts and command history. Do not read or copy that storage.
Already being signed in to Mochi makes approval faster, but it does not skip consent. The person still chooses the organization and permissions.
Advanced: key identity types
Mochi may issue an organization-principal key to an approved server integration. This key represents the organization. A member-bound key also follows the member's current role and active status.
Connection and team-management changes require an organization-principal key. A member-bound key cannot perform those operations even when it has the named scope.
Confirm current authentication requirements for an exact endpoint in the canonical OpenAPI contract.
Replace or revoke a key
Request a new key before replacing an existing key. Deploy the new key to your integration, verify it, and then revoke the old key. The controlled self-serve steps are in Create and manage an API key.
Stop using a key immediately if it may have appeared in logs, source control, screenshots, browser storage, or a support message. Contact Mochi to revoke it. Share only its non-secret name or prefix, never the full key.