- Machine-to-Machine (M2M) for your own backend services
- OAuth 2.1 for any integration that acts on behalf of a user: third-party apps, AI agents, dashboards
Machine-to-Machine (M2M) Authentication
M2M authentication is designed for backend services, internal automations, and server-to-server integrations. It uses access tokens that are scoped to your organization and expire automatically.How It Works
-
Request an Access Token
Exchange your
client_idandclient_secretfor an access token. Credentials can be supplied either in the request body or as HTTP Basic Auth:Or, equivalently, with Basic Auth:Response: -
Include the Token in API Requests
Add the access token to the
Authorizationheader: - Tokens Expire Access tokens are short-lived and expire after approximately 1 hour. Request a new one when the previous token is near expiry.
Example (cURL)
OAuth 2.1 Authentication
OAuth 2.1 is for integrations that act on behalf of a specific Profile user. That covers third-party apps, AI agents and MCP servers, CLI tools, and any browser-based dashboard where a user signs in. Tokens issued under OAuth are scoped to one Profile account (the one the user consented from) and carry OAuth scopes that narrow what the integration can do. The same bearer token works against the REST API (/api/v4/*) and the MCP endpoint (/mcp).
Discovery
Fetch the OAuth protected-resource metadata to learn where the authorization server lives and what scopes exist:WWW-Authenticate: Bearer resource_metadata="..." header pointing at this document, so clients can discover it automatically.
Client Registration
You have two ways to register an OAuth client:- Pre-registered integrations. For a production integration you build or operate (your own dashboard, an internal tool, a specific third-party connector), contact support to register a client and receive a
client_id(andclient_secretfor confidential clients). - Dynamic Client Registration (DCR). MCP agents and other on-the-fly clients can register themselves at the authorization server’s DCR endpoint. See the authorization server’s discovery document at
https://login.profilebehavior.com/.well-known/oauth-authorization-serverfor the registration URL. No pre-provisioning required.
How It Works
-
Redirect to authorize
Send the user’s browser to the authorization endpoint with the standard OAuth 2.1 query params (
client_id,redirect_uri,response_type=code,scope,state,code_challenge,code_challenge_method=S256): -
Consent
Profile shows the user a branded consent screen listing your app, the account they’re connecting, and the scopes requested. On approval, Profile redirects the browser back to your
redirect_uriwith an authorization code. -
Token exchange
Exchange the code for an access token at the token endpoint:
-
Make API requests
Include the token as a bearer in the
Authorizationheader:
Scopes
Scopes are the unit of authorization for OAuth tokens. A token can only perform operations covered by the scopes the user granted. Users see and can deny each scope on the consent screen, and can revoke an entire connection at any time from the Connected apps section of their user profile. Request only the scopes your integration actually needs. Over-asking on the consent screen is the single most common reason users deny a connection.profiles:read
Read access to profiles and their behavioral data.
Allows:
- Listing profiles on the connected account
- Reading a profile’s name, email, and phone
- Reading DISC, Focus, and Core assessment scores
- Reading AI-generated behavioral debriefs (and triggering generation of a debrief if one doesn’t exist yet)
profiles:write
Full profile lifecycle, including creating profiles and delivering assessment invites.
Allows:
- Creating new profiles (no invite is sent until you call an invite endpoint)
- Updating profile metadata
- Deleting profiles
- Sending assessment invites by email or SMS, or retrieving a direct assessment link
profiles:read alongside if you need both).
Typical use: HR tools, onboarding automations, roster-management integrations.
tags:manage
Full CRUD on tags and tag membership.
Allows:
- Listing, creating, renaming, recoloring, and deleting tags
- Replacing the set of profiles attached to a tag
account:read
Read access to account-level metadata.
Allows:
- Reading account name, logo, and preferences
- Reading the assessment catalog
- Reading resource aliases (external ID mappings)
profiles:read).
Typical use: diagnostic and reporting tools that need context about the account they’re connected to.
account:write
Modify account-level settings.
Allows:
- Updating account logo and preferences
- Creating, updating, and deleting resource aliases
Scope enforcement
Every API request is validated against the token’s granted scopes before the handler runs. An OAuth client calling an endpoint without the corresponding scope receives a 403 with a descriptive error message. There is no silent degradation or partial success.Example OAuth Request
Regions
Every account has a Home Region: the United States, the European Union, or Singapore. An account’s data is stored and served only in its Home Region, and each region has its own API host.
Use the base URL for your account’s Home Region. The default host routes each request to the nearest region, which is correct for most callers most of the time, but it is not guaranteed to be your account’s region.
The 421 response
If a request reaches a region that does not hold your account, the API does not process it. It responds with421 Misdirected Request and tells you where to go:
X-Profile-Region and X-Profile-Region-Url headers.
To handle it, replace the host in your base URL with the host from region.apiUrl, keep the /v4 path, and send the request again. Any endpoint that requires authentication can return 421. Once you are talking to the right region you will not see it again for that account, so it is safe to remember the region and use it for every later request.
API keys and regions
An API key belongs to the account that created it, and that account belongs to one region. Using a key against another region’s host returns 421 with the correct region. Keys created before regional hosting was introduced return404 Not Found from the wrong region instead of 421. If you see that, switch to your account’s regional base URL.
Which Authentication Method Should I Use?
Security Notes
- Never expose client secrets in frontend apps or browser-based code. Public clients (browser, mobile, CLI) must use PKCE instead.
- Access tokens are short-lived (~1 hour). Use refresh tokens to obtain new access tokens without re-prompting the user.
- OAuth users authenticate through Profile’s secure login. Passwords are never shared with external tools.
- Users can view and revoke any connected app from the Connected apps section of their user profile at any time.