packages feed

agent-push-kit-0.1.0: openapi.yaml

openapi: 3.1.0
info:
  contact:
    name: Agent Push Kit
    url: https://agentpushkit.com
  description: The complete Agent Push Kit REST API. Application event ingestion uses
    an organization key beginning with `apk_`. Authenticated user operations accept
    either an Agent Push Kit login JWT or an agent access token beginning with `apt_`.
  license:
    name: MIT
    url: https://opensource.org/license/mit
  title: Agent Push Kit API
  version: 0.1.0
servers:
- description: Production
  url: https://api.chatdna.co/agent-push-kit/v1
security:
- UserOrAgent: []
tags:
- name: Authentication
- name: Account
- name: Customer accounts
- name: Agent tokens
- name: Events
- name: Preferences
- name: Devices
- name: Health
paths:
  /auth/register:
    post:
      operationId: register
      requestBody:
        $ref: "#/components/requestBodies/Register"
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AuthResponse"
          description: Registered and authenticated
        "400":
          $ref: "#/components/responses/BadRequest"
        "409":
          $ref: "#/components/responses/Conflict"
      security: []
      summary: Create a user and first customer account
      tags:
      - Authentication
  /auth/login:
    post:
      operationId: loginWithPassword
      requestBody:
        $ref: "#/components/requestBodies/PasswordLogin"
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AuthResponse"
          description: Authenticated
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
      security: []
      summary: Log in with email and password
      tags:
      - Authentication
  /auth/google:
    post:
      operationId: loginWithGoogle
      requestBody:
        $ref: "#/components/requestBodies/ProviderLogin"
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AuthResponse"
          description: Authenticated
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "409":
          $ref: "#/components/responses/Conflict"
      security: []
      summary: Log in or attach an account using a verified Google ID token
      tags:
      - Authentication
  /auth/apple:
    post:
      operationId: loginWithApple
      requestBody:
        $ref: "#/components/requestBodies/ProviderLogin"
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AuthResponse"
          description: Authenticated
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "409":
          $ref: "#/components/responses/Conflict"
      security: []
      summary: Log in or attach an account using a Sign in with Apple identity token
      tags:
      - Authentication
  /auth/password-reset/request:
    post:
      operationId: requestPasswordReset
      requestBody:
        $ref: "#/components/requestBodies/PasswordResetRequest"
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AcceptedResponse"
          description: Accepted whether or not the email exists
        "400":
          $ref: "#/components/responses/BadRequest"
      security: []
      summary: Email a single-use password reset token
      tags:
      - Authentication
  /auth/password-reset/complete:
    post:
      operationId: completePasswordReset
      requestBody:
        $ref: "#/components/requestBodies/PasswordResetComplete"
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AuthResponse"
          description: Password changed and authenticated
        "400":
          $ref: "#/components/responses/BadRequest"
      security: []
      summary: Choose a new password and log in
      tags:
      - Authentication
  /me:
    delete:
      operationId: deleteCurrentAccount
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DeletedResponse"
          description: Deleted
        "401":
          $ref: "#/components/responses/Unauthorized"
      summary: Delete the current user and customer accounts they own
      tags:
      - Account
    get:
      operationId: getCurrentAccount
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CurrentAccount"
          description: Current account
        "401":
          $ref: "#/components/responses/Unauthorized"
      summary: Get the current user and customer accounts
      tags:
      - Account
  /organizations:
    get:
      operationId: listOrganizations
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  $ref: "#/components/schemas/Organization"
                type: array
                default: null
          description: Customer accounts
        "401":
          $ref: "#/components/responses/Unauthorized"
      summary: List customer accounts available to the current user
      tags:
      - Customer accounts
    post:
      operationId: createOrganization
      requestBody:
        $ref: "#/components/requestBodies/CreateOrganization"
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OrganizationCreated"
          description: Created; the organization API key is returned only now
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
      summary: Create another Agent Push Kit customer account
      tags:
      - Customer accounts
  /organizations/{organizationId}/members:
    get:
      operationId: listOrganizationMembers
      parameters:
      - $ref: "#/components/parameters/OrganizationId"
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  $ref: "#/components/schemas/Membership"
                type: array
                default: null
          description: Members
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
      summary: List members of a customer account
      tags:
      - Customer accounts
    post:
      operationId: addOrganizationMember
      parameters:
      - $ref: "#/components/parameters/OrganizationId"
      requestBody:
        $ref: "#/components/requestBodies/AddMember"
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Membership"
          description: Member added
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
      summary: Add an already-registered user to a customer account
      tags:
      - Customer accounts
  /organizations/{organizationId}/api-key/regenerate:
    post:
      description: The previous `apk_` key stops working immediately. The replacement
        is returned only in this response.
      operationId: regenerateOrganizationApiKey
      parameters:
      - $ref: "#/components/parameters/OrganizationId"
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OrganizationApiKeyCreated"
          description: Key regenerated
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
      summary: Rotate the application event-ingestion key
      tags:
      - Customer accounts
  /agent-tokens:
    get:
      operationId: listAgentTokens
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  $ref: "#/components/schemas/AgentToken"
                type: array
                default: null
          description: Agent tokens
        "401":
          $ref: "#/components/responses/Unauthorized"
      summary: List agent access tokens without their secrets
      tags:
      - Agent tokens
    post:
      description: The raw `apt_` token is shown once. Store it before dismissing
        the response.
      operationId: createAgentToken
      requestBody:
        $ref: "#/components/requestBodies/CreateAgentToken"
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AgentTokenCreated"
          description: Token created
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
      summary: Create a named non-expiring agent token
      tags:
      - Agent tokens
  /agent-tokens/{tokenId}:
    delete:
      operationId: revokeAgentToken
      parameters:
      - $ref: "#/components/parameters/TokenId"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RevokedResponse"
          description: Revoked or already absent
        "401":
          $ref: "#/components/responses/Unauthorized"
      summary: Revoke one of the current user's agent tokens
      tags:
      - Agent tokens
  /events:
    post:
      operationId: sendEvent
      requestBody:
        $ref: "#/components/requestBodies/SendEvent"
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IngestionResult"
          description: Event stored and push delivery attempted
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
      security:
      - OrganizationApiKey: []
      summary: Send an event using an application ingestion key
      tags:
      - Events
  /organizations/{organizationId}/events:
    get:
      operationId: listEvents
      parameters:
      - $ref: "#/components/parameters/OrganizationId"
      - $ref: "#/components/parameters/ServiceName"
      - $ref: "#/components/parameters/EventType"
      - $ref: "#/components/parameters/SearchText"
      - $ref: "#/components/parameters/Cursor"
      - $ref: "#/components/parameters/Limit"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EventPage"
          description: Event page
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
      summary: List a paginated inbox
      tags:
      - Events
    post:
      operationId: sendEventAsUser
      parameters:
      - $ref: "#/components/parameters/OrganizationId"
      requestBody:
        $ref: "#/components/requestBodies/SendEvent"
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IngestionResult"
          description: Event stored and push delivery attempted
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
      summary: Send an event as an authenticated user or agent
      tags:
      - Events
  /organizations/{organizationId}/events/search:
    post:
      operationId: searchEvents
      parameters:
      - $ref: "#/components/parameters/OrganizationId"
      requestBody:
        $ref: "#/components/requestBodies/SearchEvents"
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EventPage"
          description: Event page
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
      summary: Search events with a validated Boolean filter tree
      tags:
      - Events
  /organizations/{organizationId}/events/{eventId}:
    get:
      operationId: getEvent
      parameters:
      - $ref: "#/components/parameters/OrganizationId"
      - $ref: "#/components/parameters/EventId"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EventDetail"
          description: Event
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
      summary: Get one event including metadata
      tags:
      - Events
  /organizations/{organizationId}/services:
    get:
      operationId: listServices
      parameters:
      - $ref: "#/components/parameters/OrganizationId"
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  $ref: "#/components/schemas/Service"
                type: array
                default: null
          description: Services
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
      summary: List services discovered from ingested events
      tags:
      - Events
  /organizations/{organizationId}/types:
    get:
      operationId: listNotificationTypes
      parameters:
      - $ref: "#/components/parameters/OrganizationId"
      - description: Optionally restrict types to one service ID.
        explode: true
        in: query
        name: serviceId
        required: false
        schema:
          type: string
        style: form
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  type: string
                type: array
                default: null
          description: Notification types
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
      summary: List distinct notification types
      tags:
      - Events
  /organizations/{organizationId}/preferences:
    get:
      operationId: listPreferences
      parameters:
      - $ref: "#/components/parameters/OrganizationId"
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  $ref: "#/components/schemas/ServicePreference"
                type: array
                default: null
          description: Preferences
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
      summary: List service defaults and exact-type overrides
      tags:
      - Preferences
  /services/{serviceId}/preference:
    put:
      operationId: setServicePreference
      parameters:
      - $ref: "#/components/parameters/ServiceId"
      requestBody:
        $ref: "#/components/requestBodies/SetEnabled"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PreferenceRecord"
          description: Preference saved
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
      summary: Enable or disable pushes for a service by default
      tags:
      - Preferences
  /services/{serviceId}/types/{type}/preference:
    delete:
      operationId: removeTypePreference
      parameters:
      - $ref: "#/components/parameters/ServiceId"
      - $ref: "#/components/parameters/TypePath"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InheritedResponse"
          description: Override removed
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
      summary: Remove an exact-type override so it inherits the service default
      tags:
      - Preferences
    put:
      operationId: setTypePreference
      parameters:
      - $ref: "#/components/parameters/ServiceId"
      - $ref: "#/components/parameters/TypePath"
      requestBody:
        $ref: "#/components/requestBodies/SetEnabled"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PreferenceRecord"
          description: Preference saved
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
      summary: Override push delivery for one exact notification type
      tags:
      - Preferences
  /devices:
    post:
      operationId: registerDevice
      requestBody:
        $ref: "#/components/requestBodies/RegisterDevice"
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Device"
          description: Device registered
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
      summary: Register or refresh an APNs device
      tags:
      - Devices
  /devices/{installationId}:
    delete:
      operationId: removeDevice
      parameters:
      - $ref: "#/components/parameters/InstallationId"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DisabledResponse"
          description: Device disabled
        "401":
          $ref: "#/components/responses/Unauthorized"
      summary: Disable push delivery to one installation
      tags:
      - Devices
  /web-push/configuration:
    get:
      operationId: getWebPushConfiguration
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebPushConfiguration"
          description: Browser push configuration
        "401":
          $ref: "#/components/responses/Unauthorized"
      summary: Get browser push availability and its public VAPID key
      tags:
      - Devices
  /web-push/subscriptions:
    post:
      operationId: registerWebPushSubscription
      requestBody:
        $ref: "#/components/requestBodies/RegisterWebPushSubscription"
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebPushSubscription"
          description: Browser subscription registered
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
      summary: Register or refresh a browser push subscription
      tags:
      - Devices
  /web-push/subscriptions/{subscriptionId}:
    delete:
      operationId: removeWebPushSubscription
      parameters:
      - $ref: "#/components/parameters/SubscriptionId"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DisabledResponse"
          description: Browser subscription disabled
        "401":
          $ref: "#/components/responses/Unauthorized"
      summary: Disable a browser push subscription
      tags:
      - Devices
  /health:
    get:
      operationId: getHealth
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
          description: Healthy
      security: []
      summary: Check Agent Push Kit API health
      tags:
      - Health
  /mcp:
    post:
      description: This endpoint accepts only an `apt_` agent access token.
      operationId: callMcp
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              type: object
        required: true
      responses:
        "200":
          description: MCP JSON-RPC or SSE response
        "202":
          description: MCP notification accepted
        "401":
          $ref: "#/components/responses/Unauthorized"
      security:
      - AgentToken: []
      summary: Connect through stateless MCP Streamable HTTP
      tags:
      - Agent tokens
