openapi: 3.0.1
info:
  title: Schedule API
  description: API for managing schedules
  version: 1.0.21
servers:
- description: ''
  url: https://api.btx.fr.banqup.com/core/schedule
- description: ''
  url: https://api.btx.eu.banqup.com/core/schedule
paths:
  /v1/scheduledMessages/{scheduledMessageId}:
    get:
      tags:
      - Scheduled Message API
      summary: Retrieve a specific message schedule
      operationId: retrieveScheduledMessage
      parameters:
      - name: scheduledMessageId
        in: path
        description: The unique identifier of the message schedule
        required: true
        schema:
          type: string
          description: The unique identifier of the message schedule
      responses:
        '404':
          description: Schedule not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 404
                error: NOT_FOUND
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27 12:34:50
                type: about:blank
                title: Not Found
                detail: The HTTP method was not allowed on this endpoint.
        '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-27 12:34:50
                type: about:blank
                title: Forbidden
                detail: Access to the requested resource was denied.
        '200':
          description: The requested message schedule
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduledMessageResponse'
        '400':
          description: Invalid Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 400
                error: BAD_REQUEST
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27 12:34:50
                type: about:blank
                title: Bad Request
                detail: Bad Request message details.
      description: ' <br/> Scope: []'
    put:
      tags:
      - Scheduled Message API
      summary: Update a specific message schedule
      operationId: updateScheduledMessage
      parameters:
      - name: scheduledMessageId
        in: path
        description: The unique identifier of the message schedule
        required: true
        schema:
          type: string
          description: The unique identifier of the message schedule
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScheduledMessageRequest'
        required: true
      responses:
        '404':
          description: Schedule not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 404
                error: NOT_FOUND
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27 12:34:50
                type: about:blank
                title: Not Found
                detail: The HTTP method was not allowed on this endpoint.
        '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-27 12:34:50
                type: about:blank
                title: Forbidden
                detail: Access to the requested resource was denied.
        '400':
          description: Invalid Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 400
                error: BAD_REQUEST
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27 12:34:50
                type: about:blank
                title: Bad Request
                detail: Bad Request message details.
        '200':
          description: Schedule updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduledMessageResponse'
      description: ' <br/> Scope: []'
    delete:
      tags:
      - Scheduled Message API
      summary: Delete a specific message schedule
      operationId: deleteScheduledMessage
      parameters:
      - name: scheduledMessageId
        in: path
        description: The unique identifier of the message schedule
        required: true
        schema:
          type: string
          description: The unique identifier of the message schedule
      responses:
        '404':
          description: Schedule not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 404
                error: NOT_FOUND
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27 12:34:50
                type: about:blank
                title: Not Found
                detail: The HTTP method was not allowed on this endpoint.
        '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-27 12:34:50
                type: about:blank
                title: Forbidden
                detail: Access to the requested resource was denied.
        '400':
          description: Invalid Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 400
                error: BAD_REQUEST
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27 12:34:50
                type: about:blank
                title: Bad Request
                detail: Bad Request message details.
        '204':
          description: Schedule deleted successfully
      description: ' <br/> Scope: []'
  /v1/scheduledMessages:
    get:
      tags:
      - Scheduled Message API
      summary: Retrieves a list of all scheduled messages
      operationId: listScheduledMessages_1
      responses:
        '200':
          description: A list of scheduled messages
          content:
            application/x-ndjson:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ScheduledMessageResponse'
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduledMessageResponseList'
        '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-27 12:34:50
                type: about:blank
                title: Forbidden
                detail: Access to the requested resource was denied.
        '400':
          description: Invalid Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 400
                error: BAD_REQUEST
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27 12:34:50
                type: about:blank
                title: Bad Request
                detail: Bad Request message details.
      description: ' <br/> Scope: []'
    post:
      tags:
      - Scheduled Message API
      summary: Create a new message schedule
      operationId: createScheduledMessage
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScheduledMessageRequest'
        required: true
      responses:
        '201':
          description: Schedule created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduledMessageResponse'
        '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-27 12:34:50
                type: about:blank
                title: Forbidden
                detail: Access to the requested resource was denied.
        '400':
          description: Invalid Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 400
                error: BAD_REQUEST
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27 12:34:50
                type: about:blank
                title: Bad Request
                detail: Bad Request message details.
      description: ' <br/> Scope: []'
components:
  schemas:
    ScheduledMessageRequest:
      required:
      - crontab
      - message
      type: object
      properties:
        message:
          type: object
        crontab:
          pattern: ^([*0-9,-/]+ ){4}[*0-9,-/]+$
          type: string
          description: Schedule as a crontab expression specifying when the message
            should be sent
          example: 0 9 * * *
    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
    ScheduledMessageResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the schedule
          format: uuid
        message:
          type: object
        crontab:
          type: string
          description: Schedule as a crontab expression specifying when the message
            should be sent
          example: 0 9 * * *
    ScheduledMessageResponseList:
      type: object
      properties:
        scheduledMessages:
          type: array
          items:
            $ref: '#/components/schemas/ScheduledMessageResponse'
  securitySchemes:
    scheduled_message:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://api.btx.fr.banqup.com/v1/oauth20/authorization
          tokenUrl: https://api.btx.fr.banqup.com/v1/oauth20/token_kc
          scopes: {}
