For full details of our Admin Rest API, please visit ShopBase API Docs
Frequent Asked API Questions
Product API
Create a Product
Create a simple product:
POST: /admin/products.json
{
"product": {
"title": "Simple product title"
}
}
Create a product with multiple product variants and multiple options:
POST: /admin/products.json
{
"product": {
"title": "Simple product title",
"variants": [
{
"option1": "Black",
"option2": "Small",
"price": "19.99",
"sku": "sku-189234-123-12-1",
"compare_at_price": "21.99"
},
{
"option1": "Red",
"option2": "Large",
"price": "19.99",
"sku": "sku-189234-123-12-2",
"compare_at_price": "21.99"
},
{
"option1": "Red",
"option2": "Medium",
"price": "19.99",
"sku": "sku-189234-123-12-3",
"compare_at_price": "21.99"
}
],
"options": [
{
"values": [
"Black",
"Red",
"Purple"
],
"name": "Color"
},
{
"values": [
"Small",
"Medium",
"Large"
],
"name": "Size"
}
],
"images": [
{
"metafields": [],
"src": "https://example.com/image-src-url-001.jpg",
"alt": "some-alt-text-01"
},
{
"metafields": [],
"src": "https://example.com/image-src-url-002.jpg",
"alt": "some-alt-text-02"
}
]
}
}
Update Product:
Update product title:
PUT admin/products/${product_id}.json
{
"product": {
"id": ${product_id},
"title": "New product title"
}
}
Update product by adding new product images:
PUT admin/products/${product_id}.json
{
"product": {
"id": ${product_id},
"images": [
{
"src": "https://example.com/new-product-image-001.jpg"
}
]
}
}
Update product by reordering product images:
PUT admin/products/${product_id}.json
{
"product": {
"id": ${product_id},
"images": [
{
"id": ${product_image_id_01},
"position": 2
},
{
"id": ${product_image_id_02},
"position": 1
}
]
}
}
Show/hide product:
# Show product
PUT admin/products/${product_id}.json
{
"product": {
"id": ${product_id},
"published": true
}
}
# Hide product
PUT admin/products/${product_id}.json
{
"product": {
"id": ${product_id},
"published": false
}
}
Product variant API
Add a new variant with an image for a product:
POST: /admin/products/${product_id}/variants.json
{
"variant": {
"option1": "Purple",
"option2": "Small",
"image_id": ${product_image_id},
"price": "19.99",
"sku": "sku-189234-123-12-4",
"compare_at_price": "21.99"
}
}
Update product variant - Add an existing image to an existing variant:
PUT: /admin/variants/${variant_id}.json
{
"variant": {
"id": ${variant_id},
"image_id": ${product_image_id},
"product_id": ${productID}
}
}
Update product variant - Update price:
PUT: /admin/variants/${variant_id}.json
{
"variant": {
"id": ${variant_id},
"price": 3.99,
"product_id": ${productID}
}
}
Product image API
Create new product image for a product with image attachment:
POST: /admin/products/${product_id}/images.json
{
"image": {
"attachment": "Data endcode Base64 of image",
"filename": "image.jpg"
}
}
Create a new product image for a product with an image URL:
POST: /admin/products/${product_id}/images.json
{
"image": {
"src": "https://example.com/image.jpg"
}
}
Create a new product image for a product and make it as the main image:
POST: /admin/products/${product_id}/images.json
{
"image": {
"src": "https://example.com/image.jpg",
"position": 1
}
}
Create a new product image for a product and assign it for product variants:
POST: /admin/products/${product_id}/images.json
{
"image": {
"src": "https://example.com/image.jpg",
"variant_ids": [
${variant_1_id},
${variant_2_id}
]
}
}
Update product image: assign it for product variants:
PUT: /admin/products/${product_id}/images/${image_id}.json
{
"image": {
"id": ${image_id},
"variant_ids": [
${variant_1_id},
${variant_2_id}
]
}
}