openapi: 3.0.1
info:
  title: Notification Service API Specification
  description: The Notification REST Service provides API endpoints to send notifications
  version: 1.0.102
servers:
- description: ''
  url: https://api.btx.fr.banqup.com/core/notification
- description: ''
  url: https://api.btx.eu.banqup.com/core/notification
paths:
  /v1/notifications:
    post:
      tags:
      - Notification Acceptor
      summary: Sends notification
      description: 'Sends notification <br/> Scope: notification_send'
      operationId: sendNotification
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Notification'
        required: true
      responses:
        '202':
          description: Notification sent successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotificationResponse'
        '403':
          description: Forbidden Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 403
                error: PERMISSION_DENIED
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27T12:34:50Z
                type: about:blank
                title: Forbidden
                detail: Access to the requested resource was denied.
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 500
                error: INTERNAL
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27T12:34:50Z
                type: about:blank
                title: Internal Server Error
                detail: The server encountered an unexpected error.
        '401':
          description: Unauthorized Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 401
                error: UNAUTHENTICATED
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27T12:34:50Z
                type: about:blank
                title: Unauthorized
                detail: Access to the requested resource lacks valid authentication
                  credentials.
      security:
      - oauth2:
        - notification_send
components:
  schemas:
    Notification:
      required:
      - asset
      - channels
      type: object
      properties:
        reference:
          type: string
          description: Custom notification reference
        asset:
          type: string
          description: Asset name to be used for notification
          example: asset/iam/onboarding/welcome?type=text/plain&l=en
        locale:
          type: string
          description: Locale for notification
        data:
          type: object
          additionalProperties:
            type: object
            description: Data for notification
          description: Data for notification
        space:
          type: string
          description: The space identifier
          format: uuid
          example: 00000001-0000-0000-0000-000000000000
        subject:
          type: string
          description: Subject for notification
        recipient:
          $ref: '#/components/schemas/Recipient'
        channels:
          type: array
          description: Channels where to send notifications
          example:
          - sms
          - email
          items:
            type: string
            description: Channels where to send notifications
            example: '["sms","email"]'
            enum:
            - email
            - sms
    Recipient:
      required:
      - brand
      - firstName
      - language
      - lastName
      type: object
      properties:
        firstName:
          type: string
          description: Recipient first name
        lastName:
          type: string
          description: Recipient last name
        language:
          type: string
          description: Recipient language
        email:
          pattern: "^(.*<([a-zA-Z0-9_!#$%&’*+/=?`{|}~^.-]+@[a-zA-Z0-9.-]+)>)$|^([a-zA-Z0-9_!#$%&’*+/=?`{|}~^.-]+@[a-zA-Z0-9.-]+)$"
          type: string
          description: Recipient email
        mobile:
          pattern: \+\d{1,3}\d{4,14}
          type: string
          description: Recipient mobile
        brand:
          type: string
          description: Recipient brand
      description: Recipient details
    NotificationResponse:
      required:
      - notificationId
      type: object
      properties:
        notificationId:
          type: string
    ApiErrorProblemDetail:
      required:
      - error
      - requestId
      - timestamp
      type: object
      properties:
        status:
          type: integer
          format: int32
        error:
          type: string
        requestId:
          type: string
        timestamp:
          type: string
          format: date-time
        type:
          type: string
          format: uri
        title:
          type: string
        detail:
          type: string
        instance:
          type: string
          format: uri
        problems:
          type: array
          items:
            $ref: '#/components/schemas/NestedProblem'
        properties:
          type: object
          additionalProperties:
            type: object
    NestedProblem:
      required:
      - detail
      - error
      - title
      type: object
      properties:
        error:
          type: string
        title:
          type: string
        detail:
          type: string
        type:
          type: string
          format: uri
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://api.btx.fr.banqup.com/oauth2/client_credential/gettoken
          scopes:
            info: Scopes are endpoint-specific, see each endpoint for required scope.
        authorizationCode:
          authorizationUrl: https://api.btx.fr.banqup.com/oauth2/auth
          tokenUrl: https://api.btx.fr.banqup.com/oauth2/token
          scopes:
            info: Scopes are endpoint-specific, see each endpoint for required scope.
