---
openapi: 3.0.1
info:
  title: Trading API v4
  description: APIs related to trading operations
  version: v4
paths:
  /frontoffice/api/v4/tokens:
    get:
      tags:
        - TokenControllerV4
      description: "Required operations: trading-ui"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BBP.TradingServer.TradingApi.Models.Token.v4.ApiTokenListV4.Response'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '500':
          description: Internal Server Error
    post:
      tags:
        - TokenControllerV4
      description: "Required operations: trading-ui"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BBP.TradingServer.TradingApi.Models.Token.v4.ApiTokenCreateV4.Request'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BBP.TradingServer.TradingApi.Models.Token.v4.ApiTokenCreateV4.Response'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BBP.Platform.Http.ErrorData'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '500':
          description: Internal Server Error
  /frontoffice/api/v4/tokens/{tokenId}:
    delete:
      tags:
        - TokenControllerV4
      description: "Required operations: trading-ui"
      parameters:
        - name: tokenId
          in: path
          required: true
          description: UUID of the token to delete
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BBP.TradingServer.TradingApi.Models.Token.v4.ApiTokenDeleteV4.Response'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BBP.Platform.Http.ErrorData'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BBP.Platform.Http.ErrorData'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '500':
          description: Internal Server Error
components:
  schemas:
    BBP.Platform.Http.ErrorData:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        details:
          $ref: '#/components/schemas/BBP.Platform.Http.ErrorData.ErrorDetails'
      additionalProperties: false
    BBP.Platform.Http.ErrorData.ErrorDetails:
      type: object
      properties:
        source:
          type: string
          nullable: true
        message:
          type: string
          nullable: true
        stackTrace:
          type: string
          nullable: true
      additionalProperties: false
    BBP.TradingServer.TradingApi.Models.Enums.ApiTokenStatus:
      enum:
        - Active
        - Expired
      type: string
    BBP.TradingServer.TradingApi.Models.Token.v4.ApiTokenListV4.Response:
      required:
        - tokens
      type: object
      properties:
        tokens:
          type: array
          items:
            $ref: '#/components/schemas/BBP.TradingServer.TradingApi.Models.Token.v4.ApiTokenListV4.TokenInfo'
          nullable: true
      additionalProperties: false
    BBP.TradingServer.TradingApi.Models.Token.v4.ApiTokenListV4.TokenInfo:
      required:
        - id
        - name
        - createdAt
        - expiryDate
        - status
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        createdAt:
          type: string
          description: date and time in UTC+0
          format: date-time
        expiryDate:
          type: string
          description: date and time in UTC+0
          format: date-time
        status:
          $ref: '#/components/schemas/BBP.TradingServer.TradingApi.Models.Enums.ApiTokenStatus'
      additionalProperties: false
    BBP.TradingServer.TradingApi.Models.Token.v4.ApiTokenCreateV4.Request:
      required:
        - name
      type: object
      properties:
        name:
          type: string
      additionalProperties: false
    BBP.TradingServer.TradingApi.Models.Token.v4.ApiTokenCreateV4.Response:
      required:
        - id
        - token
        - name
        - expiryDate
      type: object
      properties:
        id:
          type: string
        token:
          type: string
        name:
          type: string
        expiryDate:
          type: string
          description: date and time in UTC+0
          format: date-time
      additionalProperties: false
    BBP.TradingServer.TradingApi.Models.Token.v4.ApiTokenDeleteV4.Response:
      type: object
      additionalProperties: false
