Authorization
The Events API uses the OAuth 2.0 client credentials grant to issue access tokens to integrations.-
Create an OAuth application in your 1Password account with the
audit-events.viewscope. - Send your client credentials in a POST request to the OAuth token endpoint to request an access token.
-
Send the access token in the
Authorizationheader for each Events API request, prefixed withBearer: - Request a new token when the current one expires, or revoke a token when it’s no longer needed.
Endpoints
An Events API endpoint URL consists of a base URL and an endpoint path. The path identifies the API version, the account, and the resource.Base URLs
Choose the base URL that matches the region of your 1Password account. Use the same base URL to request an access token and retrieve audit events.
If your integration supports accounts in multiple regions, let users choose the base URL.
Endpoint paths
Append the endpoint path to your base URL. For example:{account} with the ID of the 1Password account that owns the OAuth application, or use - to select the account associated with your token.
Endpoint paths are matched exactly. Use the path without a trailing slash.
See the Events API reference for endpoint details.
Requests
Request methods
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
Audit events requests use query parameters for pagination and time filters. Leave the request body empty.Query parameters
Add filters and pagination parameters to the endpoint URL. Start the query string with?, separate parameters with &, and URL-encode their values. For example:
400 Bad Request. See Retrieve audit events for the supported parameters.
Filtering
The Retrieve audit events endpoint supports two date and time parameters in RFC 3339 format:start_time: Return events with aninsert_timestrictly after this value.end_time: Return events with aninsert_timestrictly before this value.
start_time must be earlier than end_time. Otherwise, the API returns 400 Bad Request.
- If you omit both
start_timeandend_time, the API returns events received in the last hour. - If you include only
end_time, the API returns events received in the hour before that time. - If you include only
start_time, the API returns events received after that time, up to the latest searchable events.
start_time or end_time is more than 120 days ago, the API uses the time 120 days ago for that parameter. If start_time is in the future, the API returns an empty result.
Pagination
Use the following query parameters to page through results.max_page_size: The maximum number of events to return per page. The default is 100 when you omit it or set it to0. Values below 0 or above 1000 return400 Bad Request.page_token: An opaque string that identifies the next page of results to retrieve.
Pagination workflow
-
Make a GET call to
/v3/accounts/{account}/audit-eventswith any combination ofmax_page_size,start_time, andend_timethat you need. -
Process the events in
results. Check whethernext_page_tokenhas a value. -
If there are more pages of events, use
next_page_tokenaspage_tokenin the next request. The token carries the original query settings. For example:Repeat untilnext_page_tokenis empty. Omitpage_tokento start a new query. Sendingpage_token=returns400 Bad Request.
Continuous polling
To poll for new events, retrieve and process every page in the current query. Use the last processed event’sinsert_time as start_time for the next poll.
-
Set
start_timeto the earliest insertion time you want to retrieve. Retrieve and process every page in the query. -
After the last page, save the
insert_timeof the last event you processed in the query. Keep the previous checkpoint if the query returned no events. -
On your next scheduled poll, use the saved timestamp as
start_timeand leaveend_timeunset. If you haven’t processed any events yet, retry with your original starting time. For example: - Retrieve and process every page before advancing the checkpoint again.
insert_time. Page tokens let you retrieve events with the same timestamp across pages in a query. A new query skips events at its start_time. To recheck for events that became searchable after a poll, use a start_time before the saved timestamp and skip events you’ve already stored by id.
If your integration retries a query after a partial failure, use each event’s id to skip events you’ve already stored.
Responses
A successful request returns200 OK with a JSON body. The results array contains the events on the current page. When the query finds no events, results is an empty array. An empty next_page_token marks the last page.
See Pagination for how to retrieve each page and Errors for other response statuses.
Dates and times
Event timestamps use RFC 3339 format.create_timerecords when the event occurred.insert_timerecords when 1Password received and stored the event.
insert_time. If a client sends an event after it occurs, the response can include an event whose create_time is earlier than the requested time range. Learn more about filtering by time.
Rate limits
All integrations in an account share two limits. Both apply.- 600 requests per minute
- 30,000 requests per hour
RateLimit-Limit: The total number of requests allowed for the current time window.RateLimit-Remaining: How many requests you can still make in the current window.RateLimit-Reset: The time when the current window resets, as a Unix timestamp in seconds.
429 Too Many Requests, stop sending additional requests. Wait the number of seconds in Retry-After, then resume requests.
Errors
The API uses HTTP status codes to indicate the result of a request. When a response includes a JSON error body,code identifies the error and message describes it. For example:
An expired access token can also return
403 Forbidden with an empty body. Request a new access token and retry.
See the Retrieve audit events reference for the response schemas.