openapi: 3.1.0
info:
  title: 1Password Events API
  description: Retrieve audit events from a 1Password account.
  contact:
    name: 1Password Support
    url: https://1password.com/contact-support
    email: support@1password.com
  version: v3
servers:
  - url: https://api.1password.com
    description: 1Password
  - url: https://api.1password.ca
    description: 1Password CA
  - url: https://api.1password.eu
    description: 1Password EU
  - url: https://api.ent.1password.com
    description: 1Password Enterprise
paths:
  /v3/accounts/{account}/audit-events:
    get:
      summary: ListAuditEvents
      description: |-
        Returns a paginated list of audit events for the 1Password account associated
        with your access token. Use optional time bounds to filter the results.
      operationId: ListAuditEvents
      parameters:
        - name: account
          in: path
          description: The account id.
          required: true
          schema:
            type: string
        - name: max_page_size
          in: query
          description: |-
            max_page_size is the maximum number of results to return in a single request.
             Defaults to 100 when omitted or set to 0; must not exceed 1000.
          schema:
            type: integer
            title: max_page_size
            maximum: 1000
            minimum: 0
            format: int32
            description: |-
              max_page_size is the maximum number of results to return in a single request.
               Defaults to 100 when omitted or set to 0; must not exceed 1000.
        - name: page_token
          in: query
          description: An opaque token identifying the next page of results to retrieve.
          schema:
            type: string
            title: page_token
            description: An opaque token identifying the next page of results to retrieve.
        - name: start_time
          in: query
          description: |-
            The API returns only events with an `insert_time` later than `start_time`.
            Omit `start_time` when you send `page_token`.
          schema:
            type: string
            examples:
              - "2023-01-15T01:30:15.01Z"
              - "2024-12-25T12:00:00Z"
            format: date-time
        - name: end_time
          in: query
          description: |-
            The API returns only events with an `insert_time` earlier than `end_time`.
            Omit `end_time` when you send `page_token`.
          schema:
            type: string
            examples:
              - "2023-01-15T01:30:15.01Z"
              - "2024-12-25T12:00:00Z"
            format: date-time
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/audit_logging_services.public_api_service.v3.ListAuditEventsResponse'
        "400":
          $ref: '#/components/responses/BadRequest'
        "401":
          $ref: '#/components/responses/Unauthenticated'
        "403":
          $ref: '#/components/responses/PermissionDenied'
        "429":
          $ref: '#/components/responses/TooManyRequests'
        "500":
          $ref: '#/components/responses/InternalServerError'
        "503":
          $ref: '#/components/responses/ServiceUnavailable'
        "504":
          $ref: '#/components/responses/GatewayTimeout'
