openapi: 3.0.1
info:
  title: Savings Plans
  version: 2.10.0
  description: Endpoints for managing savings plans.
  contact:
    name: Tradevest GmbH
    url: https://tradevest.ai
    email: hello@tradevest.ai
servers:
  - url: https://tvda-api.platform-test.tradevest.ai
    description: Test
security:
  - Bearer: []
tags:
  - name: Savings Plans
    description: Savings Plans
paths:
  /savings-plans:
    post:
      summary: Create Savings Plan
      operationId: create-savings-plan
      tags:
        - Savings Plans
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SavingsPlanResult'
              examples:
                Example 1:
                  value:
                    savingsPlanId: a1b2c3d4-e5f6-7890-abcd-ef1234567890
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      description: Create a savings plan for a customer.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SavingsPlanData'
            examples:
              Example 1:
                value:
                  instrumentType: DIGITAL_ASSET
                  instrumentIdentifier: BTC
                  savingsAmount: 50
                  currency: EUR
                  intervalPeriod: MONTH
                  intervalDay: 1
                  liquidityCustomerProductId: 3d07c219-0a88-45be-9cfc-91e9d095a1e9
                  savingsCustomerProductId: d6e71eff-fbf0-456c-8d31-392631a6b046
      parameters:
        - schema:
            type: string
            format: uuid
          name: Requestor-ID
          in: header
          required: true
          description: Unique requestor identification in UUID format
          x-requestor-id: true
      x-operation-group: savings-plans-command
      x-required-permissions: rs/savings-plans/write
    parameters: []
  /savings-plans/{savingsPlanId}:
    parameters:
      - schema:
          type: string
          format: uuid
        name: savingsPlanId
        in: path
        required: true
        description: Unique savings plan identification number in UUID format
    get:
      summary: Get Savings Plan
      operationId: get-savings-plan
      tags:
        - Savings Plans
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SavingsPlan'
              examples:
                Example 1:
                  value:
                    savingsPlanId: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                    customerId: 87d8e330-2878-4742-a86f-dbbb3bf522ac
                    instrumentType: DIGITAL_ASSET
                    instrumentIdentifier: BTC
                    savingsAmount: 50
                    currency: EUR
                    intervalPeriod: MONTH
                    intervalDay: 1
                    liquidityCustomerProductId: 3d07c219-0a88-45be-9cfc-91e9d095a1e9
                    savingsCustomerProductId: d6e71eff-fbf0-456c-8d31-392631a6b046
                    status: ACTIVE
                    createdOn: '2024-01-15T10:30:00Z'
                    modifiedOn: '2024-01-15T10:30:00Z'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      description: Get a savings plan by its ID. Returns 404 if the plan has been deleted or does not exist within the calling partner's scope.
      x-operation-group: savings-plans-query
      x-required-permissions: rs/savings-plans/read
    patch:
      summary: Update Savings Plan
      operationId: patch-savings-plan
      tags:
        - Savings Plans
      responses:
        '202':
          description: Accepted
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      description: Update a savings plan by its ID. Cannot update a deleted savings plan.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SavingsPlanUpdate'
            examples:
              Example 1:
                value:
                  status: INACTIVE
      parameters:
        - schema:
            type: string
            format: uuid
          name: Requestor-ID
          in: header
          required: true
          description: Unique requestor identification in UUID format
          x-requestor-id: true
      x-operation-group: savings-plans-command
      x-required-permissions: rs/savings-plans/write
    delete:
      summary: Delete Savings Plan
      operationId: delete-savings-plan
      tags:
        - Savings Plans
      responses:
        '202':
          description: Accepted
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      description: |-
        Soft delete a savings plan by its ID. Sets deletedAt timestamp. Deleted plans are excluded from GET responses.

        Deleting a plan stops future purchases; it does not liquidate the accumulated position. To
        dispose of the position use `POST /traditional/orders/sell-all` (whole shares plus the
        fractional remainder) or `POST /traditional/orders/fractional-sell` (the remainder only).
      parameters:
        - schema:
            type: string
            format: uuid
          name: Requestor-ID
          in: header
          required: true
          description: Unique requestor identification in UUID format
          x-requestor-id: true
      x-operation-group: savings-plans-command
      x-required-permissions: rs/savings-plans/write
  /test/savings-plans/run-now:
    post:
      summary: Run Savings Plans Now (test only)
      operationId: run-savings-plans-now
      tags:
        - Savings Plans
      responses:
        '202':
          description: Accepted
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      description: |-
        Test-only. Seeds a due execution for each supplied savings plan (bypassing the
        intervalDay schedule) and fires the real EXECUTE command, so the normal async
        pipeline (block cash -> READY -> AGGREGATE_BATCH -> broker fill -> SETTLE_BATCH)
        runs immediately without waiting for the 19:30 cron. Every supplied plan must be
        owned by the calling partner. Disabled in production (returns 400).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SavingsPlansRunNowData'
            examples:
              Example 1:
                value:
                  savingsPlanIds:
                    - a1b2c3d4-e5f6-7890-abcd-ef1234567890
      parameters:
        - schema:
            type: string
            format: uuid
          name: Requestor-ID
          in: header
          required: true
          description: Unique requestor identification in UUID format
          x-requestor-id: true
      x-operation-group: savings-plans-command
      x-required-permissions: rs/savings-plans/write
  /savings-plans/{savingsPlanId}/executions:
    parameters:
      - schema:
          type: string
          format: uuid
        name: savingsPlanId
        in: path
        required: true
        description: Unique savings plan identification number in UUID format
    get:
      summary: Get Savings Plan Executions
      operationId: get-savings-plan-executions
      tags:
        - Savings Plans
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SavingsPlansExecutions'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      description: |-
        List the periodic BUY executions of a savings plan in an order-like shape. Returns a
        paginated list.

        Sells are not savings-plan executions: dispose of a position through
        `POST /traditional/orders/sell-all` or `POST /traditional/orders/fractional-sell` and read
        them through `GET /v2/products/{customerProductId}/traditional/orders`.
      parameters:
        - schema:
            $ref: '#/components/schemas/SavingsPlansOrderStatusEnum'
          in: query
          name: status
          description: Filter by order status
        - schema:
            type: string
            format: date
          in: query
          name: executionDateFrom
          description: Return orders with a planned execution date on or after this date (inclusive)
        - schema:
            type: string
            format: date
          in: query
          name: executionDateTo
          description: Return orders with a planned execution date on or before this date (inclusive)
        - schema:
            type: integer
            default: 20
            minimum: 1
          in: query
          name: limit
          description: Maximum number of results to return per page
        - schema:
            type: string
          in: query
          name: cursor
          description: Pagination cursor returned from a previous response
      x-operation-group: savings-plans-query
      x-required-permissions: rs/savings-plans/read
  /savings-plans/{savingsPlanId}/executions/{executionId}:
    parameters:
      - schema:
          type: string
          format: uuid
        name: savingsPlanId
        in: path
        required: true
        description: Unique savings plan identification number in UUID format
      - schema:
          type: string
          format: uuid
        name: executionId
        in: path
        required: true
        description: Unique savings plan order (execution or exit) identification number in UUID format
    get:
      summary: Get Savings Plan Execution
      operationId: get-savings-plan-execution
      tags:
        - Savings Plans
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SavingsPlansExecution'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      description: |-
        Get a single savings plan order (execution or exit) by its ID, within the calling
        partner's scope.
      x-operation-group: savings-plans-query
      x-required-permissions: rs/savings-plans/read
  /customers/{customerId}/savings-plans:
    parameters:
      - schema:
          type: string
          format: uuid
        name: customerId
        in: path
        required: true
        description: Unique customer identification number in UUID format
    get:
      summary: Get Customer Savings Plans
      operationId: get-customer-savings-plans
      tags:
        - Savings Plans
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SavingsPlans'
              examples:
                Example 1:
                  value:
                    data:
                      - savingsPlanId: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                        customerId: 87d8e330-2878-4742-a86f-dbbb3bf522ac
                        instrumentType: DIGITAL_ASSET
                        instrumentIdentifier: BTC
                        savingsAmount: 50
                        currency: EUR
                        intervalPeriod: MONTH
                        intervalDay: 1
                        liquidityCustomerProductId: 3d07c219-0a88-45be-9cfc-91e9d095a1e9
                        savingsCustomerProductId: d6e71eff-fbf0-456c-8d31-392631a6b046
                        status: ACTIVE
                        createdOn: '2024-01-15T10:30:00Z'
                        modifiedOn: '2024-01-15T10:30:00Z'
                    pagination:
                      cursor: string
                      limit: 20
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      description: Get all savings plans for a customer. Deleted plans are excluded.
      parameters:
        - schema:
            $ref: '#/components/schemas/SavingsPlanStatusEnum'
          in: query
          name: status
          description: Filter by savings plan status
        - schema:
            $ref: '#/components/schemas/InstrumentTypeEnum'
          in: query
          name: instrumentType
          description: Filter by instrument type
        - schema:
            type: string
          in: query
          name: instrumentIdentifier
          description: Filter by instrument identifier (ISIN or crypto symbol)
        - schema:
            type: string
            format: uuid
          in: query
          name: liquidityCustomerProductId
          description: Filter by liquidity customer product ID
        - schema:
            type: string
            format: uuid
          in: query
          name: savingsCustomerProductId
          description: Filter by savings customer product ID
        - schema:
            type: string
          in: query
          name: externalId
          description: Filter by external identifier set by the partner
        - schema:
            type: integer
            default: 20
            minimum: 1
          in: query
          name: limit
          description: Maximum number of results to return per page
        - schema:
            type: string
          in: query
          name: cursor
          description: Pagination cursor returned from a previous response
      x-operation-group: savings-plans-query
      x-required-permissions: rs/savings-plans/read
