---
schema_version: "1"
id: 4973c3b232a18717e40b4dcd6cea434e30ced22f542ace9bd4df4d2e615cf57d
title: Salesforce Commerce Import API
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/commerce-cloud/salesforce-commerce/guides/d2c-commerce/b2b-d2c-comm-import-apis.md
canonical_url: https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/b2b-d2c-comm-import-apis.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: be99493e521237d26254534d8f9bae83ffb894d6f84da279a3ba5cd37e6a00a7
products:
  - B2B Commerce Developer Guide
  - Salesforce APIs
---
# Salesforce Commerce Import API

Import product and category data to a store with a `.csv` file by using the Salesforce Commerce Import APIs. You can import data asynchronously.

## Import APIs for Products

For product data, there are two Commerce Import Product Job resources: one to create a product import job, and another to manage a job. Use [Commerce Import Product Job, Create](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_commerce_import_product_job_create.htm) to globally update or add products and related entities from a specified product import file. Use the [manage resource](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_commerce_import_category_job_manage.htm) to get the status of a job with a GET request or cancel a job with a PATCH request. For the PATCH request, specify the `status` property as `Aborted` in the [Product Import Cancel Input](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_requests_product_import_cancel_input.htm) request body.

**note:** A resource was previously introduced for synchronous product imports, but it was superseded by asynchronous product imports, and we plan to remove it in API version 63.0. Use [Commerce Import Product Job, Create](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_commerce_import_product_job_create.htm) to import products instead.

When you construct a product import .csv file, specify column headings that correspond to product, category, and price book information. Each row in the file represents a product and its variations. See [CSV File Format for Importing Commerce Data](https://help.salesforce.com/s/articleView?id=commerce.comm_prod_import_csv.htm).

## Import APIs for Categories

The Import APIs for category data are similar to the resources for product data. To import category data asynchronously, make a POST request to the [Commerce Import Category Job, Create](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_commerce_import_category_job_create.htm) resource. To get the status of a category import job, make a GET request to the Commerce Import Category Job, Manage resource. To cancel a category import job, make a PATCH request to the manage resource with the `status` property specified as `Aborted` in the [Category Import Abort Input](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_requests_category_import_abort_input.htm) request body.

When you construct a category import .csv file, specify column headings that correspond to category path, URL slug, and category description information. Each row in the file represents a category and its structure. See [CSV File Format for Importing Category Data for a Store](https://help.salesforce.com/s/articleView?id=commerce.comm_seo_category_urls.htm).

## Use Case

To understand the Import APIs, consider the steps involved in a product import. This scenario features just a few Import APIs and doesn't include the entire functionality.

First, construct a `.csv` file where column headings correspond to product, category, and price book information and each row represents a product and its variations. The column headings are case-insensitive, and the columns can be in any order. To properly encode special characters, save the `.csv` file in UTF-8 format.

Then, upload your file to [Salesforce Files](https://help.salesforce.com/s/articleView?id=experience.collab_salesforce_files_parent.htm). The upload assigns the file a content version ID, which the Import APIs use later to access the file. To get the content version ID, view the file details in the [Salesforce Files UI](https://help.salesforce.com/s/articleView?id=experience.collab_files_previewing.htm). The second-to-last part of the URL is the content version ID. If you upload the file by using the [User Files Connect API](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_users_files_general.htm), the API response includes the content version ID.

Next, make a POST request to `/commerce/management/import/product/jobs`. The request body for POST, [Global Product Import Input](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_requests_global_product_import_input.htm), has a property, `importConfiguration`, that specifies the settings and source for the import. [Import Settings](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_requests_import_settings_input.htm) are applied to all products in the import file and can set details such as which CMS workspace or entitlement policy to associate with the products. The `importSettings` property is required if you specify media-related, price-related, or category-related column headings in your `.csv` file.

To provide the content version ID for your file, use the `importSource` property of the request body. If you’re simply testing the API functionality, you can also provide a sample `.csv` file by setting the `sampleData` property to one of the pre-defined datasets (for example, `B2BSampleData`).

```JSON
{
  "importConfiguration":{
    "importSource":{
      "contentVersionId":"069RM0000008F4FYAU"
      },
    "importSettings":{
      "category":{
        "productCatalogId":"0ZSRM00000004Fk4AI"
         },
      "media":{
        "cmsWorkspaceId":"0ZuRM0000000Fcz0AE"
         },
      "price":{
        "pricebookAliasToIdMapping":{
          "original":"01sRM000004aArJYAU",
          "sales":"01sRM000004aArIYAU",
          "wintersales":"01sRM000004aArKYAU"
        }
      },
      "entitlement":{
        "defaultEntitlementPolicyId":"1CeRM00000003o40AA"
      }
    }
  }
}
```

## Resources

| Resource                                                                                                                                                                                       | Supported HTTP Methods | Description                                                                                      |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | ------------------------------------------------------------------------------------------------ |
| [`/commerce/management/import/​category/jobs`](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_commerce_import_category_job_create.htm)         | POST                   | Create a job to asynchronously import category data by using a `.csv` file.                      |
| [`/commerce/management/import/​category/jobs/{jobId}`](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_commerce_import_category_job_manage.htm) | GET, PATCH             | Cancel or get the status of a job to asynchronously import category data by using a `.csv` file. |
| [`/commerce/management/webstores/{webstoreId}/​product-import`](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_commerce_import_product.htm)    | POST                   | Synchronously import products for a B2B store by using a `.csv` file.                            |
| [`/commerce/management/import/product/jobs`](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_commerce_import_product_job_create.htm)            | POST                   | Create a job to asynchronously import product data by using a `.csv` file.                       |
| [`/commerce/management/import/product/jobs​/{jobId}`](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_commerce_import_product_job_manage.htm)   | GET, PATCH             | Manage an asynchronous product import job. You can cancel or get the status of the job.          |
