OAuth reference
View as MarkdownEndpoints, client registration, PKCE, scopes, token lifetimes, refresh and revocation of the Reveata OAuth 2.1 server used by MCP clients.
On this page
Reveata runs an OAuth 2.1 authorization server so AI tools and other apps can connect to your account without a copied token. MCP clients such as Claude, ChatGPT and Cursor use it automatically when you add https://reveata.com/api/mcp. This page is for people building their own client.
Endpoints
| Endpoint | Standard | Purpose |
|---|---|---|
GET https://reveata.com/.well-known/oauth-authorization-server |
RFC 8414 | Server metadata (also at …/oauth-authorization-server/api/mcp) |
GET https://reveata.com/.well-known/oauth-protected-resource |
RFC 9728 | Metadata of the MCP server as a protected resource (also at …/oauth-protected-resource/api/mcp) |
POST https://reveata.com/api/oauth/register |
RFC 7591 | Dynamic client registration |
GET https://reveata.com/api/oauth/authorize |
OAuth 2.1 | Starts the flow and opens the consent page |
POST https://reveata.com/api/oauth/token |
OAuth 2.1 | authorization_code and refresh_token grants |
POST https://reveata.com/api/oauth/revoke |
RFC 7009 | Revokes the connection behind an access or refresh token |
The issuer is https://reveata.com. An unauthenticated call to https://reveata.com/api/mcp answers 401 with a WWW-Authenticate: Bearer resource_metadata="…" header that points to the resource metadata, so clients can discover everything from the MCP URL alone. Authorization responses include iss (RFC 9207).
Register a client
Registration is open: POST /api/oauth/register with a JSON body.
curl -X POST https://reveata.com/api/oauth/register \
-H 'content-type: application/json' \
-d '{"client_name":"My agent","redirect_uris":["https://agent.example.com/callback"],"token_endpoint_auth_method":"none"}'redirect_uris: 1 to 10.httpsanywhere; plainhttponly on loopback addresses (localhost,127.0.0.1,[::1]) for native apps. No fragments and no credentials in the URI. The redirect URI of every request must match a registered one exactly.grant_types:authorization_codeandrefresh_tokenonly (the default).token_endpoint_auth_method:nonefor public clients (PKCE required), orclient_secret_post/client_secret_basicfor confidential clients, which get aclient_secret(dt_ocs_…) once in the response.- The response holds the
client_id(dtc_…). - At most 20 registrations per IP address per hour.
Authorize with PKCE
PKCE with S256 is required for public clients (plain is not supported). Send the person's browser to:
https://reveata.com/api/oauth/authorize?response_type=code
&client_id=dtc_…
&redirect_uri=https://agent.example.com/callback
&code_challenge=<BASE64URL(SHA256(verifier))>
&code_challenge_method=S256
&scope=analytics:read goals:read
&state=<random>
&resource=https://reveata.com/api/mcpThe consent page shows your app's name and the host of its redirect URI, the permissions asked for and the websites to share. The person can narrow both before approving. A request that is broken (unknown client, unregistered redirect URI, missing PKCE) is never redirected back to your app: the consent page explains the problem instead, because open registration means a registered URI proves nothing about who owns it.
After approval the browser returns to your redirect URI with code, state and iss. Exchange the code:
curl -X POST https://reveata.com/api/oauth/token \
-d grant_type=authorization_code \
-d client_id=dtc_… \
-d code=… \
-d code_verifier=… \
-d redirect_uri=https://agent.example.com/callback \
-d resource=https://reveata.com/api/mcpThe response has access_token, token_type: "Bearer", expires_in, refresh_token and scope. Send the access token as Authorization: Bearer dt_oat_… to /api/mcp and to the REST API. The verifier must be 43 to 128 unreserved characters. A code that is used twice revokes the connection it created. The token endpoint allows 60 requests per minute per client and IP address.
Token lifetimes
| Credential | Lifetime |
|---|---|
| Authorization code | 5 minutes, single use |
Access token (dt_oat_…) |
60 minutes |
Refresh token (dt_ort_…) |
Rotates on every use; stops working after 90 days without use |
Approving the same client again replaces its connection: one active connection per person and client.
Refresh
curl -X POST https://reveata.com/api/oauth/token \
-d grant_type=refresh_token \
-d client_id=dtc_… \
-d refresh_token=dt_ort_…Refresh tokens rotate: every refresh returns a new refresh token and the old one stops working at once. If an old refresh token is used again, one of the two holders is not the real client, so the whole connection is revoked and the person has to approve it again.
Revoke
curl -X POST https://reveata.com/api/oauth/revoke -d client_id=dtc_… -d token=dt_oat_…Revoking an access or a refresh token ends the connection behind it (both tokens stop working). Unknown tokens are ignored, as RFC 7009 requires. People can also end a connection at any time under Account → API / MCP → Connected apps.
Scopes
A scope is <resource>:<access>; write includes read. A connection never does more than the person's current role on each website allows (the lowest role is checked on every call), and viewers who may not see revenue get no revenue, payment or customer data.
AI tools connected with OAuth can only be granted the scopes marked Yes. The others (adding websites, settings, the team, API keys, access tokens, account changes, payments, identify and visitor data requests) need an account access token created by the person.
| Scope | What it allows | Lowest role | AI tools (OAuth) |
|---|---|---|---|
notes:read |
Notes: Read and write notes on your charts. | Viewer | Yes |
notes:write |
Notes: Read and write notes on your charts. | Editor | Yes |
analytics:read |
Analytics: Read visitors, pages, sources and revenue. | Viewer | Yes |
goals:read |
Goals: Read and manage goals. | Viewer | Yes |
goals:write |
Goals: Read and manage goals. | Editor | Yes |
funnels:read |
Funnels: Read and manage funnels. | Viewer | Yes |
funnels:write |
Funnels: Read and manage funnels. | Editor | Yes |
segments:read |
Segments: Read and manage your saved segments. | Viewer | Yes |
segments:write |
Segments: Read and manage your saved segments. | Viewer | Yes |
alerts:read |
Alerts: Read and manage traffic and revenue alerts. | Viewer | Yes |
alerts:write |
Alerts: Read and manage traffic and revenue alerts. | Editor | Yes |
websites:read |
Websites: List websites, and add or remove them. | Viewer | Yes |
websites:write |
Websites: List websites, and add or remove them. | Admin | No |
settings:read |
Settings: Read and change website settings. | Admin | Only when the tool asks for it (off at first, with a warning) |
settings:write |
Settings: Read and change website settings. | Admin | No |
team:read |
Team: See and invite team members. | Admin | Only when the tool asks for it (off at first, with a warning) |
team:write |
Team: See and invite team members. | Admin | No |
api_keys:read |
API keys: See and create website API keys. | Admin | Only when the tool asks for it (off at first, with a warning) |
api_keys:write |
API keys: See and create website API keys. | Admin | No |
payments:read |
Payments: Read payments and send payment events. | Viewer | Only when the tool asks for it (off at first, with a warning) |
payments:write |
Payments: Read payments and send payment events. | Admin | No |
identify:write |
Identify API: Attach your own user details to visitors. | Admin | No |
visitors:write |
Visitor data requests: Export or erase everything about one visitor (privacy requests). | Admin | No |
account:read |
Account: Read your profile and preferences, and change your name and preferences. | Any (your own account) | Only when the tool asks for it (off at first, with a warning) |
account:write |
Account: Read your profile and preferences, and change your name and preferences. | Any (your own account) | No |
tokens:read |
Access tokens: See, create and revoke your account access tokens (never with more access than the token used). | Any (your own account) | Only when the tool asks for it (off at first, with a warning) |
tokens:write |
Access tokens: See, create and revoke your account access tokens (never with more access than the token used). | Any (your own account) | No |
Using a token instead
MCP clients without OAuth support can send an account access token (dt_pat_…) as a Bearer token to https://reveata.com/api/mcp. The MCP server then offers every tool the token has a permission for. See the MCP server page for the tools and how changes are confirmed.