Shop

Create a product

post/products

Request

  • Base URL
    https://gorest.co.in/public/v3
  • URL
    https://gorest.co.in/public/v3/products
  • Auth
    HTTP bearer

Headers

Idempotency-Keystring

A unique key (a UUID is fine) that makes a POST safe to retry for 24 hours. A retry with the same key, path and body gets the first answer again with Idempotent-Replayed: true and creates nothing; a retry while the first is still running gets 409 conflict with Retry-After: 1. The same key with another request gets 422 idempotency_key_mismatch. Only a 2xx answer is kept, so after an error the retry runs again. An answer over 64 KiB, or one that holds a new token's value, is not kept: its retry gets 409 conflict with the Location of what the first request made.

Request body

category_idstring uuid required

A category (see /categories).

currencystring required

An ISO 4217 code, either case.

descriptionstring
namestring required

Not blank; spaces at the ends are dropped.

price_minorinteger required
skustring required

Your code for the product, unique in your account.

stockinteger nullable

Units in stock; null or left out to not track stock.

Example request

{
  "sku": "EL-1001"
}

Response

The new product.

category_idstring uuid
created_atstring date-time
currencystring

An ISO 4217 code (see /currencies). Fixed once the product is made.

descriptionstring
idstring uuid required
namestring
price_minorinteger

The price in minor units of currency: 249900 with INR is ₹2,499.00.

read_onlyboolean

True for sample data (the seed); it cannot be changed.

skustring

Your code for the product, unique in your account.

stockinteger nullable

Units left; null when stock is not tracked (sample products). An order takes from it and a cancel puts it back.

updated_atstring date-time

Example response

{
  "category": {
    "name": "Home and kitchen",
    "slug": "home-kitchen"
  },
  "currency": "INR",
  "name": "Wireless earbuds",
  "price_minor": 249900,
  "sku": "EL-1001"
}

Changes

No recorded changes to this operation across all 1 revision of this API.