---
title: "Authenticating to UseMo (OAuth 2.1, API Keys, and Scopes)"
description: "How AI agents and backend integrations authenticate to UseMo Hosted MCP, CLI/SDK, and REST API v1 safely without leaking credentials."
canonical: "https://usemo.com/auth.md"
updated: "2026-12-06"
agent:
  instructions: "Use https://usemo.com/.well-known/search?q= to find Markdown docs, start at https://usemo.com/agents/start.md, inspect https://usemo.com/.well-known/ai-catalog.json, or connect via MCP at https://api.usemo.com/mcp (or npx -y @usemo.com/mcp)."
  endpoint: "https://usemo.com/.well-known/search"
  method: "GET"
  documentation: "https://usemo.com/agents/start.md"
---
# Authenticating to UseMo

UseMo supports two primary authentication mechanisms across MCP, CLI/SDK, and REST API v1.

## 1. Hosted MCP with OAuth 2.1 + PKCE + DCR (recommended for agents)

- **Endpoint:** `https://api.usemo.com/mcp`
- **Protected Resource Metadata:** `https://api.usemo.com/.well-known/oauth-protected-resource/mcp`
- Compatible clients (Claude Code, Cursor, VS Code, Codex, ChatGPT) discover OAuth metadata automatically on first connect, open a browser sign-in flow, and issue scoped short-lived tokens with zero static key files.

## 2. Workspace API keys (REST API, CLI/SDK, local stdio MCP)

- Prefix: `usm_...` (created and revoked per workspace at `https://app.usemo.com/settings`).
- Send either header (never both with conflicting values):
  - `X-API-Key: usm_...`
  - `Authorization: Bearer usm_...`
- CLI profile login (avoids shell history leaks): `printf '%s\n' "$USEMO_API_KEY" | usemo login --key-stdin --profile work`.
- Verify active identity, workspace, scopes, and credits: `GET https://api.usemo.com/api/v1/whoami` (or `usemo_whoami`).

## 3. Security rules for AI agents

- **Never ask for or log API keys in chat.** If a user pastes a `usm_...` key in conversation, refuse to store it and ask them to revoke it immediately in workspace settings.
- **Never send `X-API-Key` or `Authorization` headers to CDN asset download URLs** returned in `result_urls`.
- **Idempotency:** send a unique UUIDv4 `X-Idempotency-Key` header on every paid POST request (honored for 24 hours).
