Create a Product

Last updated 2 months ago

post
Create a Product

https://api.moltin.com
/v2/products
Request
Response
Headers
Authorization
required
string
The Bearer token to grant access to the API
Body Parameters
type
required
string
Represents the type of object being created
name
required
string
A human readable name for this product
slug
required
string
A unique slug for this product
sku
required
string
A unique SKU for this product
manage_stock
required
boolean
True if moltin should manage stock, false if not
description
required
string
A human readable description of the product
price
required
array
An array of prices, one for each currency
price.amount
required
integer
Value of the price
price.currency
required
string
Currency of this price (3 letter ISO)
price.includes_tax
optional
boolean
true if relevant taxes have been included in the price, false if not
status
optional
string
draft, live
commodity_type
optional
string
physical, digital
200: OK
{
"data": {
"type": "product",
"id": "e41f25d8-a2c2-4af2-b316-364f3fc8048d",
"name": "Deck Shoe",
"slug": "deck-shoe_33",
"sku": "deck-shoe_33",
"manage_stock": false,
"description": "Modern boat shoes were invented in 1935 by American Paul A. Sperry",
"price": [
{
"amount": 5891,
"currency": "USD",
"includes_tax": true
}
],
"status": "live",
"commodity_type": "physical",
"relationships": {},
"meta": {
"display_price": {
"with_tax": {
"amount": 5891,
"currency": "USD",
"formatted": "$58.91"
},
"without_tax": {
"amount": 5891,
"currency": "USD",
"formatted": "$58.91"
}
},
"stock": {
"level": 0,
"availability": "out-stock"
}
}
}
}
cURL
JavaScript SDK
Moltin Request
curl -X POST https://api.moltin.com/v2/products \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json" \
-d $'{
"data": {
"type": "product",
"name": "Deck Shoe",
"slug": "deck-shoe",
"sku": "deck-shoe-001",
"description": "Modern boat shoes were invented in 1935 by American Paul A. Sperry",
"manage_stock": true,
"price": [
{
"amount": 5891,
"currency": "USD",
"includes_tax": true
}
],
"status": "live",
"commodity_type": "physical"
}
}'
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X'
})
const product = {
name: 'Deck Shoe',
slug: 'deck-shoe',
sku: 'deck-shoe-001',
description: 'A product for testing purposes',
manage_stock: false,
price: [
{
amount: 5891,
currency: 'USD',
includes_tax: true
}
],
status: 'live',
commodity_type: 'physical'
}
Moltin.Products.Create(product).then(product => {
// Do something
})
const { createClient } = require('@moltin/request')
const client = new createClient({
client_id: 'X',
client_secret: 'X'
})
const data = {
type: 'product',
name: 'Deck Shoe',
slug: 'deck-shoe',
sku: 'deck-shoe-001',
description: 'A product for testing purposes',
manage_stock: false,
price: [
{
amount: 5891,
currency: 'USD',
includes_tax: true
}
],
status: 'live',
commodity_type: 'physical'
}
client
.post('products', data)
.then(product => {
// Do something...
})
.catch(console.error)