openapi: 3.1.0
info:
  title: AbaNinja Webhooks API
  version: 3.0.0
  x-domain-id: webhooks
servers:
  - url: https://api.abaninja.ch
    description: The AbaNinja API server
tags:
  - name: outgoing-webhooks
    description: Manage outgoing webhooks
    x-displayName: Outgoing Webhooks
security:
  - ApiToken: []
paths:
  /accounts/{accountUuid}/webhooks/v2/outgoing-webhook-events:
    get:
      tags:
        - outgoing-webhooks
      summary: Get available webhook types
      description: Get a list of available outgoing webhook event types
      operationId: webhooks_list_outgoing_webhook_events
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for successful requests
                    required:
                      - data
                      - message
                      - status
                    properties:
                      data:
                        title: data
                      message:
                        title: message
                        type: string
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                      meta:
                        title: meta
                        type:
                          - object
                          - 'null'
                    type: object
                  - properties:
                      data:
                        type: array
                        items:
                          title: Webhook event type resource
                          properties:
                            key:
                              type: string
                              enum:
                                - payment-received
                                - product-updated
                            name:
                              type: string
                          type: object
                      status:
                        example: 200
                    type: object
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/settings
      x-legacy-operation-id: 5f40fbf5c4df3da7968b5417b399702d
      x-required-scopes:
        - settings
  /accounts/{accountUuid}/webhooks/v2/outgoing-webhooks:
    get:
      tags:
        - outgoing-webhooks
      summary: Get registered webhooks
      description: Get a list of already registered webhooks
      operationId: webhooks_list_outgoing_webhooks
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for successful requests
                    required:
                      - data
                      - message
                      - status
                    properties:
                      data:
                        title: data
                      message:
                        title: message
                        type: string
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                      meta:
                        title: meta
                        type:
                          - object
                          - 'null'
                    type: object
                  - properties:
                      data:
                        type: array
                        items:
                          title: Outgoing webhook resource
                          properties:
                            uuid:
                              type: string
                              format: uuid
                            targetUrl:
                              type: string
                              format: uri
                            eventTypes:
                              type: array
                              items:
                                type: string
                                enum:
                                  - payment-received
                                  - product-updated
                              uniqueItems: true
                            signatureKey:
                              type: string
                            latestEvent:
                              oneOf:
                                - title: Latest outgoing webhook event resource
                                  properties:
                                    dateTime:
                                      type:
                                        - string
                                        - 'null'
                                      format: date-time
                                    status:
                                      type: string
                                      enum:
                                        - CREATED
                                        - PENDING
                                        - ERROR
                                        - DELIVERED
                                  type: object
                                - type: 'null'
                          type: object
                      status:
                        example: 200
                    type: object
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/settings
      x-legacy-operation-id: 58545efdebe3d93ccec3197c7262ff62
      x-required-scopes:
        - settings
    post:
      tags:
        - outgoing-webhooks
      summary: Create outgoing webhooks
      description: Register a new outgoing webhook
      operationId: webhooks_create_outgoing_webhooks
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: showSignatureKey
          in: query
          required: false
          schema:
            description: return the signatureKey unmasked if true
            type: boolean
            default: false
      requestBody:
        required: true
        content:
          application/json:
            schema:
              title: Create outgoing webhook request
              required:
                - targetUrl
                - eventTypes
              properties:
                targetUrl:
                  type: string
                  format: uri
                  maxLength: 500
                eventTypes:
                  type: array
                  items:
                    type: string
                    enum:
                      - payment-received
                      - product-updated
                  minItems: 1
                  uniqueItems: true
              type: object
      responses:
        '201':
          description: Successful response
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for successful requests
                    required:
                      - data
                      - message
                      - status
                    properties:
                      data:
                        title: data
                      message:
                        title: message
                        type: string
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                      meta:
                        title: meta
                        type:
                          - object
                          - 'null'
                    type: object
                  - properties:
                      data:
                        title: Outgoing webhook resource
                        properties:
                          uuid:
                            type: string
                            format: uuid
                          targetUrl:
                            type: string
                            format: uri
                          eventTypes:
                            type: array
                            items:
                              type: string
                              enum:
                                - payment-received
                                - product-updated
                            uniqueItems: true
                          signatureKey:
                            type: string
                          latestEvent:
                            oneOf:
                              - title: Latest outgoing webhook event resource
                                properties:
                                  dateTime:
                                    type:
                                      - string
                                      - 'null'
                                    format: date-time
                                  status:
                                    type: string
                                    enum:
                                      - CREATED
                                      - PENDING
                                      - ERROR
                                      - DELIVERED
                                type: object
                              - type: 'null'
                        type: object
                      status:
                        example: 201
                    type: object
        '400':
          description: Bad request or validation error
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for erronous requests
                    required:
                      - detail
                      - type
                      - message
                      - status
                    properties:
                      detail:
                        title: details
                      type:
                        title: type
                        type: string
                      requestUuid:
                        title: requestUuid
                        type: string
                        format: uuid
                      path:
                        title: path
                        type: string
                      message:
                        title: message
                        type:
                          - string
                          - 'null'
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                    type: object
                  - properties: {}
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/settings
      x-legacy-operation-id: 481e6ec2275ea6e8d9c99fc2486ecd4f
      x-required-scopes:
        - settings
  /accounts/{accountUuid}/webhooks/v2/outgoing-webhook-events/{webhookEventUuid}:
    get:
      tags:
        - outgoing-webhooks
      summary: Get webhook event
      description: Get single event of the outgoing webhook
      operationId: webhooks_get_outgoing_webhook_events
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: webhookEventUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for successful requests
                    required:
                      - data
                      - message
                      - status
                    properties:
                      data:
                        title: data
                      message:
                        title: message
                        type: string
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                      meta:
                        title: meta
                        type:
                          - object
                          - 'null'
                    type: object
                  - properties:
                      data:
                        title: Outgoing webhook event resource
                        properties:
                          uuid:
                            type: string
                            format: uuid
                          targetUrl:
                            type: string
                            format: uri
                          dateTime:
                            type: string
                            format: date-time
                          eventType:
                            type: string
                            enum:
                              - payment-received
                              - product-updated
                          status:
                            type: string
                            enum:
                              - CREATED
                              - PENDING
                              - ERROR
                              - DELIVERED
                          deliveryAttempts:
                            type: array
                            items:
                              title: Outgoing webhook delivery attempt resource
                              properties:
                                uuid:
                                  type: string
                                  format: uuid
                                dateTime:
                                  type: string
                                  format: date-time
                                successful:
                                  type: boolean
                                responseCode:
                                  type:
                                    - number
                                    - 'null'
                                  format: int64
                                responseBody:
                                  type:
                                    - string
                                    - 'null'
                                errorMessage:
                                  type:
                                    - string
                                    - 'null'
                              type: object
                        type: object
                      status:
                        example: 200
                    type: object
        '400':
          description: Bad request or validation error
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for erronous requests
                    required:
                      - detail
                      - type
                      - message
                      - status
                    properties:
                      detail:
                        title: details
                      type:
                        title: type
                        type: string
                      requestUuid:
                        title: requestUuid
                        type: string
                        format: uuid
                      path:
                        title: path
                        type: string
                      message:
                        title: message
                        type:
                          - string
                          - 'null'
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                    type: object
                  - properties: {}
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for erronous requests
                    required:
                      - detail
                      - type
                      - message
                      - status
                    properties:
                      detail:
                        title: details
                      type:
                        title: type
                        type: string
                      requestUuid:
                        title: requestUuid
                        type: string
                        format: uuid
                      path:
                        title: path
                        type: string
                      message:
                        title: message
                        type:
                          - string
                          - 'null'
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                    type: object
                  - properties: {}
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/settings
      x-legacy-operation-id: abee57bb5c2383ff08ee358f8eec3789
      x-required-scopes:
        - settings
  /accounts/{accountUuid}/webhooks/v2/outgoing-webhooks/{webhookUuid}:
    get:
      tags:
        - outgoing-webhooks
      summary: Show outgoing webhook
      description: Show single outgoing webhook
      operationId: webhooks_get_outgoing_webhooks
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: webhookUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: showSignatureKey
          in: query
          required: false
          schema:
            description: return the signatureKey unmasked if true
            type: boolean
            default: false
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for successful requests
                    required:
                      - data
                      - message
                      - status
                    properties:
                      data:
                        title: data
                      message:
                        title: message
                        type: string
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                      meta:
                        title: meta
                        type:
                          - object
                          - 'null'
                    type: object
                  - properties:
                      data:
                        title: Outgoing webhook resource
                        properties:
                          uuid:
                            type: string
                            format: uuid
                          targetUrl:
                            type: string
                            format: uri
                          eventTypes:
                            type: array
                            items:
                              type: string
                              enum:
                                - payment-received
                                - product-updated
                            uniqueItems: true
                          signatureKey:
                            type: string
                          latestEvent:
                            oneOf:
                              - title: Latest outgoing webhook event resource
                                properties:
                                  dateTime:
                                    type:
                                      - string
                                      - 'null'
                                    format: date-time
                                  status:
                                    type: string
                                    enum:
                                      - CREATED
                                      - PENDING
                                      - ERROR
                                      - DELIVERED
                                type: object
                              - type: 'null'
                        type: object
                      status:
                        example: 200
                    type: object
        '400':
          description: Bad request or validation error
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for erronous requests
                    required:
                      - detail
                      - type
                      - message
                      - status
                    properties:
                      detail:
                        title: details
                      type:
                        title: type
                        type: string
                      requestUuid:
                        title: requestUuid
                        type: string
                        format: uuid
                      path:
                        title: path
                        type: string
                      message:
                        title: message
                        type:
                          - string
                          - 'null'
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                    type: object
                  - properties: {}
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for erronous requests
                    required:
                      - detail
                      - type
                      - message
                      - status
                    properties:
                      detail:
                        title: details
                      type:
                        title: type
                        type: string
                      requestUuid:
                        title: requestUuid
                        type: string
                        format: uuid
                      path:
                        title: path
                        type: string
                      message:
                        title: message
                        type:
                          - string
                          - 'null'
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                    type: object
                  - properties: {}
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/settings
      x-legacy-operation-id: 39c591d731a3a002a66ef79b4b148adb
      x-required-scopes:
        - settings
    patch:
      tags:
        - outgoing-webhooks
      summary: Create outgoing webhooks
      description: Register a new outgoing webhook
      operationId: webhooks_update_outgoing_webhooks
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: webhookUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              title: Update outgoing webhook request
              required: []
              properties:
                targetUrl:
                  type: string
                  format: uri
                  maxLength: 500
                eventTypes:
                  type: array
                  items:
                    type: string
                    enum:
                      - payment-received
                      - product-updated
                  minItems: 1
                  uniqueItems: true
              type: object
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for successful requests
                    required:
                      - data
                      - message
                      - status
                    properties:
                      data:
                        title: data
                      message:
                        title: message
                        type: string
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                      meta:
                        title: meta
                        type:
                          - object
                          - 'null'
                    type: object
                  - properties:
                      data:
                        title: Outgoing webhook resource
                        properties:
                          uuid:
                            type: string
                            format: uuid
                          targetUrl:
                            type: string
                            format: uri
                          eventTypes:
                            type: array
                            items:
                              type: string
                              enum:
                                - payment-received
                                - product-updated
                            uniqueItems: true
                          signatureKey:
                            type: string
                          latestEvent:
                            oneOf:
                              - title: Latest outgoing webhook event resource
                                properties:
                                  dateTime:
                                    type:
                                      - string
                                      - 'null'
                                    format: date-time
                                  status:
                                    type: string
                                    enum:
                                      - CREATED
                                      - PENDING
                                      - ERROR
                                      - DELIVERED
                                type: object
                              - type: 'null'
                        type: object
                      status:
                        example: 200
                    type: object
        '400':
          description: Bad request or validation error
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for erronous requests
                    required:
                      - detail
                      - type
                      - message
                      - status
                    properties:
                      detail:
                        title: details
                      type:
                        title: type
                        type: string
                      requestUuid:
                        title: requestUuid
                        type: string
                        format: uuid
                      path:
                        title: path
                        type: string
                      message:
                        title: message
                        type:
                          - string
                          - 'null'
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                    type: object
                  - properties: {}
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for erronous requests
                    required:
                      - detail
                      - type
                      - message
                      - status
                    properties:
                      detail:
                        title: details
                      type:
                        title: type
                        type: string
                      requestUuid:
                        title: requestUuid
                        type: string
                        format: uuid
                      path:
                        title: path
                        type: string
                      message:
                        title: message
                        type:
                          - string
                          - 'null'
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                    type: object
                  - properties: {}
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/settings
      x-legacy-operation-id: 72ee94017e6a1b17d7d381520f25f3ae
      x-required-scopes:
        - settings
    delete:
      tags:
        - outgoing-webhooks
      summary: Delete outgoing webhook
      description: Delete single outgoing webhook
      operationId: webhooks_delete_outgoing_webhooks
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: webhookUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '204':
          description: Successful response
        '400':
          description: Bad request or validation error
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for erronous requests
                    required:
                      - detail
                      - type
                      - message
                      - status
                    properties:
                      detail:
                        title: details
                      type:
                        title: type
                        type: string
                      requestUuid:
                        title: requestUuid
                        type: string
                        format: uuid
                      path:
                        title: path
                        type: string
                      message:
                        title: message
                        type:
                          - string
                          - 'null'
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                    type: object
                  - properties: {}
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for erronous requests
                    required:
                      - detail
                      - type
                      - message
                      - status
                    properties:
                      detail:
                        title: details
                      type:
                        title: type
                        type: string
                      requestUuid:
                        title: requestUuid
                        type: string
                        format: uuid
                      path:
                        title: path
                        type: string
                      message:
                        title: message
                        type:
                          - string
                          - 'null'
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                    type: object
                  - properties: {}
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/settings
      x-legacy-operation-id: 78866a685b3aad4cc68211e87d92561f
      x-required-scopes:
        - settings
  /accounts/{accountUuid}/webhooks/v2/outgoing-webhooks/{webhookUuid}/events:
    get:
      tags:
        - outgoing-webhooks
      summary: Get webhook events
      description: Get events of the outgoing webhook
      operationId: webhooks_list_events
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: webhookUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for successful requests
                    required:
                      - data
                      - message
                      - status
                    properties:
                      data:
                        title: data
                      message:
                        title: message
                        type: string
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                      meta:
                        title: meta
                        type:
                          - object
                          - 'null'
                    type: object
                  - properties:
                      data:
                        type: array
                        items:
                          title: Minimal outgoing webhook event resource
                          properties:
                            uuid:
                              type: string
                              format: uuid
                            targetUrl:
                              type: string
                              format: uri
                            dateTime:
                              type: string
                              format: date-time
                            eventType:
                              type: string
                              enum:
                                - payment-received
                                - product-updated
                            status:
                              type: string
                              enum:
                                - CREATED
                                - PENDING
                                - ERROR
                                - DELIVERED
                          type: object
                      status:
                        example: 200
                    type: object
        '400':
          description: Bad request or validation error
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for erronous requests
                    required:
                      - detail
                      - type
                      - message
                      - status
                    properties:
                      detail:
                        title: details
                      type:
                        title: type
                        type: string
                      requestUuid:
                        title: requestUuid
                        type: string
                        format: uuid
                      path:
                        title: path
                        type: string
                      message:
                        title: message
                        type:
                          - string
                          - 'null'
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                    type: object
                  - properties: {}
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for erronous requests
                    required:
                      - detail
                      - type
                      - message
                      - status
                    properties:
                      detail:
                        title: details
                      type:
                        title: type
                        type: string
                      requestUuid:
                        title: requestUuid
                        type: string
                        format: uuid
                      path:
                        title: path
                        type: string
                      message:
                        title: message
                        type:
                          - string
                          - 'null'
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                    type: object
                  - properties: {}
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/settings
      x-legacy-operation-id: 094667c61bf37d3591a564eeebaebe0c
      x-required-scopes:
        - settings
  /accounts/{accountUuid}/webhooks/v2/outgoing-webhooks/{webhookUuid}/send-test:
    post:
      tags:
        - outgoing-webhooks
      summary: Send test outgoing webhook
      description: Trigger an outgoing webhook with test data
      operationId: webhooks_create_send_test
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: webhookUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              title: Send outgoing test webhook request
              required:
                - eventType
              properties:
                eventType:
                  description: Event to send a webhook for
                  type: string
                  enum:
                    - payment-received
                    - product-updated
              type: object
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for successful requests
                    required:
                      - data
                      - message
                      - status
                    properties:
                      data:
                        title: data
                      message:
                        title: message
                        type: string
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                      meta:
                        title: meta
                        type:
                          - object
                          - 'null'
                    type: object
                  - properties:
                      data:
                        title: Outgoing webhook test event resource
                        properties:
                          successful:
                            type: boolean
                          responseCode:
                            type:
                              - number
                              - 'null'
                            format: int64
                          responseBody:
                            type:
                              - string
                              - 'null'
                          errorMessage:
                            type:
                              - string
                              - 'null'
                        type: object
                      status:
                        example: 200
                    type: object
        '400':
          description: Bad request or validation error
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for erronous requests
                    required:
                      - detail
                      - type
                      - message
                      - status
                    properties:
                      detail:
                        title: details
                      type:
                        title: type
                        type: string
                      requestUuid:
                        title: requestUuid
                        type: string
                        format: uuid
                      path:
                        title: path
                        type: string
                      message:
                        title: message
                        type:
                          - string
                          - 'null'
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                    type: object
                  - properties: {}
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                allOf:
                  - description: The response format of most endpoints for erronous requests
                    required:
                      - detail
                      - type
                      - message
                      - status
                    properties:
                      detail:
                        title: details
                      type:
                        title: type
                        type: string
                      requestUuid:
                        title: requestUuid
                        type: string
                        format: uuid
                      path:
                        title: path
                        type: string
                      message:
                        title: message
                        type:
                          - string
                          - 'null'
                      status:
                        title: status
                        description: HTTP status code
                        type: integer
                    type: object
                  - properties: {}
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/settings
      x-legacy-operation-id: 4818ae195fd30b4c659aefdf91a1e914
      x-required-scopes:
        - settings
components:
  securitySchemes:
    ApiToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Bearer token authentication. Create tokens in Settings > API Token.
