NAV

Product types

Product types (or product classes) are groups of products which share the same attributes. Product attributes contain additional product information, e.g. ISBN, UPC, Brand, which is displayed in storefront and included in product feeds when exporting to marketplaces like Google Shopping, eBay, Amazon ads etc. Learn more about product types and attributes in Ecwid Help center.

Get product types

Get all product types present in an Ecwid store.

Request

Request example

GET /api/v3/4870020/classes?token=123abcd HTTP/1.1
Host: app.ecwid.com
Cache-Control: no-cache

GET https://app.ecwid.com/api/v3/{storeId}/classes?token={token}

NameTypeDescription
storeIdnumberEcwid store ID
tokenstringoAuth token

Response

Response example (JSON)

[
  {
    "id":0,
    "attributes":[
      {
        "id":5029057,
        "name":"Brand",
        "type":"BRAND",
        "show":"DESCR"
      },
      {
        "id":5029058,
        "name":"UPC",
        "type":"UPC",
        "show":"DESCR"
      }
    ]
  },
  {
    "id":4208002,
    "name":"Body Weight Scale Accessories",
    "googleTaxonomy":"Health & Beauty > Health Care > Biometric Monitor Accessories > Body Weight Scale Accessories",
    "attributes":[
      {
        "id":5508061,
        "name":"UPC",
        "type":"UPC",
        "show":"DESCR"
      },
      {
        "id":5508062,
        "name":"Brand",
        "type":"BRAND",
        "show":"DESCR"
      }
    ]
  }
]

A JSON array of objects of type ‘ProductClass’ with the following fields:

ProductClass

FieldTypeDescription
idnumberProduct type (class) internal unique ID. Class with ID 0 is the default 'General’ type assigned to all products by default
namestringProduct type name. Empty for the “General” type
googleTaxonomystringGoogle taxonomy associated with this type
attributesArray<Attribute>Product type attributes

Attribute

FieldTypeDescription
idnumberAttribute internal unique ID
namestringAttribute title
typestringAttribute type. There are user-defined attributes, general attributes and special 'price per unit’ attributes. The 'type’ field contains one of the following: CUSTOM, UPC, BRAND, GENDER, AGE_GROUP, COLOR, SIZE, PRICE_PER_UNIT, UNITS_IN_PRODUCT
showstringDefines how and where to display the product attribute value: NOTSHOW, DESCR, PRICE. For public tokens, NOTSHOW attributes are not returned

Errors

Error response example

HTTP/1.1 500 Server Error
Content-Type application/json; charset=utf-8

In case of error, Ecwid responds with an error HTTP status code and, optionally, JSON-formatted body containing error description

HTTP codes

HTTP StatusMeaning
400Request parameters are malformed
415Unsupported content-type: expected application/json or text/json
500Cannot retrieve the product type info because of an error on the server

Error response body (optional)

FieldTypeDescription
errorMessagestringError message

Get product type

Get the full details of a specific product type referring to its ID.

Request

Request example

GET /api/v3/4870020/classes/4208002?token=123abcd HTTP/1.1
Host: app.ecwid.com
Cache-Control: no-cache

GET https://app.ecwid.com/api/v3/{storeId}/classes/{classId}?token={token}

NameTypeDescription
storeIdnumberEcwid store ID
tokenstringoAuth token
classIdnumberProduct type internal ID

Response

Response example (JSON)

  {
    "id":4208002,
    "name":"Body Weight Scale Accessories",
    "googleTaxonomy":"Health & Beauty > Health Care > Biometric Monitor Accessories > Body Weight Scale Accessories",
    "attributes":[
      {
        "id":5508061,
        "name":"UPC",
        "type":"UPC",
        "show":"DESCR"
      },
      {
        "id":5508062,
        "name":"Brand",
        "type":"BRAND",
        "show":"DESCR"
      }
    ]
  }

A JSON object of type 'ProductClass’ with the following fields:

ProductClass

FieldTypeDescription
idnumberProduct class internal unique ID. Class with ID 0 is the default 'General’ type assigned to all products by default
namestringProduct type name. Empty for the “General” type
googleTaxonomystringGoogle taxonomy associated with this type
attributesArray<Attribute>Product type attributes

Attribute

FieldTypeDescription
idnumberAttribute internal unique ID
namestringAttribute title
typestringAttribute type. There are user-defined attributes, general attributes and special 'price per unit’ attributes. The 'type’ field contains one of the following: CUSTOM, UPC, BRAND, GENDER, AGE_GROUP, COLOR, SIZE, PRICE_PER_UNIT, UNITS_IN_PRODUCT
showstringDefines how and where to display the product attribute value: NOTSHOW, DESCR, PRICE. For public tokens, NOTSHOW attributes are not returned

Errors

Error response example

HTTP/1.1 404 Not Found
Content-Type application/json; charset=utf-8

In case of error, Ecwid responds with an error HTTP status code and, optionally, JSON-formatted body containing error description

HTTP codes

HTTP StatusMeaning
400Request parameters are malformed
404Product type is not found
415Unsupported content-type: expected application/json or text/json
500Cannot retrieve the product type info because of an error on the server

Error response body (optional)

FieldTypeDescription
errorMessagestringError message

Update product type

Update the details of a specific product type referring to its ID.

Request

Request example

PUT /api/v3/4870020/classes/4208002?token=123abcd HTTP/1.1
Host: app.ecwid.com
Cache-Control: no-cache

