Skip to main content

Send your key

Every request carries an Avazal API key in one of two headers:
If both are present, x-api-key wins. Requests without a valid key get 401 with _tag: "KeyRequired". A key stops working when it is revoked or expires, or when the member who created it leaves the organization. API keys suit scripts, CI, the REST API and MCP clients without sign-in support. MCP clients that support sign-in can skip the key: see OAuth sign-in for clients.

What a key acts as

A key acts as the member who created it, in one organization. Every call runs with that member’s current role and visibility, so a key can never see or do more than its member. On top of that, the key only reaches the operations its scopes allow. A sign-in connection works the same way: it acts as the member who approved it, in the workspace they picked, with the scopes they approved. Call me.get to see the member, organization, role and scopes a key carries, and the identity it posts as, if any.

OAuth sign-in for clients

An MCP client that follows the MCP authorization spec can connect with just https://api.avazal.com/mcp. See Connect an agent for the steps in each client. A request without a credential gets 401 with a pointer to the sign-in metadata. The client then:
  1. Reads the protected resource metadata at https://api.avazal.com/.well-known/oauth-protected-resource. It is also served at /.well-known/oauth-protected-resource/mcp.
  2. Reads the authorization server metadata at https://api.avazal.com/.well-known/oauth-authorization-server. The issuer is https://www.avazal.com/api/auth, and the metadata is also served at /.well-known/oauth-authorization-server/api/auth.
  3. Registers itself with dynamic client registration.
  4. Opens the browser for the authorization code flow with PKCE (S256). The resource indicator is https://api.avazal.com/mcp.
  5. Sends the access token as a bearer token on every MCP request.
The person signs in with Slack or Google, picks a workspace if they have several, and approves per-area access on a consent screen. Areas start at read access and can only be lowered or raised up to what the app asked for. The scopes are the ones listed below, plus offline_access for staying signed in. Access tokens last 1 hour. Refresh tokens last 30 days and rotate on every use. Every operation enforces the same scopes and workspace as an API key. People revoke an app under Connected apps in Settings → API keys, which cuts it off immediately, and leaving the workspace does the same.

Scopes

Pick scopes per area when you create the key in Settings → API keys. A sign-in approves the same scopes on its consent screen. Each area has levels, and a higher level includes the ones below it. New keys start with the scopes marked below, and you can change them before you create the key. A few operations need no scope: me.get, and the runs.* operations an agent uses inside a run. The tool catalogue lists the scope of every operation. Calling an operation without its scope returns 403 with _tag: "ScopeRequired" and the missing scope. Over MCP, tools the key can’t use are not listed at all.

Risk

Every operation has a risk that says what it can change. MCP clients see it as the tool hints in the table.

With your own key

Your key acts immediately, like you clicking the button. An outward call posts the Slack message or sends the email at once, so have your agent confirm with you before calling one. Clients such as Claude Code and Cursor ask before running a tool marked destructive. Outward tools carry that hint, and so do the tools that always need approval, listed below.

Inside a run

When Avazal hands work to an agent, the agent works inside a run, either with a key minted for that run or with your key and the x-avazal-run header. A run is limited to where it was started:
  • It reads and acts in the conversation or thread it was handed, unless you gave it more places.
  • It only has read and inApp tools, or for a run started by a trigger, read tools plus drafting and the runs.* tools.
  • Before any outward call it asks first. The call returns 409 with _tag: "AskFirst" and the exact action to approve. The agent calls runs.ask with that action, and once you approve, makes the call with the approved input.
A few in-app operations change your settings or act on your behalf. These always need approval: they only run inside a run that asked first, and calling them with a plain key returns 403 with _tag: "ToolNotGranted". The tool catalogue marks them “Runs only, after approval”.
  • triggers.update: Change a trigger
  • triggers.delete: Delete a trigger
  • triggers.run: Try a trigger now
  • asks.reply: Send a drafted reply

Keys for identities

An identity is a named agent persona, such as @claude, that posts as itself rather than as you. Create one in Settings → Identities, then create a key for it there. That key is limited to the identity’s permissions and the scopes you pick, and me.get returns the identity. See Identities and runs.