Import a Price
POST/pcm/pricebooks/import
You can create and update product price books and prices in bulk, at both organization and store level, using the Price Book Import API. This is useful, for example, if you have a promotion and want to update 50,000 product prices. Rather than having to go to each price book and manually edit 50,000 prices, you can use the Price Book Import API to bulk update all your product prices at the same time, including setting different prices for different currencies.
The API uses a JSONL file. The JSONL file can be compressed to a GZIP file. Here is an example of a JSONL file. See Price Book Export JSONL File.
The API works on a "best endeavours" approach. In other words, the API does its best to create/update the price book objects based on the file that you provide. If there are any errors, then the import is aborted, and the job fails with an error. You can then use the job results to understand what objects the API created/updated until the import failed, and to troubleshoot any errors. See Import Results.
Price book imports are processed sequentially in the order that you send your import API requests.
Responses
- 201
- default
The created price book
- application/json
- Schema
- Example (from schema)
Schema
data objectrequired
Top level entity in the jobs domain model. It contains a job details.
attributes objectrequired
meta objectrequired
{
"data": {
"id": "0dd4e7de-006f-460f-a43e-a581f375cedc",
"attributes": {
"created_at": "2020-09-22T09:00:00Z",
"updated_at": "2020-09-22T09:00:00Z",
"started_at": "2020-09-22T09:00:00Z",
"completed_at": "2020-09-22T09:00:00Z",
"type": "pricebook-import",
"status": "pending"
},
"meta": {
"x_request_id": "2d70776e-c2b0-4446-84e6-d08a24edfca4"
}
}
}
Unexpected error.
- application/json
- Schema
- Example (from schema)
Schema
- Array [
- ]
errors object[]
{
"errors": [
{
"detail": "The price book already exists",
"status": "409",
"title": "conflict"
}
]
}