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

# Create a repeat purchase report

> Create a "repeat purchase" report. The generated report CSV contains the columns defined in the `RepeatPurchaseReportColumns` schema including repeat customer counts, sales percentages, and per-customer revenue metrics. Use the /reports/status/{reportId} endpoint to check report status and obtain the download URL.



## OpenAPI

````yaml /api-reference/openapi.json post /reports/create/repeatPurchase
openapi: 3.0.1
info:
  title: MerchantSpring Public API
  version: 1.0.0
servers:
  - url: https://mm-api.merchantspring.io
    description: Production
  - url: https://mm-api-staging.merchantspring.io
    description: Staging
security: []
tags:
  - name: channel
    x-group: Channel
  - name: content-change
    x-group: Content Change
  - name: custom-group
    x-group: Custom Group
  - name: order
    x-group: Order
  - name: report
    x-group: Report
  - name: tag
    x-group: Tag
  - name: profitability
    x-group: Profitability
paths:
  /reports/create/repeatPurchase:
    post:
      tags:
        - report
      summary: Create a repeat purchase report
      description: >-
        Create a "repeat purchase" report. The generated report CSV contains the
        columns defined in the `RepeatPurchaseReportColumns` schema including
        repeat customer counts, sales percentages, and per-customer revenue
        metrics. Use the /reports/status/{reportId} endpoint to check report
        status and obtain the download URL.
      operationId: createRepeatPurchaseReport
      requestBody:
        description: Report criteria
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRepeatPurchaseReportRequest'
        required: true
      responses:
        '200':
          description: Successful operation
          headers:
            Access-Control-Allow-Origin:
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateReportResponse'
            text/csv:
              schema:
                $ref: '#/components/schemas/RepeatPurchaseReportColumns'
        '400':
          description: Invalid input
          content: {}
      security:
        - api_key: []
components:
  schemas:
    CreateRepeatPurchaseReportRequest:
      type: object
      properties:
        channelId:
          type: string
        merchantId:
          type: string
        reportOptions:
          $ref: '#/components/schemas/CreateRepeatPurchaseReportOptions'
    CreateReportResponse:
      type: object
      properties:
        reportId:
          type: string
        reportType:
          type: string
        status:
          type: string
    RepeatPurchaseReportColumns:
      type: object
      description: Columns present in the downloadable Repeat Purchase report CSV.
      properties:
        productSku:
          type: string
          description: Product SKU
        title:
          type: string
          description: Product title
        totalSales:
          type: number
          description: Total sales (current period)
        priorTotalSales:
          type: number
          description: Total sales (prior period)
        repeatCustomerSales:
          type: number
          description: Sales from repeat customers (current period)
        priorRepeatCustomerSales:
          type: number
          description: Sales from repeat customers (prior period)
        repeatSalesPercentage:
          type: number
          description: Percentage of sales from repeat customers (current period)
        priorRepeatSalesPercentage:
          type: number
          description: Percentage of sales from repeat customers (prior period)
        totalCustomers:
          type: number
          description: Total customers (current period)
        priorTotalCustomers:
          type: number
          description: Total customers (prior period)
        newCustomers:
          type: number
          description: New customers (current period)
        priorNewCustomers:
          type: number
          description: New customers (prior period)
        repeatCustomers:
          type: number
          description: Repeat customers (current period)
        priorRepeatCustomers:
          type: number
          description: Repeat customers (prior period)
        repeatCustomersPercentage:
          type: number
          description: Percentage of customers who are repeat buyers (current period)
        priorRepeatCustomersPercentage:
          type: number
          description: Percentage of repeat customers (prior period)
        salesPerCustomer:
          type: number
          description: Average sales per customer
        salesPerRepeatCustomer:
          type: number
          description: Average sales per repeat customer
        currency:
          type: string
          description: Currency code (e.g. USD, GBP)
    CreateRepeatPurchaseReportOptions:
      allOf:
        - $ref: '#/components/schemas/CommonReportOptions'
        - type: object
          properties:
            fromDate:
              type: integer
              description: >-
                Unix epoch time (seconds) representing the start of the
                reporting period
            toDate:
              type: integer
              description: >-
                Unix epoch time (seconds) representing the end of the reporting
                period
            priorFromDate:
              type: number
              description: >-
                Unix epoch time (seconds) representing the start of the
                comparison period
            priorToDate:
              type: number
              description: >-
                Unix epoch time (seconds) representing the end of the comparison
                period
            timezone:
              type: string
              description: >-
                The timezone string you wish to see the report in (e.g.
                'America/Los_Angeles') see
                https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
            includeTax:
              type: boolean
              description: Whether tax should be included in sales figures
    CommonReportOptions:
      type: object
      properties:
        fromDate:
          type: number
          description: >-
            Unix epoch time (seconds) representing the start of the reporting
            period
        toDate:
          type: number
          description: >-
            Unix epoch time (seconds) representing the end of the reporting
            period
        priorFromDate:
          type: number
          description: >-
            Unix epoch time (seconds) representing the start of the comparison
            period
        priorToDate:
          type: number
          description: >-
            Unix epoch time (seconds) representing the end of the comparison
            period
        timezone:
          type: string
          description: >-
            The timezone string you wish to see the report in (e.g.
            'America/Los_Angeles') see
            https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  securitySchemes:
    api_key:
      type: apiKey
      name: x-api-key
      in: header

````