Authorization header. Nobody calls anonymously, and every credential belongs to exactly one clinic (organization).
Choose a credential
Effective access is always an intersection, never a union:
- Organization credentials (organization keys, partner apps): the permissions ticked on the key or app, within what the clinic’s plan allows. They never inherit the access of the person who created them.
- Personal credentials (personal keys, MCP connections): the credential’s permissions and your current permissions and centers in Brelio, read on every request. If you lose a permission or leave the clinic, every credential acting for you loses it at the same moment.
Organization API keys
For the clinic’s own tools. The key does not depend on any person, so it keeps working when staff change.1
Create it
In Brelio: Configuración › Integraciones › Claves de API › Nueva clave. Tick only the permissions the tool needs. You cannot give a key a permission you do not hold yourself.
2
Copy it once
The full key is shown only on creation. Afterwards Brelio lists it by name, its last characters, its permissions and when it was last used.
3
Call the API
403 CREDENTIAL_SESSION_REQUIRED).
Personal API keys
A personal key acts as you. It is useful for your own scripts and command-line tools: it can never do more than you can in Brelio, and it stops working if you leave the clinic. List your personal keys withGET /v1/me/api-keys, and the assistants you connected with GET /v1/me/connections. Creating or revoking them takes your own session in Brelio: a credential cannot create credentials.
Partner apps (M2M)
For software that serves many clinics. Each clinic creates a partner app for you in Configuración › Integraciones › Apps de partners, ticks its permissions and gives you its client ID and client secret. Your server exchanges them for a short-lived access token with the OAuth 2.0client_credentials grant, and sends that token as the bearer credential.
Response (shape)
- The token carries the clinic (
org_id) and the app’s permissions. Brelio refuses a token issued to a person. - Request a new token before
expires_inruns out; do not request one per call. - The clinic can see the app in Conexiones and delete it at any time; its tokens then stop working. An app may delete only itself (
POST /v1/partner-apps/{id}/revoke).
MCP OAuth
AI assistants connect tohttps://api.brelio.app/mcp with OAuth 2.1, and you sign in with your Brelio account. You never handle a token. See Connect your AI assistant.
For client developers, the server follows the MCP authorization spec:
- An unauthenticated call answers
401withWWW-Authenticate: Bearer resource_metadata="https://api.brelio.app/.well-known/oauth-protected-resource/mcp". - That document names the authorization server; Brelio uses WorkOS AuthKit, which supports Client ID Metadata Documents and dynamic client registration.
- Request the token with
resource=https://api.brelio.app/mcp. The token’s audience must be exactly that address.
Response
Keep credentials safe
- Store keys and client secrets in a secret manager or environment variables. Never commit them, paste them in a chat, or put them in a URL.
- Give each tool its own key with only the permissions it needs, so you can revoke one without touching the others.
- Keys are validated with WorkOS and the result is cached for up to 60 seconds, so a revoked key can work for up to a minute.
- Every call is recorded with the credential that made it. The clinic sees it in Configuración › Integraciones › Actividad.