components:
  parameters:
    OrganizationId:
      explode: false
      in: path
      name: organizationId
      required: true
      schema:
        type: string
      style: simple
    TokenId:
      explode: false
      in: path
      name: tokenId
      required: true
      schema:
        type: string
      style: simple
    EventId:
      explode: false
      in: path
      name: eventId
      required: true
      schema:
        type: string
      style: simple
    ServiceId:
      explode: false
      in: path
      name: serviceId
      required: true
      schema:
        type: string
      style: simple
    TypePath:
      explode: false
      in: path
      name: type
      required: true
      schema:
        maxLength: 120
        type: string
      style: simple
    InstallationId:
      explode: false
      in: path
      name: installationId
      required: true
      schema:
        maxLength: 200
        minLength: 4
        type: string
      style: simple
    SubscriptionId:
      explode: false
      in: path
      name: subscriptionId
      required: true
      schema:
        type: string
      style: simple
    ServiceName:
      explode: true
      in: query
      name: service
      required: false
      schema:
        maxLength: 120
        type: string
      style: form
    EventType:
      explode: true
      in: query
      name: type
      required: false
      schema:
        maxLength: 120
        type: string
      style: form
    SearchText:
      explode: true
      in: query
      name: search
      required: false
      schema:
        maxLength: 200
        type: string
      style: form
    Cursor:
      explode: true
      in: query
      name: cursor
      required: false
      schema:
        type: string
      style: form
    Limit:
      explode: true
      in: query
      name: limit
      required: false
      schema:
        default: 50
        maximum: 100
        minimum: 1
        type: integer
      style: form
  requestBodies:
    Register:
      content:
        application/json:
          example:
            email: alex@example.com
            password: correct horse battery staple
            displayName: Alex
          schema:
            $ref: "#/components/schemas/RegisterInput"
      required: true
    PasswordLogin:
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/PasswordLoginInput"
      required: true
    ProviderLogin:
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ProviderLoginInput"
      required: true
    PasswordResetRequest:
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/PasswordResetRequestInput"
      required: true
    PasswordResetComplete:
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/PasswordResetCompleteInput"
      required: true
    CreateOrganization:
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/CreateOrganizationInput"
      required: true
    AddMember:
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/AddMemberInput"
      required: true
    CreateAgentToken:
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/CreateAgentTokenInput"
      required: true
    SendEvent:
      content:
        application/json:
          example:
            service: chatdna
            type: user.signup
            title: New user signup
            body: alex@example.com created an account
            externalId: signup_user_123
            actionUrl: https://example.com/users/123
            metadata:
              userId: "123"
              plan: trial
          schema:
            $ref: "#/components/schemas/SendEventInput"
      required: true
    SearchEvents:
      content:
        application/json:
          example:
            filter:
              operator: AND
              children:
              - field: service
                comparison: equals
                value: chatdna
              - field: body
                comparison: contains
                value: alex
            limit: 50
          schema:
            $ref: "#/components/schemas/SearchEventsInput"
      required: true
    SetEnabled:
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/SetEnabledInput"
      required: true
    RegisterDevice:
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/RegisterDeviceInput"
      required: true
    RegisterWebPushSubscription:
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/RegisterWebPushSubscriptionInput"
      required: true
  responses:
    BadRequest:
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
      description: Invalid request
    Unauthorized:
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
      description: "Missing, invalid, or revoked credentials"
    Forbidden:
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
      description: The operation requires an owner
    NotFound:
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
      description: The resource is absent or outside the current user's customer accounts
    Conflict:
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
      description: The requested identity or membership already exists
  schemas:
    RegisterInput:
      additionalProperties: false
      example:
        email: email
        password: password
        displayName: displayName
      properties:
        email:
          format: email
          maxLength: 320
          type: string
        password:
          maxLength: 200
          minLength: 8
          type: string
        displayName:
          maxLength: 120
          type: string
      required:
      - email
      - password
    PasswordLoginInput:
      additionalProperties: false
      example:
        email: email
        password: password
      properties:
        email:
          format: email
          maxLength: 320
          type: string
        password:
          maxLength: 200
          minLength: 1
          type: string
      required:
      - email
      - password
    ProviderLoginInput:
      additionalProperties: false
      example:
        idToken: idToken
        displayName: displayName
      properties:
        idToken:
          minLength: 20
          type: string
        displayName:
          maxLength: 120
          type: string
      required:
      - idToken
    PasswordResetRequestInput:
      additionalProperties: false
      example:
        email: email
      properties:
        email:
          format: email
          maxLength: 320
          type: string
      required:
      - email
    PasswordResetCompleteInput:
      additionalProperties: false
      example:
        token: token
        password: password
      properties:
        token:
          minLength: 20
          type: string
        password:
          maxLength: 200
          minLength: 8
          type: string
      required:
      - password
      - token
    CreateOrganizationInput:
      additionalProperties: false
      example:
        name: name
      properties:
        name:
          maxLength: 120
          minLength: 1
          type: string
      required:
      - name
    AddMemberInput:
      additionalProperties: false
      example:
        email: email
      properties:
        email:
          format: email
          maxLength: 320
          type: string
      required:
      - email
    CreateAgentTokenInput:
      additionalProperties: false
      example:
        name: name
      properties:
        name:
          maxLength: 120
          minLength: 1
          type: string
      required:
      - name
    SendEventInput:
      additionalProperties: {}
      example:
        service: service
        serviceDisplayName: serviceDisplayName
        type: type
        title: title
        body: body
        metadata:
          key: ""
        externalId: externalId
        actionUrl: https://openapi-generator.tech
      properties:
        service:
          maxLength: 120
          minLength: 1
          type: string
        serviceDisplayName:
          maxLength: 120
          minLength: 1
          type: string
        type:
          maxLength: 120
          minLength: 1
          type: string
        title:
          maxLength: 200
          minLength: 1
          type: string
        body:
          maxLength: 10000
          minLength: 1
          type: string
        metadata:
          additionalProperties: true
          type: object
        externalId:
          maxLength: 300
          minLength: 1
          type: string
        actionUrl:
          format: uri
          maxLength: 2000
          type: string
      required:
      - body
      - service
      - title
      - type
    SearchEventsInput:
      additionalProperties: false
      example:
        filter:
          operator: AND
          children:
          - null
          - null
          - null
          - null
          - null
        cursor: cursor
        limit: 8
      properties:
        filter:
          $ref: "#/components/schemas/EventFilter"
        cursor:
          type: string
        limit:
          default: 50
          maximum: 100
          minimum: 1
          type: integer
      required:
      - filter
    EventFilter:
      oneOf:
      - $ref: "#/components/schemas/FilterGroup"
      - $ref: "#/components/schemas/FilterNot"
      - $ref: "#/components/schemas/TextFilterCondition"
      - $ref: "#/components/schemas/TimeFilterCondition"
    FilterGroup:
      additionalProperties: false
      example:
        operator: AND
        children:
        - null
        - null
        - null
        - null
        - null
      properties:
        operator:
          enum:
          - AND
          - OR
          type: string
        children:
          items:
            $ref: "#/components/schemas/EventFilter"
          maxItems: 10
          minItems: 1
          type: array
          default: null
      required:
      - children
      - operator
    FilterNot:
      additionalProperties: false
      properties:
        operator:
          enum:
          - NOT
          type: string
        child:
          $ref: "#/components/schemas/EventFilter"
      required:
      - child
      - operator
    TextFilterCondition:
      additionalProperties: false
      properties:
        field:
          enum:
          - service
          - type
          - title
          - body
          type: string
        comparison:
          enum:
          - equals
          - contains
          type: string
        value:
          maxLength: 200
          minLength: 1
          type: string
      required:
      - comparison
      - field
      - value
    TimeFilterCondition:
      additionalProperties: false
      properties:
        field:
          enum:
          - createdAt
          type: string
        comparison:
          enum:
          - before
          - after
          - onOrBefore
          - onOrAfter
          - equals
          type: string
        value:
          format: date-time
          type: string
      required:
      - comparison
      - field
      - value
    SetEnabledInput:
      additionalProperties: false
      example:
        enabled: true
      properties:
        enabled:
          type: boolean
      required:
      - enabled
    RegisterDeviceInput:
      additionalProperties: false
      example:
        deviceToken: deviceToken
        installationId: installationId
        environment: SANDBOX
        appVersion: appVersion
      properties:
        deviceToken:
          maxLength: 256
          minLength: 32
          type: string
        installationId:
          maxLength: 200
          minLength: 4
          type: string
        environment:
          enum:
          - SANDBOX
          - PRODUCTION
          type: string
        appVersion:
          maxLength: 50
          type: string
      required:
      - deviceToken
      - environment
      - installationId
    RegisterWebPushSubscriptionInput:
      additionalProperties: {}
      example:
        endpoint: https://openapi-generator.tech
        keys:
          p256dh: p256dh
          auth: auth
      properties:
        endpoint:
          format: uri
          maxLength: 4000
          type: string
        keys:
          $ref: "#/components/schemas/RegisterWebPushSubscriptionInput_keys"
      required:
      - endpoint
      - keys
    User:
      example:
        id: id
        email: email
        displayName: displayName
        hasPassword: true
        hasGoogle: true
        hasApple: true
      properties:
        id:
          type: string
        email:
          format: email
          type: string
        displayName:
          nullable: true
          type: string
        hasPassword:
          type: boolean
        hasGoogle:
          type: boolean
        hasApple:
          type: boolean
      required:
      - email
      - hasApple
      - hasGoogle
      - hasPassword
      - id
    Organization:
      example:
        id: id
        name: name
        role: OWNER
        createdAt: 2000-01-23T04:56:07.000+00:00
        updatedAt: 2000-01-23T04:56:07.000+00:00
        joinedAt: 2000-01-23T04:56:07.000+00:00
        apiKey:
          keyPrefix: keyPrefix
          lastFour: lastFour
          updatedAt: 2000-01-23T04:56:07.000+00:00
        _count:
          memberships: 0
          services: 6
      properties:
        id:
          type: string
        name:
          type: string
        role:
          enum:
          - OWNER
          - MEMBER
          type: string
        createdAt:
          format: date-time
          type: string
        updatedAt:
          format: date-time
          type: string
        joinedAt:
          format: date-time
          type: string
        apiKey:
          $ref: "#/components/schemas/ApiKeySummary"
        _count:
          $ref: "#/components/schemas/Organization__count"
      required:
      - createdAt
      - id
      - joinedAt
      - name
      - role
      - updatedAt
    ApiKeySummary:
      example:
        keyPrefix: keyPrefix
        lastFour: lastFour
        updatedAt: 2000-01-23T04:56:07.000+00:00
      nullable: true
      properties:
        keyPrefix:
          type: string
        lastFour:
          type: string
        updatedAt:
          format: date-time
          type: string
      type: object
    Membership:
      example:
        id: id
        role: OWNER
        createdAt: 2000-01-23T04:56:07.000+00:00
        user:
          id: id
          email: email
          displayName: displayName
      properties:
        id:
          type: string
        role:
          enum:
          - OWNER
          - MEMBER
          type: string
        createdAt:
          format: date-time
          type: string
        user:
          $ref: "#/components/schemas/Membership_user"
      required:
      - createdAt
      - id
      - role
      - user
    AgentToken:
      example:
        id: id
        name: name
        keyPrefix: keyPrefix
        lastFour: lastFour
        createdAt: 2000-01-23T04:56:07.000+00:00
        lastUsedAt: 2000-01-23T04:56:07.000+00:00
        revokedAt: 2000-01-23T04:56:07.000+00:00
      properties:
        id:
          type: string
        name:
          type: string
        keyPrefix:
          type: string
        lastFour:
          type: string
        createdAt:
          format: date-time
          type: string
        lastUsedAt:
          format: date-time
          nullable: true
          type: string
        revokedAt:
          format: date-time
          nullable: true
          type: string
      required:
      - createdAt
      - id
      - keyPrefix
      - lastFour
      - name
    ServiceSummary:
      example:
        id: id
        name: name
        displayName: displayName
      properties:
        id:
          type: string
        name:
          type: string
        displayName:
          type: string
      required:
      - displayName
      - id
      - name
    Service:
      allOf:
      - $ref: "#/components/schemas/ServiceSummary"
      - properties:
          createdAt:
            format: date-time
            type: string
          _count:
            $ref: "#/components/schemas/Service_allOf__count"
        required:
        - _count
        - createdAt
      example:
        id: id
        name: name
        displayName: displayName
        createdAt: 2000-01-23T04:56:07.000+00:00
        _count:
          events: 0
    EventSummary:
      example:
        id: id
        type: type
        title: title
        body: body
        externalId: externalId
        actionUrl: https://openapi-generator.tech
        createdAt: 2000-01-23T04:56:07.000+00:00
        service:
          id: id
          name: name
          displayName: displayName
      properties:
        id:
          type: string
        type:
          type: string
        title:
          type: string
        body:
          type: string
        externalId:
          nullable: true
          type: string
        actionUrl:
          format: uri
          nullable: true
          type: string
        createdAt:
          format: date-time
          type: string
        service:
          $ref: "#/components/schemas/ServiceSummary"
      required:
      - body
      - createdAt
      - id
      - service
      - title
      - type
    EventDetail:
      allOf:
      - $ref: "#/components/schemas/EventSummary"
      - properties:
          serviceId:
            type: string
          metadata:
            additionalProperties: true
            nullable: true
            type: object
        required:
        - serviceId
      example:
        id: id
        type: type
        title: title
        body: body
        externalId: externalId
        actionUrl: https://openapi-generator.tech
        createdAt: 2000-01-23T04:56:07.000+00:00
        service:
          id: id
          name: name
          displayName: displayName
        serviceId: serviceId
        metadata:
          key: ""
    EventPage:
      example:
        events:
        - id: id
          type: type
          title: title
          body: body
          externalId: externalId
          actionUrl: https://openapi-generator.tech
          createdAt: 2000-01-23T04:56:07.000+00:00
          service:
            id: id
            name: name
            displayName: displayName
        - id: id
          type: type
          title: title
          body: body
          externalId: externalId
          actionUrl: https://openapi-generator.tech
          createdAt: 2000-01-23T04:56:07.000+00:00
          service:
            id: id
            name: name
            displayName: displayName
        nextCursor: nextCursor
      properties:
        events:
          items:
            $ref: "#/components/schemas/EventSummary"
          type: array
          default: null
        nextCursor:
          nullable: true
          type: string
      required:
      - events
    DeliverySummary:
      example:
        sent: 0
        failed: 6
        suppressedUsers: 1
        eligibleDevices: 5
      properties:
        sent:
          type: integer
        failed:
          type: integer
        suppressedUsers:
          type: integer
        eligibleDevices:
          type: integer
      required:
      - eligibleDevices
      - failed
      - sent
      - suppressedUsers
    IngestionResult:
      example:
        event:
          id: id
          type: type
          title: title
          body: body
          externalId: externalId
          actionUrl: https://openapi-generator.tech
          createdAt: 2000-01-23T04:56:07.000+00:00
          service:
            id: id
            name: name
            displayName: displayName
          serviceId: serviceId
          metadata:
            key: ""
        duplicate: true
        delivery:
          sent: 0
          failed: 6
          suppressedUsers: 1
          eligibleDevices: 5
      properties:
        event:
          $ref: "#/components/schemas/EventDetail"
        duplicate:
          type: boolean
        delivery:
          $ref: "#/components/schemas/DeliverySummary"
      required:
      - delivery
      - duplicate
      - event
    TypeOverride:
      example:
        type: type
        enabled: true
        updatedAt: 2000-01-23T04:56:07.000+00:00
      properties:
        type:
          type: string
        enabled:
          type: boolean
        updatedAt:
          format: date-time
          type: string
      required:
      - enabled
      - type
      - updatedAt
    ServicePreference:
      example:
        id: id
        name: name
        displayName: displayName
        enabled: true
        typeOverrides:
        - type: type
          enabled: true
          updatedAt: 2000-01-23T04:56:07.000+00:00
        - type: type
          enabled: true
          updatedAt: 2000-01-23T04:56:07.000+00:00
      properties:
        id:
          type: string
        name:
          type: string
        displayName:
          type: string
        enabled:
          type: boolean
        typeOverrides:
          items:
            $ref: "#/components/schemas/TypeOverride"
          type: array
          default: null
      required:
      - displayName
      - enabled
      - id
      - name
      - typeOverrides
    PreferenceRecord:
      example:
        serviceId: serviceId
        typeKey: typeKey
        enabled: true
        updatedAt: 2000-01-23T04:56:07.000+00:00
      properties:
        serviceId:
          type: string
        typeKey:
          type: string
        enabled:
          type: boolean
        updatedAt:
          format: date-time
          type: string
      required:
      - enabled
      - serviceId
      - typeKey
      - updatedAt
    Device:
      example:
        id: id
        installationId: installationId
        environment: SANDBOX
        appVersion: appVersion
        enabled: true
        lastSeenAt: 2000-01-23T04:56:07.000+00:00
      properties:
        id:
          type: string
        installationId:
          type: string
        environment:
          enum:
          - SANDBOX
          - PRODUCTION
          type: string
        appVersion:
          nullable: true
          type: string
        enabled:
          type: boolean
        lastSeenAt:
          format: date-time
          type: string
      required:
      - enabled
      - environment
      - id
      - installationId
      - lastSeenAt
    WebPushConfiguration:
      example:
        enabled: true
        publicKey: publicKey
      properties:
        enabled:
          type: boolean
        publicKey:
          nullable: true
          type: string
      required:
      - enabled
    WebPushSubscription:
      example:
        id: id
        enabled: true
        lastSeenAt: 2000-01-23T04:56:07.000+00:00
      properties:
        id:
          type: string
        enabled:
          type: boolean
        lastSeenAt:
          format: date-time
          type: string
      required:
      - enabled
      - id
      - lastSeenAt
    HealthResponse:
      example:
        status: ok
        service: agent-push-kit
      properties:
        status:
          enum:
          - ok
          type: string
        service:
          enum:
          - agent-push-kit
          type: string
      required:
      - service
      - status
    AuthResponse:
      example:
        accessToken: accessToken
        user:
          id: id
          email: email
          displayName: displayName
          hasPassword: true
          hasGoogle: true
          hasApple: true
        organizations:
        - id: id
          name: name
          role: OWNER
          createdAt: 2000-01-23T04:56:07.000+00:00
          updatedAt: 2000-01-23T04:56:07.000+00:00
          joinedAt: 2000-01-23T04:56:07.000+00:00
          apiKey:
            keyPrefix: keyPrefix
            lastFour: lastFour
            updatedAt: 2000-01-23T04:56:07.000+00:00
          _count:
            memberships: 0
            services: 6
        - id: id
          name: name
          role: OWNER
          createdAt: 2000-01-23T04:56:07.000+00:00
          updatedAt: 2000-01-23T04:56:07.000+00:00
          joinedAt: 2000-01-23T04:56:07.000+00:00
          apiKey:
            keyPrefix: keyPrefix
            lastFour: lastFour
            updatedAt: 2000-01-23T04:56:07.000+00:00
          _count:
            memberships: 0
            services: 6
        bootstrapApiKey: bootstrapApiKey
      properties:
        accessToken:
          type: string
        user:
          $ref: "#/components/schemas/User"
        organizations:
          items:
            $ref: "#/components/schemas/Organization"
          type: array
          default: null
        bootstrapApiKey:
          description: Present only when a new customer account was created.
          type: string
      required:
      - accessToken
      - organizations
      - user
    CurrentAccount:
      example:
        user:
          id: id
          email: email
          displayName: displayName
          hasPassword: true
          hasGoogle: true
          hasApple: true
        organizations:
        - id: id
          name: name
          role: OWNER
          createdAt: 2000-01-23T04:56:07.000+00:00
          updatedAt: 2000-01-23T04:56:07.000+00:00
          joinedAt: 2000-01-23T04:56:07.000+00:00
          apiKey:
            keyPrefix: keyPrefix
            lastFour: lastFour
            updatedAt: 2000-01-23T04:56:07.000+00:00
          _count:
            memberships: 0
            services: 6
        - id: id
          name: name
          role: OWNER
          createdAt: 2000-01-23T04:56:07.000+00:00
          updatedAt: 2000-01-23T04:56:07.000+00:00
          joinedAt: 2000-01-23T04:56:07.000+00:00
          apiKey:
            keyPrefix: keyPrefix
            lastFour: lastFour
            updatedAt: 2000-01-23T04:56:07.000+00:00
          _count:
            memberships: 0
            services: 6
      properties:
        user:
          $ref: "#/components/schemas/User"
        organizations:
          items:
            $ref: "#/components/schemas/Organization"
          type: array
          default: null
      required:
      - organizations
      - user
    OrganizationRecord:
      example:
        id: id
        name: name
        createdAt: 2000-01-23T04:56:07.000+00:00
        updatedAt: 2000-01-23T04:56:07.000+00:00
      properties:
        id:
          type: string
        name:
          type: string
        createdAt:
          format: date-time
          type: string
        updatedAt:
          format: date-time
          type: string
      required:
      - createdAt
      - id
      - name
      - updatedAt
    OrganizationCreated:
      example:
        organization:
          id: id
          name: name
          createdAt: 2000-01-23T04:56:07.000+00:00
          updatedAt: 2000-01-23T04:56:07.000+00:00
        apiKey: apiKey
      properties:
        organization:
          $ref: "#/components/schemas/OrganizationRecord"
        apiKey:
          pattern: ^apk_
          type: string
      required:
      - apiKey
      - organization
    OrganizationApiKeyCreated:
      example:
        keyPrefix: keyPrefix
        lastFour: lastFour
        updatedAt: 2000-01-23T04:56:07.000+00:00
        apiKey: apiKey
      properties:
        keyPrefix:
          type: string
        lastFour:
          type: string
        updatedAt:
          format: date-time
          type: string
        apiKey:
          pattern: ^apk_
          type: string
      required:
      - apiKey
      - keyPrefix
      - lastFour
      - updatedAt
    AgentTokenCreated:
      allOf:
      - $ref: "#/components/schemas/AgentToken"
      - properties:
          token:
            pattern: ^apt_
            type: string
        required:
        - token
      example:
        id: id
        name: name
        keyPrefix: keyPrefix
        lastFour: lastFour
        createdAt: 2000-01-23T04:56:07.000+00:00
        lastUsedAt: 2000-01-23T04:56:07.000+00:00
        revokedAt: 2000-01-23T04:56:07.000+00:00
        token: token
    AcceptedResponse:
      example:
        accepted: true
      properties:
        accepted:
          type: boolean
      required:
      - accepted
    DeletedResponse:
      example:
        deleted: true
      properties:
        deleted:
          type: boolean
      required:
      - deleted
    RevokedResponse:
      example:
        revoked: true
      properties:
        revoked:
          type: boolean
      required:
      - revoked
    InheritedResponse:
      example:
        inherited: true
      properties:
        inherited:
          type: boolean
      required:
      - inherited
    DisabledResponse:
      example:
        disabled: true
      properties:
        disabled:
          type: boolean
      required:
      - disabled
    ErrorResponse:
      example:
        statusCode: 1
        message: message
        error: error
      properties:
        statusCode:
          type: integer
        message:
          type: string
        error:
          type: string
      required:
      - message
      - statusCode
    RegisterWebPushSubscriptionInput_keys:
      additionalProperties: false
      example:
        p256dh: p256dh
        auth: auth
      properties:
        p256dh:
          maxLength: 500
          minLength: 20
          type: string
        auth:
          maxLength: 200
          minLength: 8
          type: string
      required:
      - auth
      - p256dh
    Organization__count:
      example:
        memberships: 0
        services: 6
      properties:
        memberships:
          type: integer
        services:
          type: integer
    Membership_user:
      example:
        id: id
        email: email
        displayName: displayName
      properties:
        id:
          type: string
        email:
          format: email
          type: string
        displayName:
          nullable: true
          type: string
      required:
      - email
      - id
    Service_allOf__count:
      example:
        events: 0
      properties:
        events:
          type: integer
      required:
      - events
  securitySchemes:
    UserOrAgent:
      bearerFormat: Agent Push Kit JWT or apt_ token
      description: Use the login JWT in the human app or a named `apt_` token for
        agents.
      scheme: bearer
      type: http
    AgentToken:
      bearerFormat: apt_
      description: A named agent access token created by an authenticated user.
      scheme: bearer
      type: http
    OrganizationApiKey:
      bearerFormat: apk_
      description: An organization-level application ingestion key.
      scheme: bearer
      type: http