components:
  schemas:
    SavingsPlan:
      type: object
      properties:
        savingsPlanId:
          type: string
          format: uuid
          description: Unique identifier of the savings plan.
        customerId:
          type: string
          format: uuid
          description: Unique identifier of the customer who owns this savings plan.
        status:
          $ref: '#/components/schemas/SavingsPlanStatusEnum'
        createdOn:
          type: string
          format: date-time
          description: When this savings plan was created.
        modifiedOn:
          type: string
          format: date-time
          description: When this savings plan was last updated.
        externalId:
          type: string
          description: Optional external identifier set by the partner for their own reference.
          maxLength: 100
        message:
          type: string
          description: Reason why the savings plan is invalid. Only present when status=INVALID. Matches the validationError.description delivered in the VALIDATION_ERROR webhook.
        startDate:
          type: string
          format: date
          description: The date from which the savings plan should start executing. Must be today or a future date.
        endDate:
          type: string
          format: date
          description: Optional date after which the savings plan should stop executing. Must be strictly after startDate. Once this date passes the plan is transitioned to DELETED by the nightly expiry job.
        instrumentType:
          $ref: '#/components/schemas/InstrumentTypeEnum'
        instrumentIdentifier:
          type: string
          description: Instrument identifier. For DIGITAL_ASSET this is the crypto symbol (e.g. BTC). For TRADITIONAL_ASSET this is the ISIN (e.g. US38259P5089).
        savingsAmount:
          type: number
          multipleOf: 0.01
          description: The amount to invest on each savings plan execution. Must be a multiple of 0.01 (2 decimal places).
        currency:
          $ref: '#/components/schemas/CurrencyEnum'
        intervalPeriod:
          $ref: '#/components/schemas/SavingsPlanIntervalPeriodEnum'
        intervalDay:
          $ref: '#/components/schemas/SavingsPlanIntervalDayEnum'
        liquidityCustomerProductId:
          type: string
          format: uuid
          description: The customer product ID of the liquidity account (product_id = 8) used to fund the savings plan.
        savingsCustomerProductId:
          type: string
          format: uuid
          description: The customer product ID of the savings account. Must be product_id = 2 for DIGITAL_ASSET or product_id = 15 for TRADITIONAL_ASSET.
      required:
        - createdOn
        - currency
        - customerId
        - instrumentIdentifier
        - instrumentType
        - intervalDay
        - intervalPeriod
        - liquidityCustomerProductId
        - modifiedOn
        - savingsAmount
        - savingsCustomerProductId
        - savingsPlanId
        - startDate
        - status
      title: SavingsPlan
      description: Single savings plan model.
      x-examples:
        Example 1:
          savingsPlanId: a1b2c3d4-e5f6-7890-abcd-ef1234567890
          customerId: 87d8e330-2878-4742-a86f-dbbb3bf522ac
          instrumentType: DIGITAL_ASSET
          instrumentIdentifier: BTC
          savingsAmount: 50
          currency: EUR
          intervalPeriod: MONTH
          intervalDay: 1
          liquidityCustomerProductId: 3d07c219-0a88-45be-9cfc-91e9d095a1e9
          savingsCustomerProductId: d6e71eff-fbf0-456c-8d31-392631a6b046
          status: ACTIVE
          createdOn: '2024-01-15T10:30:00Z'
          modifiedOn: '2024-01-15T10:30:00Z'
    SavingsPlanData:
      title: SavingsPlanData
      type: object
      description: Savings plan creation model.
      required:
        - instrumentType
        - instrumentIdentifier
        - savingsAmount
        - currency
        - intervalPeriod
        - intervalDay
        - liquidityCustomerProductId
        - savingsCustomerProductId
        - startDate
      properties:
        startDate:
          type: string
          format: date
          description: The date from which the savings plan should start executing. Must be today or a future date.
        endDate:
          type: string
          format: date
          description: Optional date after which the savings plan should stop executing. Must be strictly after startDate. Once this date passes the plan is transitioned to DELETED by the nightly expiry job.
        instrumentType:
          $ref: '#/components/schemas/InstrumentTypeEnum'
        instrumentIdentifier:
          type: string
          description: Instrument identifier. For DIGITAL_ASSET this is the crypto symbol (e.g. BTC). For TRADITIONAL_ASSET this is the ISIN (e.g. US38259P5089).
        savingsAmount:
          type: number
          multipleOf: 0.01
          description: The amount to invest on each savings plan execution. Must be a multiple of 0.01 (2 decimal places).
        currency:
          $ref: '#/components/schemas/CurrencyEnum'
        intervalPeriod:
          $ref: '#/components/schemas/SavingsPlanIntervalPeriodEnum'
        intervalDay:
          $ref: '#/components/schemas/SavingsPlanIntervalDayEnum'
        liquidityCustomerProductId:
          type: string
          format: uuid
          description: The customer product ID of the liquidity account (product_id = 8) used to fund the savings plan.
        savingsCustomerProductId:
          type: string
          format: uuid
          description: The customer product ID of the savings account. Must be product_id = 2 for DIGITAL_ASSET or product_id = 15 for TRADITIONAL_ASSET.
        externalId:
          type: string
          maxLength: 100
          description: Optional external identifier set by the partner for their own reference.
      x-examples:
        Example 1:
          instrumentType: DIGITAL_ASSET
          instrumentIdentifier: BTC
          savingsAmount: 50
          currency: EUR
          intervalPeriod: MONTH
          intervalDay: 1
          liquidityCustomerProductId: 3d07c219-0a88-45be-9cfc-91e9d095a1e9
          savingsCustomerProductId: d6e71eff-fbf0-456c-8d31-392631a6b046
    SavingsPlanUpdate:
      title: SavingsPlanUpdate
      type: object
      description: Savings plan update model. Used to toggle between ACTIVE and INACTIVE status.
      properties:
        status:
          $ref: '#/components/schemas/SavingsPlanToggleStatusEnum'
      x-examples:
        Example 1:
          status: INACTIVE
    SavingsPlanResult:
      title: SavingsPlanResult
      type: object
      description: The result of creating a savings plan.
      required:
        - savingsPlanId
      properties:
        savingsPlanId:
          type: string
          format: uuid
          description: The UUID of the newly created savings plan.
      x-examples:
        Example 1:
          savingsPlanId: a1b2c3d4-e5f6-7890-abcd-ef1234567890
    SavingsPlans:
      title: SavingsPlans
      type: object
      description: List of savings plans returned.
      required:
        - data
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/SavingsPlan'
        pagination:
          $ref: '#/components/schemas/Pagination'
      x-examples:
        Example 1:
          data:
            - savingsPlanId: a1b2c3d4-e5f6-7890-abcd-ef1234567890
              customerId: 87d8e330-2878-4742-a86f-dbbb3bf522ac
              instrumentType: DIGITAL_ASSET
              instrumentIdentifier: BTC
              savingsAmount: 50
              currency: EUR
              intervalPeriod: MONTH
              intervalDay: 1
              liquidityCustomerProductId: 3d07c219-0a88-45be-9cfc-91e9d095a1e9
              savingsCustomerProductId: d6e71eff-fbf0-456c-8d31-392631a6b046
              status: ACTIVE
              createdOn: '2024-01-15T10:30:00Z'
              modifiedOn: '2024-01-15T10:30:00Z'
          pagination:
            cursor: string
            limit: 20
    InstrumentTypeEnum:
      title: InstrumentTypeEnum
      type: string
      enum:
        - DIGITAL_ASSET
        - TRADITIONAL_ASSET
      description: The type of instrument for the savings plan.
    SavingsPlanStatusEnum:
      title: SavingsPlanStatusEnum
      enum:
        - ACTIVE
        - INACTIVE
        - RECEIVED
        - INVALID
      description: The current status of the savings plan.
    SavingsPlanToggleStatusEnum:
      title: SavingsPlanToggleStatusEnum
      enum:
        - ACTIVE
        - INACTIVE
      description: The target status when toggling a savings plan.
    SavingsPlanIntervalPeriodEnum:
      title: SavingsPlanIntervalPeriodEnum
      type: string
      enum:
        - MONTH
      description: The interval period for savings plan execution.
    SavingsPlanIntervalDayEnum:
      title: SavingsPlanIntervalDayEnum
      type: integer
      enum:
        - 1
        - 16
      description: The day of the interval period on which the savings plan executes.
    SavingsPlansRunNowData:
      title: SavingsPlansRunNowData
      type: object
      description: Test-only request body listing the savings plans to run immediately.
      required:
        - savingsPlanIds
      properties:
        savingsPlanIds:
          type: array
          minItems: 1
          items:
            type: string
            format: uuid
          description: UUIDs of the savings plans to seed and execute now. All must belong to the calling partner.
    SavingsPlansExecution:
      title: SavingsPlansExecution
      type: object
      description: A single savings plan BUY execution in an order-like shape.
      properties:
        executionId:
          type: string
          format: uuid
          description: Unique identifier of the order (execution or exit).
        savingsPlanId:
          type: string
          format: uuid
        exAnteId:
          type: string
          format: uuid
          nullable: true
          description: Reserved for ex-ante cost disclosure. Always null for savings plan orders.
        createdOn:
          type: string
          format: date-time
        modifiedOn:
          type: string
          format: date-time
        status:
          $ref: '#/components/schemas/SavingsPlansOrderStatusEnum'
        failureReason:
          type: string
          nullable: true
          description: Populated for failed orders (e.g. REJECTED); null otherwise.
        executionDatePlanned:
          type: string
          format: date
          description: The date on which this order was planned to execute. Present for BUY executions.
        isin:
          type: string
        savingsAmount:
          type: number
          multipleOf: 0.01
          description: The savings amount for this BUY execution. Absent for SELL exits.
        currency:
          $ref: '#/components/schemas/CurrencyEnum'
        exchangeCode:
          $ref: '#/components/schemas/SavingsPlansExchangeCodeEnum'
        tradeSide:
          $ref: '#/components/schemas/TradeSideEnum'
        execution:
          $ref: '#/components/schemas/SavingsPlansExecutionData'
      required:
        - executionId
        - savingsPlanId
        - createdOn
        - modifiedOn
        - status
        - isin
        - tradeSide
    SavingsPlansExecutionData:
      title: SavingsPlansExecutionData
      type: object
      description: Execution detail of a filled savings plan order. Present once status is FILLED.
      properties:
        executionPrice:
          type: number
          description: The unified fill price used for the allocation.
        executionQuantity:
          type: number
          description: The fractional quantity allocated (BUY) or sold (SELL).
        transactionTime:
          type: string
          format: date-time
          description: The fill time (value date) of the underlying order.
        amount:
          type: number
          multipleOf: 0.01
          description: executionQuantity x executionPrice, rounded to 2 decimal places.
        amountCurrency:
          $ref: '#/components/schemas/CurrencyEnum'
        feeAmount:
          type: number
          multipleOf: 0.01
        germanCit:
          type: number
          format: decimal
          description: German capital income tax. 0 for BUY executions; populated for SELL exits.
        solidaritySurcharge:
          type: number
          format: decimal
          description: German solidarity surcharge. 0 for BUY executions; populated for SELL exits.
        churchTax:
          type: number
          format: decimal
          description: German church tax. 0 for BUY executions; populated for SELL exits.
      required:
        - executionPrice
        - executionQuantity
        - transactionTime
        - amount
        - amountCurrency
        - germanCit
        - solidaritySurcharge
        - churchTax
    SavingsPlansExecutions:
      title: SavingsPlansExecutions
      type: object
      description: Paginated list of savings plan orders.
      required:
        - data
        - pagination
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/SavingsPlansExecution'
        pagination:
          $ref: '#/components/schemas/Pagination'
    CurrencyEnum:
      title: CurrencyEnum
      type: string
      description: Currency of the product's balance. Currency code in ISO 4217
      enum:
        - EUR
    ErrorDetailsExplanation:
      title: ErrorDetailsExplanation
      type: object
      properties:
        code:
          type: string
          maxLength: 255
        parameter:
          type: string
        message:
          type: string
      required:
        - code
        - message
    ErrorDetails:
      title: ErrorDetails
      type: object
      properties:
        field:
          type: string
          maxLength: 255
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ErrorDetailsExplanation'
      required:
        - field
    ErrorMessage:
      title: ErrorMessage
      type: object
      properties:
        message:
          type: string
        responseType:
          type: string
        validationString:
          minLength: 1
          type: string
        requestId:
          type: string
        errorCode:
          type: string
          maxLength: 255
        errorDetails:
          type: array
          items:
            $ref: '#/components/schemas/ErrorDetails'
      required:
        - message
        - responseType
        - requestId
    SavingsPlansOrderStatusEnum:
      title: SavingsPlansOrderStatusEnum
      type: string
      enum:
        - PENDING
        - PLACED
        - FILLED
        - REJECTED
        - EXPIRED
        - CANCELLED
      description: Status of a savings plan order (execution or exit), aligned with the traditional trading vocabulary. For BUY executions the internal lifecycle maps as PLANNED/READY -> PENDING, PLACED, FILLED, REJECTED, CANCELLED. For SELL exits the status maps directly.
    SavingsPlansExchangeCodeEnum:
      title: SavingsPlansExchangeCodeEnum
      type: string
      enum:
        - TGAT
        - XOFF
      description: Venue of a savings plan order. TGAT when the batch touched the exchange (ordered_quantity > 0 for BUY, exchange execution path for SELL); XOFF for pure FIFO / internal TVM allocation.
    TradeSideEnum:
      title: TradeSideEnum
      type: string
      enum:
        - BUY
        - SELL
    Pagination:
      title: Pagination
      type: object
      properties:
        cursor:
          type: string
          description: String value used for pagination, which should be set in next page request.
        limit:
          type: integer
          description: Maximum number of returned items
      required:
        - cursor
        - limit
  securitySchemes:
    Bearer:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: ''
          refreshUrl: ''
          scopes: {}
x-tagGroups:
  - name: Savings Plans
    tags:
      - Savings Plans
