Get Product Categories

GET /wp-json/content-api/v1/product/categories/

Retrieves categories assigned to a specific product.

Authentication

This endpoint requires a Bearer token in the Authorization header. To authenticate:

  1. Go to Content API > Settings in your WordPress admin panel.
  2. Set a secure token in the “Token” field and save it.
  3. Include the token in your request header as follows:
Authorization: Bearer <your-token-here>

Replace <your-token-here> with the token you configured.

Parameters

Name Type Description Required
product_id integer Product ID Yes (or SKU)
sku string Product SKU Yes (or product_id)

Example Request

{
  "product_id": 123
}

Example Response

{
  "success": true,
  "product_id": 123,
  "categories": [
    {
      "id": 16,
      "name": "T-Shirts",
      "slug": "t-shirts",
      "children": []
    }
  ]
}

Possible Errors

Code Message Description HTTP Status
not_authorized Not Authorized The provided Bearer token is invalid or does not match the configured token. 401
missing_identifier Product ID or SKU is required Neither product_id nor sku was provided. 400
product_id_invalid Product ID is invalid The provided product_id is not a valid number. 400
sku_invalid SKU is invalid The provided sku contains invalid characters. 400
conflicting_identifiers Both Product ID and SKU are provided. Please provide only one. Both product_id and sku were provided. 400
product_not_found Product not found The specified product does not exist. 404