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

# Complete mapping and start processing

> Applies the submitted column mappings, then starts row processing. Omit `mappings`
to accept the auto-assigned ones from the create response. Returns 422 when a
required schema field is left unmapped (`details.missing_required_fields`) or a
file column is assigned twice.


**Required scope:** the write scope of the imported resource — `write_products` for product imports, `write_customers` for customer imports, etc. (for API-key authentication).



## OpenAPI

````yaml /api-reference/admin.yaml patch /api/v3/admin/imports/{id}/complete_mapping
openapi: 3.0.3
info:
  title: Admin API
  contact:
    name: Spree Commerce
    url: https://spreecommerce.org
    email: hello@spreecommerce.org
  description: >
    Spree Admin API v3 - Administrative API for managing products, orders, and
    store settings.


    ## Authentication


    The Admin API requires a secret API key passed in the `x-spree-api-key`
    header.

    Secret API keys can be generated in the Spree admin dashboard.


    ## Response Format


    All responses are JSON. List endpoints return paginated responses with
    `data` and `meta` keys.

    Single resource endpoints return a flat JSON object.


    ## Resource IDs


    Every resource is identified by an opaque string ID (e.g. `prod_86Rf07xd4z`,

    `variant_k5nR8xLq`, `or_UkLWZg9DAJ`). Use these IDs everywhere — URL paths,

    request bodies, and Ransack filters all accept them directly.


    ## Error Handling


    Errors return a consistent format:

    ```json

    {
      "error": {
        "code": "validation_error",
        "message": "Validation failed",
        "details": { "name": ["can't be blank"] }
      }
    }

    ```
  version: v3
servers:
  - url: http://{defaultHost}
    variables:
      defaultHost:
        default: localhost:3000
security: []
tags:
  - name: Authentication
    description: Admin user login, logout, token refresh, and current user profile
  - name: Allowed Origins
    description: CORS allowlist for storefront and admin client origins
  - name: API Keys
    description: Secret and publishable API keys
  - name: Categories
    description: >-
      Hierarchical product categories — tree management, repositioning, and
      product assignments
  - name: Channels
    description: >-
      Sales channels, product publication across channels, and per-channel order
      routing rules
  - name: Custom Fields
    description: >-
      Custom field definitions for products, variants, customers, and other
      resources
  - name: Customer Groups
    description: >-
      Customer groups for segmenting customers (e.g. wholesale, VIP) used by
      pricing and promotions
  - name: Customers
    description: Customer profiles, addresses, credit cards, and store credits
  - name: Exports
    description: Async CSV exports of admin resources
  - name: Fulfillments
    description: Order fulfillments — shipments, fulfill, cancel, resume, split
  - name: Gift Cards
    description: Gift cards and gift card batches
  - name: Imports
    description: >-
      Async CSV imports of admin resources, with per-row status and failed-row
      retry
  - name: Markets
    description: >-
      Markets — geographic groupings of countries used for pricing, tax, and
      fulfillment rules
  - name: Option Types
    description: >-
      Option types and option values used to build product variants (e.g. Size,
      Color)
  - name: Orders
    description: Orders, order items, applied gift cards, and applied store credits
  - name: Payment Methods
    description: Configured payment providers and their available types
  - name: Payments
    description: Order payments — list, capture, void
  - name: Pricing
    description: >-
      Prices and price lists for currency-, market-, and customer-group-specific
      pricing
  - name: Products
    description: >-
      Products, taxons/categories, product custom field values, and bulk product
      operations
  - name: Promotions
    description: Promotions, promotion rules, promotion actions, and coupon codes
  - name: Refunds
    description: Order refunds
  - name: Settings
    description: Store-level settings — store profile, tags, store credit categories
  - name: Staff
    description: Admin users, roles, and invitations to the store
  - name: Stock Locations
    description: Warehouses and physical fulfillment locations
  - name: Variants
    description: >-
      Product variants — the individual SKUs (size/color combinations) sold
      under a product
  - name: Webhooks
    description: Webhook endpoints and webhook delivery history
