Skip to content
campaiDeveloper
campai.com

Sales · Products

POST/{organizationId}/{mandateId}/sales/productsWithVariants

Create product with variants

Creates a product sold in several versions, such as a shirt in sizes and colors, with one product per combination of its option values. Each variant has its own number, price, stock and active state; name, description, category, unit, tax, account, cost centers and the stock mode are taken from the product

Permissions

Send an API key of the organization in the path, using the X-API-Key header.

Permission checks in detail
Required permissions
  • mandate.read
  • product.insert
  • inventory.edit
Also checked, depending on the request and the records it touches
  • product.read

Request

Path parameters

  • organizationIdidrequired
  • mandateIdidrequired

Body

Content-Type: application/json

  • numberstringrequired

    at most 32 characters

  • namestringrequired

    1–80 characters

  • descriptionstringrequired

    at most 2000 characters

  • categoryidrequirednullable
  • activebooleanrequired
  • imageSourceProductIdid
  • imagesobject[]

    at most 8 items · default []

    3 properties
    • fileNamestring

      at most 128 characters

    • resourcestringrequired
    • idstring

      exactly 6 characters

  • unitobjectrequired
  • inventoryModestringrequired
    unlimited global salesPeriod
  • priceobjectrequired
    8 properties
    • isNetbooleanrequired
    • priceintegerrequired

      0–9999999999

    • taxCodestringrequirednullable

      1–5 characters

    • taxRatenumberrequirednullable

      at most 99

    • accountintegerrequired

      1–999999999

    • costCenter1numberrequirednullable

      1–99999999

    • costCenter2numberrequirednullable

      1–99999999

    • dimensionsobject[]required
      2 properties
      • dimensionIdidrequired
      • optionKeystringrequired

        1–64 characters

  • optionsobject[]required

    1–2 items

    3 properties
    • idstringrequired

      exactly 8 characters

    • namestringrequired

      1–40 characters

    • valuesobject[]required

      1–50 items

      2 properties
      • idstringrequired

        exactly 8 characters

      • namestringrequired

        1–20 characters

  • variantsobject[]required

    at most 50 items

    7 properties
    • _ididrequirednullable
    • valuesobject[]required

      1–2 items

      2 properties
      • optionstringrequired

        exactly 8 characters

      • valuestringrequired

        exactly 8 characters

    • numberstringrequired

      at most 32 characters

    • pricenumberrequirednullable

      at least 0

    • activebooleanrequired
    • initialCapacitynumber

      at least 0 · default 0

    • salesPeriodInitialCapacitynumber

      at least 0 · default 0

  • shopobject
    3 properties
    • listedbooleanrequired
    • textstringrequired

      at most 4000 characters

    • memberPricesobject[]required

      at most 10 items

      4 properties
      • idstringrequired

        exactly 8 characters

      • namestringrequired

        1–50 characters

      • amountintegerrequired

        0–9999999999

      • memberobjectrequired
        3 properties
        • tagsstring[]required

          at most 4 items · each 1–40 characters

        • tagsModestringrequired
          any all
        • allMandatesboolean

          default false

Request
curl --fail-with-body --silent --show-error --max-time 30 --globoff \
  --request POST 'https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/YOUR_MANDATE_ID/sales/productsWithVariants' \
  --header 'X-API-Key: YOUR_API_KEY'

No request that worked has been recorded yet, so the body is not shown.

Response

200 Successful response

Content-Type: application/json

  • _idid
Response200
{
  "_id": "000000000000000000000001"
}

Errors

No errors of its own are known for this endpoint.

Errors nearly every request can meet are listed under Errors.