Add Bundle Item
curl --request POST \
--url https://api.headlesscommerce.io/v1/admin/products/{id}/bundle-items \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"child_product_id": "<string>",
"quantity": 2,
"child_variant_id": "<string>"
}
'import requests
url = "https://api.headlesscommerce.io/v1/admin/products/{id}/bundle-items"
payload = {
"child_product_id": "<string>",
"quantity": 2,
"child_variant_id": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({child_product_id: '<string>', quantity: 2, child_variant_id: '<string>'})
};
fetch('https://api.headlesscommerce.io/v1/admin/products/{id}/bundle-items', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.headlesscommerce.io/v1/admin/products/{id}/bundle-items",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'child_product_id' => '<string>',
'quantity' => 2,
'child_variant_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.headlesscommerce.io/v1/admin/products/{id}/bundle-items"
payload := strings.NewReader("{\n \"child_product_id\": \"<string>\",\n \"quantity\": 2,\n \"child_variant_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.headlesscommerce.io/v1/admin/products/{id}/bundle-items")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"child_product_id\": \"<string>\",\n \"quantity\": 2,\n \"child_variant_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.headlesscommerce.io/v1/admin/products/{id}/bundle-items")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"child_product_id\": \"<string>\",\n \"quantity\": 2,\n \"child_variant_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"bundle_product_id": "<string>",
"child_product_id": "<string>",
"child_variant_id": "<string>",
"quantity": 123,
"child_product": {
"id": "<string>",
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"type": "physical",
"status": "draft",
"tags": [
"<string>"
],
"attributes": {},
"images": [
{
"id": "<string>",
"url": "<string>",
"alt_text": "<string>",
"position": 123,
"width": 123,
"height": 123
}
],
"options": [
{
"id": "<string>",
"name": "<string>",
"position": 123,
"values": [
{
"id": "<string>",
"value": "<string>",
"position": 123
}
]
}
],
"variants": [
{
"id": "<string>",
"product_id": "<string>",
"sku": "<string>",
"barcode": "<string>",
"price": {
"amount": 123,
"currency": "<string>"
},
"compare_at_price": {
"amount": 123,
"currency": "<string>"
},
"cost_price": {
"amount": 123,
"currency": "<string>"
},
"weight": 123,
"is_active": true,
"option_values": [
{
"id": "<string>",
"value": "<string>",
"position": 123
}
],
"images": [
{
"id": "<string>",
"url": "<string>",
"alt_text": "<string>",
"position": 123,
"width": 123,
"height": 123
}
],
"inventory": {
"id": "<string>",
"variant_id": "<string>",
"track_inventory": true,
"allow_backorder": true,
"safety_stock": 123,
"on_hand": 123,
"reserved": 123,
"available": 123,
"metadata": {}
},
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"child_variant": {
"id": "<string>",
"product_id": "<string>",
"sku": "<string>",
"barcode": "<string>",
"price": {
"amount": 123,
"currency": "<string>"
},
"compare_at_price": {
"amount": 123,
"currency": "<string>"
},
"cost_price": {
"amount": 123,
"currency": "<string>"
},
"weight": 123,
"is_active": true,
"option_values": [
{
"id": "<string>",
"value": "<string>",
"position": 123
}
],
"images": [
{
"id": "<string>",
"url": "<string>",
"alt_text": "<string>",
"position": 123,
"width": 123,
"height": 123
}
],
"inventory": {
"id": "<string>",
"variant_id": "<string>",
"track_inventory": true,
"allow_backorder": true,
"safety_stock": 123,
"on_hand": 123,
"reserved": 123,
"available": 123,
"metadata": {}
},
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}Admin - Products
Add Bundle Item
POST
/
admin
/
products
/
{id}
/
bundle-items
Add Bundle Item
curl --request POST \
--url https://api.headlesscommerce.io/v1/admin/products/{id}/bundle-items \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"child_product_id": "<string>",
"quantity": 2,
"child_variant_id": "<string>"
}
'import requests
url = "https://api.headlesscommerce.io/v1/admin/products/{id}/bundle-items"
payload = {
"child_product_id": "<string>",
"quantity": 2,
"child_variant_id": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({child_product_id: '<string>', quantity: 2, child_variant_id: '<string>'})
};
fetch('https://api.headlesscommerce.io/v1/admin/products/{id}/bundle-items', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.headlesscommerce.io/v1/admin/products/{id}/bundle-items",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'child_product_id' => '<string>',
'quantity' => 2,
'child_variant_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.headlesscommerce.io/v1/admin/products/{id}/bundle-items"
payload := strings.NewReader("{\n \"child_product_id\": \"<string>\",\n \"quantity\": 2,\n \"child_variant_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.headlesscommerce.io/v1/admin/products/{id}/bundle-items")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"child_product_id\": \"<string>\",\n \"quantity\": 2,\n \"child_variant_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.headlesscommerce.io/v1/admin/products/{id}/bundle-items")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"child_product_id\": \"<string>\",\n \"quantity\": 2,\n \"child_variant_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"bundle_product_id": "<string>",
"child_product_id": "<string>",
"child_variant_id": "<string>",
"quantity": 123,
"child_product": {
"id": "<string>",
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"type": "physical",
"status": "draft",
"tags": [
"<string>"
],
"attributes": {},
"images": [
{
"id": "<string>",
"url": "<string>",
"alt_text": "<string>",
"position": 123,
"width": 123,
"height": 123
}
],
"options": [
{
"id": "<string>",
"name": "<string>",
"position": 123,
"values": [
{
"id": "<string>",
"value": "<string>",
"position": 123
}
]
}
],
"variants": [
{
"id": "<string>",
"product_id": "<string>",
"sku": "<string>",
"barcode": "<string>",
"price": {
"amount": 123,
"currency": "<string>"
},
"compare_at_price": {
"amount": 123,
"currency": "<string>"
},
"cost_price": {
"amount": 123,
"currency": "<string>"
},
"weight": 123,
"is_active": true,
"option_values": [
{
"id": "<string>",
"value": "<string>",
"position": 123
}
],
"images": [
{
"id": "<string>",
"url": "<string>",
"alt_text": "<string>",
"position": 123,
"width": 123,
"height": 123
}
],
"inventory": {
"id": "<string>",
"variant_id": "<string>",
"track_inventory": true,
"allow_backorder": true,
"safety_stock": 123,
"on_hand": 123,
"reserved": 123,
"available": 123,
"metadata": {}
},
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"child_variant": {
"id": "<string>",
"product_id": "<string>",
"sku": "<string>",
"barcode": "<string>",
"price": {
"amount": 123,
"currency": "<string>"
},
"compare_at_price": {
"amount": 123,
"currency": "<string>"
},
"cost_price": {
"amount": 123,
"currency": "<string>"
},
"weight": 123,
"is_active": true,
"option_values": [
{
"id": "<string>",
"value": "<string>",
"position": 123
}
],
"images": [
{
"id": "<string>",
"url": "<string>",
"alt_text": "<string>",
"position": 123,
"width": 123,
"height": 123
}
],
"inventory": {
"id": "<string>",
"variant_id": "<string>",
"track_inventory": true,
"allow_backorder": true,
"safety_stock": 123,
"on_hand": 123,
"reserved": 123,
"available": 123,
"metadata": {}
},
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}Authorizations
API Key. Example: sk_live_xxxxx or pk_live_xxxxx
Path Parameters
Resource ID
Body
application/json
⌘I