> ## Documentation Index
> Fetch the complete documentation index at: https://docs.masivo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrate transactions

> Migrate transactions from an old system to Masivo



## OpenAPI

````yaml POST /customers/migrate/transactions
openapi: 3.0.1
info:
  title: Masivo's REST API
  description: Learn how to use Masivo's REST API
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://app.masivo.ai/api/storefront/v1
security:
  - bearerAuth: []
paths:
  /customers/migrate/transactions:
    post:
      description: Migrate transactions from an old system to Masivo
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - customers
              properties:
                customers:
                  type: array
                  minimum: 1
                  maximum: 1000
                  items:
                    $ref: '#/components/schemas/CustomerWithTransactions'
            example: {}
        required: true
      responses:
        '201':
          description: Customer transactions enqueued successfully
        '422':
          description: Invalid transaction entry
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    CustomerWithTransactions:
      type: object
      required:
        - id
        - transactions
      properties:
        id:
          type: string
          description: Your customer unique identifier
        transactions:
          type: array
          items:
            $ref: '#/components/schemas/MigrationTransaction'
    Error:
      required:
        - error
        - details
      type: object
      properties:
        error:
          type: string
        details:
          type: string
    MigrationTransaction:
      type: object
      required:
        - brand_id
        - reward_id
        - details
        - type
        - issued_at
        - resolved_at
        - amount
        - cost
        - event
        - channel_id
        - store_id
      properties:
        brand_id:
          type: string
          description: What brand triggered this transaction
          nullable: true
        reward_id:
          type: string
          description: What reward was earned or spent
          format: uuid
        details:
          type: string
          description: Why was this transaction created
        type:
          type: string
          description: What kind of transaction is it
          enum:
            - ACCUMULATION
            - REDEMPTION
            - EXPIRATION
            - MIGRATION
            - TRANSFER
            - REVERSAL
        issued_at:
          type: string
          description: When was the transaction requested to be created
          format: date-time
        resolved_at:
          type: string
          description: When did the transaction took effect
          format: date-time
        amount:
          type: number
          description: Negative if customer spent, positive if earned
        cost:
          type: number
          description: Total cost of the given rewards
          nullable: true
        store_id:
          type: string
          description: What store triggered this transaction
          nullable: true
        channel_id:
          type: string
          description: What channel triggered this transaction
          nullable: true
        event:
          $ref: '#/components/schemas/MigrationTransactionEvent'
          description: Data of the event that triggered this transaction
          nullable: true
        funded_by:
          type: string
          description: Who funded the rewards used in this transaction
    MigrationTransactionEvent:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          description: The type of the event
          example: PURCHASE
        order:
          $ref: '#/components/schemas/Order'
          description: The order in case of a PURCHASE event
    Order:
      type: object
      required:
        - purchase_id
        - value
        - products
        - payment_method
      properties:
        purchase_id:
          type: string
          description: The id of a placed order in your system
        channel_id:
          type: string
          description: >-
            The channel unique identifier in your system. Used to match campaign
            and reward e-commerce channel restrictions.
        store_id:
          type: string
          description: >-
            The store unique identifier in your system. Used to match campaign
            and reward e-commerce store restrictions.
        value:
          type: number
          description: The order total or subtotal
          example: 20.95
        discounted_value:
          type: number
          description: The order total or subtotal after discounts
          example: 10.95
        products:
          type: array
          description: >-
            Products in the order. Product sku values are used to match campaign
            and reward e-commerce product restrictions.
          minimum: 1
          items:
            $ref: '#/components/schemas/OrderProduct'
        shipping:
          $ref: '#/components/schemas/Shipping'
          description: The shipping information of the order
        payment_method:
          type: string
          description: The payment method used in the order
          enum:
            - CREDIT
            - DEBIT
            - CASH
            - BANK_TRANSFER
            - OTHER
        redeem:
          type: array
          description: The rewards to redeem in the order
          items:
            $ref: '#/components/schemas/RedemptionReward'
        metadata:
          type: object
          description: The metadata of the order
    OrderProduct:
      type: object
      required:
        - sku
        - amount
        - value
      properties:
        sku:
          type: string
          description: >-
            The product sku. Used to match campaign and reward e-commerce
            product restrictions.
        amount:
          type: number
          description: The quantity of the product
        value:
          type: number
          description: The total or subtotal of the product
        discounted_value:
          type: number
          description: The total or subtotal of the product after discounts
        redeem:
          type: array
          description: The rewards to redeem in the product
          items:
            $ref: '#/components/schemas/RedemptionReward'
        tags:
          type: object
          description: Include your conditions event tags here
        metadata:
          type: object
          description: Include any additional info here
    Shipping:
      type: object
      properties:
        value:
          type: number
          description: The shipping cost
          example: 3.25
        discounted_value:
          type: number
          description: The shipping cost after discounts
          example: 2.25
        redeem:
          type: array
          description: The rewards to redeem in the shipping
          items:
            $ref: '#/components/schemas/RedemptionReward'
        tags:
          type: object
          description: Include your conditions event tags here
        metadata:
          type: object
          description: Include any additional info here
    RedemptionReward:
      type: object
      properties:
        id:
          type: string
          description: The reward id to redeem
          format: uuid
        amount:
          type: number
          description: The amount of the reward to redeem. (Per product if applicable)
          example: 1
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````