Authorization
The Users API uses the OAuth 2.0 authorization framework to allow an application to act on behalf of your organization. The authorization process uses the client credentials grant flow to issue access tokens to authenticated clients:- Create an OAuth application in your 1Password account to generate scoped client credentials.
- Make a POST call to the OAuth 2.0 token request endpoint that includes your client credentials to request a scoped access token.
-
Send the access token in the
Authorizationheader when calling the Users API endpoints, prefixed withBearer: - Request a new token when the current one expires, or revoke a token when it’s no longer needed.
Endpoints
The basic structure of an endpoint URL for the Users API includes the base URL and the endpoint path. The endpoint path includes the API endpoint version, the resource(s) you want to access, and any relevant path and query parameters.Base URLs
The base URL of an endpoint URL indicates the server that hosts the environment you want to work in. Use the base URL that matches the region of the 1Password account you want to access.
Integrations should be designed to allow the base URL to be configurable to accommodate accounts in different regions.
Endpoint paths
Endpoint paths are appended to the base URL and include the endpoint version, target resource path, and any path parameters. For example, the endpoint path to retrieve a single user in a 1Password account looks like this:{account} path parameter is the unique identifier of the 1Password account, and the {user} path parameter is the unique identifier of the user. Both are 26-character uppercase IDs, for example WX52YXL2MVEPBK43P3R4XMWKXI. A malformed ID returns 400 Bad Request, and an ID that doesn’t exist returns 404 Not Found.
The path may also include a custom action, which is indicated by a colon (:) separator followed by an action verb. For example: :suspend or :reactivate. Custom actions are placed at the end of the endpoint path and before any query parameters:
:suspend or :reactivate action on endpoints that don’t support it.
Check the API reference documentation for more information about the available endpoints.
Requests
Request methods
Requests to the Users API use standard HTTP methods:
The Users API accepts JSON over HTTPS only. Requests that use gRPC or Connect protocols return
415 Unsupported Media Type.
Request headers
Authorization: Your OAuth access token, prefixed withBearer. Required on every request. See Authorization.User-Agent: Recommended. Send an identifiableUser-Agentheader in the format<CompanyOrProductName>/<version>so requests can be attributed to a specific integration. This helps with support and troubleshooting, and with analytics on integration usage.
Content-Type: application/x-www-form-urlencoded header. Learn more about requesting an access token.
Request bodies
Users API requests don’t include a request body. The suspend and reactivate actions identify the target user in the endpoint path.Query parameters
You can use query parameters in your API request as optional modifiers after the endpoint path. Use a query separator (?) at the end of the endpoint path, then add any query parameters you want to include, separated by a query delimiter (&).
For example, you can list users in an account and use query parameters to filter the results to active users and set the maximum number of results to return per page:
400 Bad Request.
Filtering
The list users endpoint accepts afilter query parameter to return only users in a specific state:
user.isActive()returns only active users.user.isSuspended()returns only suspended users.
400 Bad Request with an invalid_argument error, for example: invalid filter "user.isDeleted()": must be "user.isActive()" or "user.isSuspended()".
Pagination
The list users endpoint supports token-based pagination. Use these query parameters to page through results:max_page_size: The maximum number of users to return per page. Defaults to 100 when omitted or set to0. The maximum is 1000; values greater than 1000 are limited to 1000, and negative values return400 Bad Request.page_token: The token that identifies the page of results to return.
next_page_token. To retrieve the next page, send the same request with page_token set to that value. Repeat until the response no longer includes a next_page_token. A page with no results is returned as an empty JSON object ({}), so treat a missing results field as an empty list.
When you send a page_token, include the same filter value as the original request; the token doesn’t store it. max_page_size is ignored on requests that include a page_token, because the page size is fixed by the token. Page tokens don’t expire. If users are added, suspended, or reactivated while you page through results, some users may shift between pages.
Responses
The API returns JSON (application/json) for all responses.
A successful request returns 200 OK. The suspend and reactivate actions return the updated user in the response body, so you can read back the user’s current state.
Learn more about error responses and paginated list responses.
Dates and times
Timestamps are returned in RFC 3339 format , for example2024-01-15T10:30:00Z.
Rate limits
Requests to the Users API are rate limited per 1Password account and per endpoint:- 100 requests per minute
- 6,000 requests per hour
RateLimit-Limit, RateLimit-Remaining, and RateLimit-Reset headers that report the current limit, how many requests remain in the window, and when the window resets (as a Unix timestamp in seconds). Rate limits are applied before a request’s scopes are checked, so requests that return 403 Forbidden also count toward the limit. Requests that are rejected because the access token is missing or invalid (401 Unauthorized) don’t reach the API, so they don’t include the RateLimit-* headers and don’t count toward the limit.
Requests to the OAuth API endpoints (token, introspection, and revocation) are rate limited separately. The limits are shared across the three endpoints:
- Per OAuth application: 60 requests per minute and 3,600 requests per hour
- Per 1Password account: 600 requests per minute and 36,000 requests per hour
429 Too Many Requests response with a Retry-After header that indicates how long to wait, in seconds, before retrying. Rate-limited Users API responses use the standard error format with the resource_exhausted code and include the RateLimit-* headers with RateLimit-Remaining: 0. Rate-limited OAuth API responses include a JSON error body with the slow_down error code.
Errors
The API uses standard HTTP status codes to indicate the result of a request. A2xx code indicates success. A 4xx code indicates a problem with the request (for example, missing authorization or invalid input). A 5xx code indicates an unexpected server error.
Error responses use a consistent format with a machine-readable code and a human-readable message:
Requests with a missing, invalid, expired, or revoked access token are rejected before they reach the API. The response is
401 Unauthorized with the unauthenticated code and a WWW-Authenticate: Bearer header. When a token was sent but isn’t valid, the header also includes error="invalid_token":
Authorization header, for example Bearer with no token or a token followed by extra text, returns 400 Bad Request with the invalid_argument code and a WWW-Authenticate: Bearer header that includes error="invalid_request". These responses don’t include the RateLimit-* headers. Request a new access token if the token has expired.
Audit events
User lifecycle actions performed through the Users API are recorded in your account’s audit log and identifyOauth app as the actor. Suspending a user generates a user.suspend audit event, and reactivating a user generates a user.reactivate audit event.
You can review these events in your account’s audit log or retrieve them with the 1Password Events API.
User states
A user’sstate field reflects their current status in the 1Password account:
Users who have been invited but haven’t joined the account yet don’t have a user ID and aren’t available through the API.
Additional states may be added in the future. Make sure your integration handles unknown values, and a missing
state field, gracefully.