Send your key
Every request carries an Avazal API key in one of two headers: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. Callme.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 justhttps://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:
- 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. - Reads the authorization server metadata at
https://api.avazal.com/.well-known/oauth-authorization-server. The issuer ishttps://www.avazal.com/api/auth, and the metadata is also served at/.well-known/oauth-authorization-server/api/auth. - Registers itself with dynamic client registration.
- Opens the browser for the authorization code flow with PKCE (
S256). The resource indicator ishttps://api.avazal.com/mcp. - Sends the access token as a bearer token on every MCP request.
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 thex-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
readandinApptools, or for a run started by a trigger,readtools plus drafting and theruns.*tools. - Before any
outwardcall it asks first. The call returns409with_tag: "AskFirst"and the exactactionto approve. The agent callsruns.askwith that action, and once you approve, makes the call with the approved input.
403 with _tag: "ToolNotGranted". The tool catalogue marks them “Runs only, after approval”.
triggers.update: Change a triggertriggers.delete: Delete a triggertriggers.run: Try a trigger nowasks.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.