> ## 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 customers

> Migrate a customer from an old system to Masivo



## OpenAPI

````yaml POST /customers/migrate
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:
    post:
      description: Migrate a customer 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/CustomerWithBalance'
            example: {}
        required: true
      responses:
        '201':
          description: Customers batch enqueued successfully
        '422':
          description: Invalid customer entry
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    CustomerWithBalance:
      type: object
      required:
        - balance
        - id
        - name
        - email
        - registration_date
      properties:
        id:
          type: string
          description: Your customer unique identifier
        platforms:
          type: array
          description: Platforms associated with the customer
          items:
            type: string
          nullable: true
        name:
          description: The full name of the customer
          type: string
          example: John Smith
        email:
          description: The email of the customer
          type: string
          format: email
        gender:
          description: The gender of the customer
          type: string
          nullable: true
          enum:
            - MALE
            - FEMALE
        dob:
          description: The date of birth of the customer
          type: string
          nullable: true
          format: date-time
        document_type:
          description: >-
            The document type of the customer. If provided, document_number is
            required.
          type: string
          nullable: true
        document_number:
          description: >-
            The document number of the customer. If provided, document_type is
            required.
          type: string
          nullable: true
          maxLength: 50
        country:
          description: The country of the customer
          type: string
          nullable: true
          maxLength: 100
        registration_date:
          description: The date when the customer was registered
          type: string
          format: date-time
        metrics:
          $ref: '#/components/schemas/CustomerMetrics'
          type: object
          description: The metrics of the customer
        balance:
          type: array
          description: The starting wallet items of the new customer
          items:
            $ref: '#/components/schemas/BalanceItem'
        devices:
          type: array
          description: The devices of the customer
          items:
            $ref: '#/components/schemas/Device'
        tags:
          type: object
          description: Include your conditions customer tags here
        status:
          description: The status of the customer
          type: string
          enum:
            - ACTIVE
            - INACTIVE
        metadata:
          description: The metadata of the customer
          type: object
    Error:
      required:
        - error
        - details
      type: object
      properties:
        error:
          type: string
        details:
          type: string
    CustomerMetrics:
      type: object
      properties:
        lifetime:
          $ref: '#/components/schemas/MetricPeriod'
          description: Metrics since customer registration
        last_year:
          $ref: '#/components/schemas/MetricPeriod'
          description: Metrics for the previous year
        this_year:
          $ref: '#/components/schemas/MetricPeriod'
          description: Metrics for the current year
        last_month:
          $ref: '#/components/schemas/MetricPeriod'
          description: Metrics for the previous month
        this_month:
          $ref: '#/components/schemas/MetricPeriod'
          description: Metrics for the current month
        last_quarter:
          $ref: '#/components/schemas/MetricPeriod'
          description: Metrics for the previous quarter
        this_quarter:
          $ref: '#/components/schemas/MetricPeriod'
          description: Metrics for the current quarter
        last_semester:
          $ref: '#/components/schemas/MetricPeriod'
          description: Metrics for the previous semester
        this_semester:
          $ref: '#/components/schemas/MetricPeriod'
          description: Metrics for the current semester
        updated_at:
          type: string
          format: date-time
          description: Last time these metrics were updated
    BalanceItem:
      type: object
      required:
        - reward_id
        - amount
        - expiration_date
        - brand_id
      properties:
        reward_id:
          type: string
          description: The reward id of the balance item
          format: uuid
        amount:
          type: number
          description: The amount of the balance item
        expiration_date:
          type: string
          description: The expiration date of the balance item. Null if amount is 0.
          format: date-time
          nullable: true
        brand_id:
          type: string
          description: The id of the brand that owns the reward of this balance item.
          nullable: true
        channel_id:
          type: string
          description: The id of the channel that owns the reward of this balance item.
          nullable: true
        store_id:
          type: string
          description: The id of the store that owns the reward of this balance item.
          nullable: true
        issued_at:
          type: string
          description: >-
            The date when the balance item was originally issued. Defaults to
            right now.
          format: date-time
        funded_by:
          type: string
          description: Who funded the rewards used in this balance item
    Device:
      type: object
      properties:
        device_token:
          type: string
          description: The unique token that identifies the device
        device_info:
          type: object
          description: Optional information about the device
          properties:
            platform:
              description: The platform of the device
              type: string
              enum:
                - ios
                - android
                - web
                - windows
                - macos
            model:
              description: The model of the device
              type: string
            osVersion:
              description: The operating system version of the device
              type: string
        expires_at:
          type: string
          format: date-time
          description: The date when the device token expires
        created_at:
          type: string
          format: date-time
          description: The date when the device was registered
    MetricPeriod:
      type: object
      properties:
        from:
          type: string
          format: date-time
          description: Start date of the period
        to:
          type: string
          format: date-time
          description: End date of the period
        tier_id:
          type: string
          format: uuid
          description: The tier ID associated with this period
        last_visit:
          type: string
          format: date-time
          description: Last customer visit during this period
        last_session:
          type: string
          format: date-time
          description: Last customer session during this period
        spend_total:
          type: number
          description: Total amount spent by the customer during this period
        number_of_purchases:
          type: number
          description: Number of purchases made by the customer during this period
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````