Create a product

post
/products

Create a product.

as-store-id
string
required

The unique store identifier is generated by AfterShip. You can obtain this id by making a GET /stores call to get existing stores or a POST /stores to create a new store.

source_id
string
required

A unique identifier for the product.

<= 32 characters
Example:
546735673
title
string
required

The title of the product.

<= 1024 characters
Example:
Power Mobile Phone
slug
string

URL friendly unique identifier for the product.

<= 1024 characters
Example:
power-mobile-phone
categories
array[string]

The categories associated with the product, used for filtering and search purposes.

<= 100 items
tags
array[string]

The tags associated with the product, used for filtering and search purposes.

<= 100 items
image_urls
array[string]
required

URLs of the product images.

<= 100 items
url
string

The URL of the product page in your online storefront.

<= 2048 characters
Example:
https://example.com/product/
published
boolean

To indicate whether the product has been published.

Default:
true
description
string

Description of the product.

<= 10240 characters
variants
array[object]
required

Product variant information.

>= 1 items<= 500 items
source_id
string
required

A unique identifier for the product variant.

<= 32 characters
Example:
5634477687
available_quantity
integer

Available quantity.

Example:
1
sku
string
required

The product SKU of the product variant.

<= 256 characters
title
string
required

The title of the product variant

<= 1024 characters
Example:
Power Mobile Phone
price
string
required

The price of the product variant.

<= 100 characters
Example:
10
image_urls
array[string]

The product image URL of the product variant.

<= 100 items
compare_at_price
string

The original price of the item before an adjustment or a sale.

weight
Weight

The weight information of the product variant.

Example:
{"unit":"kg","value":10}
allow_backorder
boolean

To specify whether customers are permitted to place an order for this out-of-stock product variant.

options
array[object]

The custom product variant properties, such as size, color, and material.

>= 1 items
source_created_at
string

The date and time, formatted in ISO 8601, indicating when the product was created in your e-commerce system.

Example:
2021-04-15T20:02:09Z
source_updated_at
string

The date and time, formatted in ISO 8601, indicating when the product was updated in your e-commerce system.

Example:
2021-04-15T20:02:09Z
meta
Meta

The Meta model holds the metadata of the API response, including relevant error details for debugging purposes.Show all...

Example:
{"code":20000,"type":"OK","message":"The request was successfully processed by AfterShip."}
code
number
required

Error code in integer format. For detailed information, please refer to the Request Error introduction page.

Default:
20000
Example:
20000
type
string
required

Response type string for the reference. For detailed information, please refer to the Request Error introduction page.

>= 1 characters
Example:
OK
message
string
required

Human-readable response message. For detailed information, please refer to the Request Error introduction page.

>= 1 characters
Example:
The request was successfully processed by AfterShip.
errors
array[Error]

Error detail object. Each error object contains a "path" key and an "info" key. The "path" is the JSON path of the request object to indicate the error location. The "info" is a human-readable description of the error.Show all...

data
Product

The Product model represents an individual item of your store. It includes essential attributes such as product title, price, variants, SKU, and so on. This model is crucial for cataloging and managing the store's inventory effectively.

Example:
{"id":"fbc7245f23494576829c4b00609cf1ab","source_id":"546735673","store":{"id":"0ecb8ff7efa84d7d8f763ed7b21851d1"},"title":"Power Mobile Phone","slug":"power-mobile-phone","categories":["mobile-phone"],"tags":["mobile-phone"],"image_urls":["https://example.com/product/image.png"],"url":"https://example.com/product/image.png","published":true,"description":"string","variants":[{"source_id":"5634477687","available_quantity":1,"sku":"SKU001","title":"Power Mobile Phone","price":"10","image_urls":["https://example.com/product/image.png"],"compare_at_price":"string","weight":{"unit":"kg","value":10},"allow_backorder":true,"options":[{"name":"color","value":"white"}]}],"source_created_at":"2021-04-15T20:02:09Z","source_updated_at":"2021-04-15T20:02:09Z","created_at":"2021-04-15T20:02:09Z","updated_at":"2021-04-15T20:02:09Z"}
id
string

Unique identifier generated by AfterShip.

Example:
fbc7245f23494576829c4b00609cf1ab
source_id
string
required

A unique identifier for the product in your system.

Example:
546735673
store
object

Indicate which store the product belongs to.

title
string
required

The title of the product.

Example:
Power Mobile Phone
slug
string

URL friendly unique identifier for the product.

Example:
power-mobile-phone
categories
array[string]

The categories associated with the product, used for filtering and search purposes.

tags
array[string]

The tags associated with the product, used for filtering and search purposes.

image_urls
array[string]
required

URLs of the product images.

url
string

The URL of the product page in your online storefront.

Example:
https://example.com/product/image.png
published
boolean

To indicate whether the product has been published.

Default:
true
description
string

Description of the product.

variants
array[object]
required

Product variant information.

>= 1 items
source_created_at
string

The date and time, formatted in ISO 8601, indicating when the product was created in your e-commerce system.

Example:
2021-04-15T20:02:09Z
source_updated_at
string

The date and time, formatted in ISO 8601, indicating when the product was updated in your e-commerce system.

Example:
2021-04-15T20:02:09Z
created_at
string

The date and time, formatted in ISO 8601, indicating when the product was created in AfterShip system.

Example:
2021-04-15T20:02:09Z
updated_at
string

The date and time, formatted in ISO 8601, indicating when the product was updated in AfterShip system.

Example:
2021-04-15T20:02:09Z
Auth
:
Parameters
:
Body
{ "source_id": "546735673", "title": "Power Mobile Phone", "slug": "power-mobile-phone", "categories": [ "mobile-phone" ], "tags": [ "mobile-phone" ], "image_urls": [ "https://example.com/product/image.png" ], "url": "https://example.com/product/", "published": true, "description": "string", "variants": [ { "source_id": "5634477687", "available_quantity": 1, "sku": "string", "title": "Power Mobile Phone", "price": "10", "image_urls": [ "https://example.com/product/image.png" ], "compare_at_price": "string", "weight": { "unit": "kg", "value": 10 }, "allow_backorder": true, "options": [ { "name": "color", "value": "white" } ] } ], "source_created_at": "2021-04-15T20:02:09Z", "source_updated_at": "2021-04-15T20:02:09Z" }
Response Example
{ "meta": { "code": 20100, "type": "Created", "message": "The request was successful, we created a new resource and the response body contains the representation." }, "data": { "id": "fbc7245f23494576829c4b00609cf1ab", "source_id": "546735673", "store": { "id": "0ecb8ff7efa84d7d8f763ed7b21851d1" }, "title": "Power Mobile Phone", "slug": "power-mobile-phone", "categories": [ "mobile-phone" ], "tags": [ "mobile-phone" ], "image_urls": [ "https://example.com/product/image.png" ], "url": "https://example.com/product/image.png", "published": true, "description": "string", "variants": [ { "source_id": "5634477687", "available_quantity": 1, "sku": "SKU001", "title": "Power Mobile Phone", "price": "10", "image_urls": [ "https://example.com/product/image.png" ], "compare_at_price": "string", "weight": { "unit": "kg", "value": 10 }, "allow_backorder": true, "options": [ { "name": "color", "value": "white" } ] } ], "source_created_at": "2021-04-15T20:02:09Z", "source_updated_at": "2021-04-15T20:02:09Z", "created_at": "2021-04-15T20:02:09Z", "updated_at": "2021-04-15T20:02:09Z" } }