paths:
  /api/v3/admin/imports/{id}/complete_mapping:
    patch:
      tags:
        - Imports
      summary: Complete mapping and start processing
      description: >-
        Applies the submitted column mappings, then starts row processing. Omit
        `mappings`

        to accept the auto-assigned ones from the create response. Returns 422
        when a

        required schema field is left unmapped
        (`details.missing_required_fields`) or a

        file column is assigned twice.



        **Required scope:** the write scope of the imported resource —
        `write_products` for product imports, `write_customers` for customer
        imports, etc. (for API-key authentication).
      parameters:
        - name: x-spree-api-key
          in: header
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          required: true
          schema:
            type: string
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                mappings:
                  type: array
                  description: >-
                    Column assignments to apply before starting. `file_column:
                    null` unmaps a field.
                  items:
                    type: object
                    required:
                      - schema_field
                    properties:
                      schema_field:
                        type: string
                        example: slug
                      file_column:
                        type: string
                        nullable: true
                        example: Product Handle
      responses:
        '200':
          description: mapping completed, processing queued
          content:
            application/json:
              example:
                id: imp_gbHJdmfrXB
                number: IM014466541
                type: Spree::Imports::Products
                rows_count: 0
                created_at: '2026-07-24T18:11:05.103Z'
                updated_at: '2026-07-24T18:11:05.286Z'
                status: completed_mapping
                owner_type: Spree::Store
                owner_id: store_UkLWZg9DAJ
                user_id: admin_UkLWZg9DAJ
                processing_errors: null
                preferred_delimiter: ','
                original_filename: products_import.csv
                original_byte_size: 3612
                original_file_url: /api/v3/admin/imports/imp_gbHJdmfrXB/download
                completed_rows_count: 0
                failed_rows_count: 0
                schema_fields:
                  - name: slug
                    label: Slug
                    required: true
                  - name: sku
                    label: SKU
                    required: true
                  - name: name
                    label: Name
                    required: true
                  - name: price
                    label: Price
                    required: true
                  - name: status
                    label: Status
                    required: false
                  - name: description
                    label: Description
                    required: false
                  - name: meta_title
                    label: Meta Title
                    required: false
                  - name: meta_description
                    label: Meta Description
                    required: false
                  - name: meta_keywords
                    label: Meta Keywords
                    required: false
                  - name: tags
                    label: Tags
                    required: false
                  - name: compare_at_price
                    label: Compare at Price
                    required: false
                  - name: currency
                    label: Currency
                    required: false
                  - name: width
                    label: Width
                    required: false
                  - name: height
                    label: Height
                    required: false
                  - name: depth
                    label: Depth
                    required: false
                  - name: dimensions_unit
                    label: Dimensions Unit
                    required: false
                  - name: weight
                    label: Weight
                    required: false
                  - name: weight_unit
                    label: Weight Unit
                    required: false
                  - name: available_on
                    label: Available On
                    required: false
                  - name: discontinue_on
                    label: Discontinue On
                    required: false
                  - name: track_inventory
                    label: Track Inventory
                    required: false
                  - name: inventory_count
                    label: Inventory Count
                    required: false
                  - name: inventory_backorderable
                    label: Inventory Backorderable
                    required: false
                  - name: tax_category
                    label: Tax Category
                    required: false
                  - name: shipping_category
                    label: Shipping Category
                    required: false
                  - name: image1_src
                    label: Image 1 URL
                    required: false
                  - name: image2_src
                    label: Image 2 URL
                    required: false
                  - name: image3_src
                    label: Image 3 URL
                    required: false
                  - name: option1_name
                    label: Option 1 Name
                    required: false
                  - name: option1_value
                    label: Option 1 Value
                    required: false
                  - name: option2_name
                    label: Option 2 Name
                    required: false
                  - name: option2_value
                    label: Option 2 Value
                    required: false
                  - name: option3_name
                    label: Option 3 Name
                    required: false
                  - name: option3_value
                    label: Option 3 Value
                    required: false
                  - name: category1
                    label: Category 1
                    required: false
                  - name: category2
                    label: Category 2
                    required: false
                  - name: category3
                    label: Category 3
                    required: false
                csv_headers: []
                sample_row: {}
                mappings:
                  - id: immap_UkLWZg9DAJ
                    schema_field: slug
                    file_column: slug
                    required: true
                  - id: immap_gbHJdmfrXB
                    schema_field: sku
                    file_column: sku
                    required: true
                  - id: immap_EfhxLZ9ck8
                    schema_field: name
                    file_column: name
                    required: true
                  - id: immap_VqXmZF31wY
                    schema_field: price
                    file_column: price
                    required: true
                  - id: immap_uw2YK1rnl0
                    schema_field: status
                    file_column: status
                    required: false
                  - id: immap_OIJLhNcSbf
                    schema_field: description
                    file_column: description
                    required: false
                  - id: immap_AXs1igzRC6
                    schema_field: meta_title
                    file_column: meta_title
                    required: false
                  - id: immap_p6klVeMgbn
                    schema_field: meta_description
                    file_column: meta_description
                    required: false
                  - id: immap_nJqfPa3Cpe
                    schema_field: meta_keywords
                    file_column: meta_keywords
                    required: false
                  - id: immap_98FqgRua4h
                    schema_field: tags
                    file_column: tags
                    required: false
                  - id: immap_xhoCpeNMWu
                    schema_field: compare_at_price
                    file_column: compare_at_price
                    required: false
                  - id: immap_vEmzDoNU0H
                    schema_field: currency
                    file_column: currency
                    required: false
                  - id: immap_2KY5XM6frI
                    schema_field: width
                    file_column: width
                    required: false
                  - id: immap_HOVtlDrOmL
                    schema_field: height
                    file_column: height
                    required: false
                  - id: immap_ed6l8wVqSM
                    schema_field: depth
                    file_column: depth
                    required: false
                  - id: immap_s18jaGonyx
                    schema_field: dimensions_unit
                    file_column: dimensions_unit
                    required: false
                  - id: immap_GZUcnUYI5A
                    schema_field: weight
                    file_column: weight
                    required: false
                  - id: immap_ROeNhrwyV9
                    schema_field: weight_unit
                    file_column: weight_unit
                    required: false
                  - id: immap_L3pHOn63Vw
                    schema_field: available_on
                    file_column: available_on
                    required: false
                  - id: immap_PQNMcnNFWw
                    schema_field: discontinue_on
                    file_column: discontinue_on
                    required: false
                  - id: immap_C9SrJgpzQ4
                    schema_field: track_inventory
                    file_column: track_inventory
                    required: false
                  - id: immap_YHETxCGlb0
                    schema_field: inventory_count
                    file_column: inventory_count
                    required: false
                  - id: immap_5OQZnCRf8J
                    schema_field: inventory_backorderable
                    file_column: inventory_backorderable
                    required: false
                  - id: immap_F0GX8NaP3Y
                    schema_field: tax_category
                    file_column: tax_category
                    required: false
                  - id: immap_kOKT9MVfb0
                    schema_field: shipping_category
                    file_column: null
                    required: false
                  - id: immap_3uWpPTcf5W
                    schema_field: image1_src
                    file_column: image1_src
                    required: false
                  - id: immap_D6Psx31WaT
                    schema_field: image2_src
                    file_column: image2_src
                    required: false
                  - id: immap_msx3nOJap6
                    schema_field: image3_src
                    file_column: image3_src
                    required: false
                  - id: immap_5CQZnCRf8J
                    schema_field: option1_name
                    file_column: option1_name
                    required: false
                  - id: immap_M2nyloHRUQ
                    schema_field: option1_value
                    file_column: option1_value
                    required: false
                  - id: immap_prklVeMgbn
                    schema_field: option2_name
                    file_column: option2_name
                    required: false
                  - id: immap_so8jaGonyx
                    schema_field: option2_value
                    file_column: option2_value
                    required: false
                  - id: immap_rsClYtECFI
                    schema_field: option3_name
                    file_column: option3_name
                    required: false
                  - id: immap_8DR0I7fEbw
                    schema_field: option3_value
                    file_column: option3_value
                    required: false
                  - id: immap_aAtNvLSUAr
                    schema_field: category1
                    file_column: category1
                    required: false
                  - id: immap_QiA48cIW7A
                    schema_field: category2
                    file_column: category2
                    required: false
                  - id: immap_QDA48cIW7A
                    schema_field: category3
                    file_column: category3
                    required: false
      security:
        - api_key: []
          bearer_auth: []
components:
  securitySchemes:
    api_key:
      type: apiKey
      name: x-spree-api-key
      in: header
      description: Secret API key for admin access
    bearer_auth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT token for admin user authentication

````