{
    "name": "New Class Name",
    "attributes": [
        {
            name: "New attribute name",
            type: "CUSTOM",
            show: "DESCR"            
        }
    ]
}

PUT https://app.ecwid.com/api/v3/{storeId}/classes/{classId}?token={token}

NameTypeDescription
storeIdnumberEcwid store ID
tokenstringoAuth token
classIdnumberProduct type internal ID

Request body

A JSON object of type 'ProductClass’ with the following fields:

ProductClass

FieldTypeDescription
namestringProduct type name
attributesArray<Attribute>Product type attributes

Attribute

FieldTypeDescription
idnumberAttribute internal unique ID (leave empty when adding a new attribute)
namestringAttribute title
typestringAttribute type. There are user-defined attributes, general attributes and special 'price per unit’ attributes. The 'type’ field contains one of the following: CUSTOM, UPC, BRAND, GENDER, AGE_GROUP, COLOR, SIZE, PRICE_PER_UNIT, UNITS_IN_PRODUCT
showstringDefines how and where to display the product attribute value: NOTSHOW, DESCR, PRICE

Response

Response example (JSON)

{
    "updateCount": 1
}

A JSON object of type 'UpdateStatus’ with the following fields:

UpdateStatus

FieldTypeDescription
updateCountnumberThe number of updated types (1 or 0 depending on whether the update was successful)

Errors

Error response example

HTTP/1.1 409 Conflict
Content-Type application/json; charset=utf-8

In case of error, Ecwid responds with an error HTTP status code and, optionally, a JSON-formatted body containing error description.

HTTP codes

HTTP StatusResponse JSONDescription
400Request parameters are malformed
409The type/class with the given name already exists
415Unsupported content-type: expected application/json or text/json
500The request failed because of an error on the server

Error response body (optional)

FieldTypeDescription
errorMessagestringError message

Create product type

Create a new product type in an Ecwid store.

Request

Request example

POST /api/v3/4870020/classes?token=123abcd HTTP/1.1
Host: app.ecwid.com
Cache-Control: no-cache

{
"name": "T-Shirts",
    "attributes": [
        {
            "name": "Gender",
            "type": "CUSTOM",
            "show": "DESCR"
        },
        {
            "name": "Age group",
            "type": "CUSTOM",
            "show": "DESCR"
        },
        {
            "name": "Color",
            "type": "CUSTOM",
            "show": "DESCR"
        },
        {
            "name": "Size",
            "type": "CUSTOM",
            "show": "DESCR"
        }
      ]
}

POST https://app.ecwid.com/api/v3/{storeId}/classes?token={token}

NameTypeDescription
storeIdnumberEcwid store ID
tokenstringoAuth token

Request body

A JSON object of type 'ProductClass’ with the following fields:

ProductClass

FieldTypeDescription
namestringProduct type name. Ecwid will try to find a Google taxonomy that matches the name you submit here. If it finds, the taxonomy will be assigned to the new type.
attributesArray<Attribute>Product type attributes

Attribute

FieldTypeDescription
namestringAttribute title
typestringAttribute type. There are user-defined attributes, general attributes and special 'price per unit’ attributes. The 'type’ field contains one of the following: CUSTOM, UPC, BRAND, GENDER, AGE_GROUP, COLOR, SIZE, PRICE_PER_UNIT, UNITS_IN_PRODUCT
showstringDefines how and where to display the product attribute value: NOTSHOW, DESCR, PRICE

Response

Response example (JSON)

{
    "id": 4528008
}

A JSON object of type 'CreateStatus’ with the following fields:

CreateStatus

FieldTypeDescription
idnumberThe internal ID of the just created product type

Errors

Error response example

HTTP/1.1 409 Conflict
Content-Type application/json; charset=utf-8

In case of error, Ecwid responds with an error HTTP status code and, optionally, a JSON-formatted body containing error description.

HTTP codes

HTTP StatusResponse JSONDescription
400Request parameters are malformed
409The type/class with the given name already exists
415Unsupported content-type: expected application/json or text/json
500The request failed because of an error on the server

Error response body (optional)

FieldTypeDescription
errorMessagestringError message

Delete product type

Delete a specific product type and its assigned attributes. The products that belong to this type will not be removed. They will be re-assigned to the General type.

Request

Request example

DELETE /api/v3/4870020/classes/4208002?token=123abcd HTTP/1.1
Host: app.ecwid.com
Cache-Control: no-cache

DELETE https://app.ecwid.com/api/v3/{storeId}/classes/{classId}?token={token}

NameTypeDescription
storeIdnumberEcwid store ID
tokenstringoAuth token
classIdnumberProduct type internal ID

Response

Response example (JSON)

{
    "deleteCount": 1
}

A JSON object of type 'DeleteStatus’ with the following fields:

DeleteStatus

FieldTypeDescription
deleteCountnumberThe number of deleted types (1 or 0 depending on whether the request was successful). It returns 0 when the type with the given ID is not found

Errors

Error response example

HTTP/1.1 400 Wrong numeric parameter 'id' value: not a number or a number out of range
Content-Type application/json; charset=utf-8

In case of error, Ecwid responds with an error HTTP status code

HTTP codes

HTTP StatusMeaning
400Request parameters are malformed
500Cannot retrieve the product type info because of an error on the server