components:
  schemas:
    Error:
      type: object
      properties:
        code:
          type: string
          examples:
            - invalid_argument
          description: 'A machine-readable identifier for the error condition: invalid_argument, unauthenticated, permission_denied, not_found, method_not_allowed, resource_exhausted, internal, unavailable, deadline_exceeded, or canceled. More codes may be added, so treat an unknown code as a generic error.'
        message:
          type: string
          examples:
            - page_token must not be empty
          description: A human-readable description of the error.
      required:
        - code
        - message
      description: An error returned by the Events API. This shape is provisional and may change.
    Target:
      type: object
      properties:
        type:
          type: string
          examples:
            - vault
          description: The type of the entity.
        id:
          type: string
          examples:
            - jxsqnqd3wfdqrgb6bbbyybrwfy
          description: Use this identifier with `type` to identify the entity. If the entity has no identifier, this field is an empty string. Integer identifiers are returned as decimal strings.
      required:
        - type
        - id
      additionalProperties: true
      description: |-
        An entity affected by an event. If the target has additional fields, they're nested
        under a key that matches its `type` with hyphens replaced by underscores.
        For example, a target with type `vault-item` has additional fields under `vault_item`.
    audit_logging_services.public_api_service.v3.Account:
      type: object
      properties:
        id:
          type: string
          examples:
            - 56YE2TYN2VFYRLNSHKPW5NVT5E
          title: id
          description: A generic identifier.
        name:
          type: string
          examples:
            - Some Account Name
          title: name
          description: The name of the account.
        state:
          type: string
          examples:
            - A
          title: state
          description: |-
            The current state of the account.
             One of: "R" (registered), "A" (active), "S" (suspended), "D" (deleted), "X" (purging), "Z" (purged).
        type:
          type: string
          examples:
            - B
          title: type
          description: |-
            The type of the account.
             One of: "B" (business), "F" (family), "I" (individual).
        domain:
          type: string
          examples:
            - domain.com
          title: domain
          description: The domain of the account.
      title: Account
      additionalProperties: false
      description: An account associated with a given event.
      x-aep-resource:
        singular: account
    audit_logging_services.public_api_service.v3.Actor:
      type: object
      properties:
        type:
          type: string
          examples:
            - user
          title: type
          description: The type of the actor that initiated the action.
        id:
          type: string
          examples:
            - 56YE2TYN2VFYRLNSHKPW5NVT5E
          title: id
          description: A generic identifier.
        name:
          type:
            - string
            - "null"
          examples:
            - Some User
          title: name
          description: The display name of the actor that initiated the action.
        email:
          type:
            - string
            - "null"
          examples:
            - user.email@domain.com
          title: email
          description: The email address of the actor that initiated the action.
        linked_account:
          oneOf:
            - $ref: '#/components/schemas/audit_logging_services.public_api_service.v3.Account'
            - type: "null"
          title: linked_account
          description: An account associated with a given event.
      title: Actor
      additionalProperties: false
      description: The initiator of the action which produced a given event.
      x-aep-resource:
        singular: actor
    audit_logging_services.public_api_service.v3.AuditEvent:
      type: object
      properties:
        id:
          type: string
          examples:
            - 56YE2TYN2VFYRLNSHKPW5NVT5E
          title: id
          description: A generic identifier.
          readOnly: true
        create_time:
          examples:
            - "2025-01-01T00:00:00Z"
          title: create_time
          description: The time the event occurred.
          type: string
          format: date-time
          readOnly: true
        insert_time:
          examples:
            - "2025-01-01T00:00:01Z"
          title: insert_time
          description: The time the event was received and stored by 1Password.
          type: string
          format: date-time
          readOnly: true
        context:
          title: context
          description: Additional information about the initiator of an action.
          $ref: '#/components/schemas/audit_logging_services.public_api_service.v3.Context'
        actor:
          title: actor
          description: The initiator of the action which produced a given event.
          $ref: '#/components/schemas/audit_logging_services.public_api_service.v3.Actor'
        category:
          type: string
          examples:
            - report
          title: category
          description: The category of the action that produced this event.
        action:
          type: string
          examples:
            - report.view
          title: action
          description: The action that produced this event.
        targets:
          type: array
          items:
            $ref: '#/components/schemas/Target'
          title: targets
          description: |-
            The entities affected by this event. Each entity has a `type` and
             properties specific to that type.
        diff:
          oneOf:
            - $ref: '#/components/schemas/audit_logging_services.public_api_service.v3.Diff'
            - type: "null"
          title: diff
          description: A description of the change made by a given event.
        correlation_id:
          type:
            - string
            - "null"
          examples:
            - C7VYQXG3CZGBVHR2YOL5LXKNJI
          title: correlation_id
          description: |-
            An optional identifier shared by audit events that originated from the same
             bulk action.
        outcome:
          title: outcome
          description: The result of the action that produced this event.
          $ref: '#/components/schemas/audit_logging_services.public_api_service.v3.Outcome'
      title: AuditEvent
      additionalProperties: false
      description: A single audit event object.
      x-aep-resource:
        singular: auditevent
    audit_logging_services.public_api_service.v3.Client:
      type: object
      properties:
        name:
          type: string
          examples:
            - 1Password Extension
          title: name
          description: The name of the client application.
        version:
          type: string
          examples:
            - "81104027"
          title: version
          description: The version of the client application
      title: Client
      additionalProperties: false
      description: Information about the client used by an actor to initiate an action.
      x-aep-resource:
        singular: client
    audit_logging_services.public_api_service.v3.Context:
      type: object
      properties:
        account:
          title: account
          description: Information about the account initiating the event.
          $ref: '#/components/schemas/audit_logging_services.public_api_service.v3.ContextAccount'
        origin:
          type: string
          examples:
            - password_manager
          title: origin
          description: The origin of the action that produced this event.
        session:
          oneOf:
            - $ref: '#/components/schemas/audit_logging_services.public_api_service.v3.Session'
            - type: "null"
          title: session
          description: The session from which an event originated.
        location:
          title: location
          description: A description of the geographical location where an event originated.
          $ref: '#/components/schemas/audit_logging_services.public_api_service.v3.Location'
        device:
          oneOf:
            - $ref: '#/components/schemas/audit_logging_services.public_api_service.v3.Device'
            - type: "null"
          title: device
          description: A description of the device used to initiate an action.
        client:
          oneOf:
            - $ref: '#/components/schemas/audit_logging_services.public_api_service.v3.Client'
            - type: "null"
          title: client
          description: Information about the client used by an actor to initiate an action.
        os:
          oneOf:
            - $ref: '#/components/schemas/audit_logging_services.public_api_service.v3.OS'
            - type: "null"
          title: os
          description: The operating system from which an event originated.
        user_agent:
          type:
            - string
            - "null"
          examples:
            - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.1 Safari/605.1.15
          title: user_agent
          description: The user agent of the client used to initiate the action.
      title: Context
      additionalProperties: false
      description: Additional information about the initiator of an action.
      x-aep-resource:
        singular: context
    audit_logging_services.public_api_service.v3.ContextAccount:
      type: object
      properties:
        id:
          type: string
          examples:
            - 3JPKX6XC6BDDBJGJYCLOSVXQE4
          title: id
          description: A generic identifier.
        name:
          type: string
          examples:
            - Some Account Name
          title: name
          description: The name of the account.
      title: ContextAccount
      additionalProperties: false
      description: Information about the account initiating the event.
      x-aep-resource:
        singular: contextaccount
    audit_logging_services.public_api_service.v3.Device:
      type: object
      properties:
        id:
          type: string
          examples:
            - voruqc6amjy4gs4oh2qs3fw4i4
          title: id
          description: A generic identifier.
        model:
          type: string
          examples:
            - "141.0"
          title: model
          description: The model of the device.
        name:
          type: string
          examples:
            - Safari
          title: name
          description: The name of the device.
      title: Device
      additionalProperties: false
      description: A description of the device used to initiate an action.
      x-aep-resource:
        singular: device
    audit_logging_services.public_api_service.v3.Diff:
      type: object
      properties:
        type:
          type: string
          examples:
            - account-change
          title: type
          description: The type of change made by a given event.
        old_value:
          title: old_value
          description: The state of the resource before the change.
          type: object
        new_value:
          title: new_value
          description: The state of the resource after the change.
          type: object
      title: Diff
      additionalProperties: false
      description: A description of the change made by a given event.
      x-aep-resource:
        singular: diff
    audit_logging_services.public_api_service.v3.ListAuditEventsResponse:
      type: object
      properties:
        results:
          type: array
          items:
            $ref: '#/components/schemas/audit_logging_services.public_api_service.v3.AuditEvent'
          title: results
          description: A subset of the requested audit events.
        next_page_token:
          type: string
          examples:
            - aGVsbG8hIGlzIGl0IG1lIHlvdSBhcmUgbG9va2luZyBmb3IK
          title: next_page_token
          description: An opaque token used to retrieve the next page of results. Empty on the final page.
      title: ListAuditEventsResponse
      additionalProperties: false
      description: ListAuditEventsResponse is the response message for the ListAuditEvents RPC.
    audit_logging_services.public_api_service.v3.Location:
      type: object
      properties:
        ip_address:
          type: string
          examples:
            - 203.0.113.42
          title: ip_address
          description: The IP address from which the action originated.
        region_code:
          type:
            - string
            - "null"
          examples:
            - US
          title: region_code
          description: The ISO 3166-1 alpha-2 country code of the location.
        city:
          type:
            - string
            - "null"
          examples:
            - Toronto
          title: city
          description: The city of the location.
        latitude:
          type:
            - number
            - "null"
          title: latitude
          format: float
          description: The latitude of the location.
        longitude:
          type:
            - number
            - "null"
          title: longitude
          format: float
          description: The longitude of the location.
      title: Location
      additionalProperties: false
      description: A description of the geographical location where an event originated.
      x-aep-resource:
        singular: location
    audit_logging_services.public_api_service.v3.OS:
      type: object
      properties:
        name:
          type: string
          examples:
            - MacOSX
          title: name
          description: The name of the operating system.
        version:
          type: string
          examples:
            - "10.15"
          title: version
          description: The version of the operating system.
      title: OS
      additionalProperties: false
      description: The operating system from which an event originated.
      x-aep-resource:
        singular: os
    audit_logging_services.public_api_service.v3.Outcome:
      type: object
      properties:
        result:
          type: string
          examples:
            - success
          title: result
          description: The result of the action. Possible values are `success`, `failure`, `report`, and `timeout`.
        reason:
          type:
            - string
            - "null"
          examples:
            - invalid-credentials
          title: reason
          description: Additional context about the result of the action.
      title: Outcome
      additionalProperties: false
      description: The result of the action that produced an audit event.
      x-aep-resource:
        singular: outcome
    audit_logging_services.public_api_service.v3.Session:
      type: object
      properties:
        id:
          type: string
          examples:
            - UFR7T3I2FZAQ5GGFYQIY7YUGKE
          title: id
          description: A generic identifier.
        login_time:
          examples:
            - "2025-01-01T00:00:00Z"
          title: login_time
          description: The time the session was created.
          type: string
          format: date-time
      title: Session
      additionalProperties: false
      description: The session from which an event originated.
      x-aep-resource:
        singular: session
  responses:
    BadRequest:
      description: Bad request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    GatewayTimeout:
      description: Gateway timeout.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalServerError:
      description: Internal server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    PermissionDenied:
      description: Permission denied.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ServiceUnavailable:
      description: Service unavailable. Retry the request later.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    TooManyRequests:
      description: Too many requests.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthenticated:
      description: Unauthenticated.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    BearerAuth:
      type: http
      description: Authorize requests with an OAuth 2.0 access token that has the `audit-events.view` scope.
      scheme: bearer
security:
  - BearerAuth: []
