Skip to main content

Create price books

Use the createPriceBook mutation to create an empty price book. You will use other mutations to add conditions and entries.

Ensure that you request the price book id in the response because you need it to create conditions and entries.

Mutation

mutation createPriceBook($createPriceBookInput: CreatePriceBookInput!) {
createPriceBook(input: $createPriceBookInput) {
priceBook {
id
name
description
}
userErrors {
__typename
... on UserError {
message
}
}
}
}

Variables

{
"createPriceBookInput": {
"name": "Acme price book",
"description": "This is the price book for Acme Corp.",
"createdBy": "john.smith@example.com"
}
}

Response

{
"data": {
"createPriceBook": {
"priceBook": {
"id": "6beab4df-d944-4e52-8694-8bcf5b514015",
"name": "Acme price book",
"description": "This is the price book for Acme Corp."
},
"userErrors": null
}
}
}

Was this page helpful?