# How AI agents authenticate with Acquisity

> Sign in to Acquisity as an agent: OAuth 2.1 with PKCE and dynamic client registration for MCP clients, or an API key for servers and scripts.

Acquisity accepts two kinds of credential. Pick the one that fits how you run.

## Discover

1. Call the MCP server without a token. The `401` response carries `WWW-Authenticate: Bearer resource_metadata="https://api.acquisity.ai/.well-known/oauth-protected-resource/mcp"`.
2. Fetch that protected resource metadata (RFC 9728). It names the resource (`https://api.acquisity.ai/mcp`), the authorization server (`https://app.acquisity.ai/api/auth`) and the scopes (`mcp:read`, `mcp:write`, `offline_access`).
3. Fetch the authorization server metadata (RFC 8414) at `https://app.acquisity.ai/.well-known/oauth-authorization-server`.

## Pick a method

| You are | Use | Credential |
| --- | --- | --- |
| An AI assistant or MCP client acting for a signed-in person | OAuth 2.1 authorization code with PKCE | MCP connection token (`acq_oat_`), refresh token (`acq_ort_`) |
| A server, script or scheduled job | API key created by a person in the app | Workspace key (`acq_org_`) or personal token (`acq_live_`) |

Acquisity does not issue credentials to anonymous agents, and does not accept ID-JAG identity assertions yet. A person with an Acquisity account always approves access.

## Register

OAuth clients register themselves with dynamic client registration (RFC 7591): `POST https://app.acquisity.ai/api/auth/oauth2/register` with your `client_name`, `redirect_uris`, `token_endpoint_auth_method` (`none` for public clients) and `scope: "mcp:read mcp:write offline_access"`. No pre-registration is needed. A client registered without `scope`, or with fewer scopes, is still stored with all three, so it can be granted `mcp:write`. The person decides what the token gets when they approve it (Claim, below).

For API keys there is nothing to register. The person creates a workspace key under API Keys, or a personal token under Access Tokens, in the app's settings and gives it to you.

## Claim

Send the person to the authorization endpoint `https://app.acquisity.ai/api/auth/oauth2/authorize` with `response_type=code`, your `client_id`, `redirect_uri`, `scope=mcp:read mcp:write offline_access` (asking for fewer scopes than you registered is fine; asking for more returns `invalid_scope`), `resource=https://api.acquisity.ai/mcp`, `state` and a PKCE `code_challenge` (`S256`). They sign in, pick one workspace or every workspace where they're an owner, admin or member, and approve Read-only or Full access. Full access is offered, and picked first, when your request includes `mcp:write` or leaves out `scope` (the client's stored scopes are used then). The token gets only the access they approve.

## Exchange

`POST https://app.acquisity.ai/api/auth/oauth2/token` with `grant_type=authorization_code`, the `code`, your `redirect_uri`, `client_id` and the PKCE `code_verifier`. The response has an `access_token`, its lifetime and, if you asked for `offline_access`, a `refresh_token`. Refresh with `grant_type=refresh_token`.

## Use the access_token

Send it as `Authorization: Bearer <token>` to `https://api.acquisity.ai/mcp` (POST, JSON-RPC) or to `https://api.acquisity.ai/v1`. Never put a token in a URL, a log or a file you share.

## Errors

| Status | Meaning | What to do |
| --- | --- | --- |
| `401` with `WWW-Authenticate` | No token, or it expired or was revoked | Refresh, or start the OAuth flow again |
| `403` | The token lacks the scope, or the person's role can't do this | Ask the person for Full access, or a key with the right scope |
| `404` on a workspace | The person is no longer a member, or the token is for another workspace | Call `list_workspaces` and use one it returns |
| `429` | Rate limited | Wait for `Retry-After` seconds |

## Revocation

- Revoke an OAuth token with `POST https://app.acquisity.ai/api/auth/oauth2/revoke` (RFC 7009).
- People can remove an MCP connection or delete an API key in the app at any time. Treat a sudden `401` as revoked and stop.
- A connection stops working when the person leaves the workspace.

---

Web page: https://www.acquisity.ai/auth.md
Site index for agents: https://www.acquisity.ai/llms.txt