POST /wp-json/content-api/v1/product-brand/
Creates a new product brand.
Content API Version: 1.0.3
Authentication
This endpoint requires a Bearer token in the Authorization
header. To authenticate:
- Go to Content API > Settings in your WordPress admin panel.
- Set a secure token in the “Token” field and save it.
- Include the token in your request header as follows:
Authorization: Bearer
Replace
with the token you configured.
Parameters
Name | Type | Description | Required |
---|---|---|---|
name | string | The name of the brand to create | Yes |
taxonomy | string | Taxonomy name (defaults to product_brand ) |
No |
description | string | The description of the brand | No |
slug | string | The slug of the brand | No |
parent | integer | The ID of the parent brand (set to 0 for no parent) | No |
yoast | object | Yoast SEO meta fields (title, description, premium social data) | No |
Example Request
POST /wp-json/content-api/v1/product-brand/
Content-Type: application/json
{
"name": "New Brand",
"taxonomy": "product_brand",
"description": "Description for New Brand",
"slug": "new-brand",
"parent": 0,
"yoast": {
"title": "New Brand Title",
"description": "New Brand Description",
"premium": {
"social_appearance": {
"title": "New Brand Social Title",
"description": "New Brand Social Description",
"image": "https://example.com/wp-content/uploads/new-brand-social.jpg"
},
"x": {
"title": "New Brand X Title",
"description": "New Brand X Description",
"image": "https://example.com/wp-content/uploads/new-brand-x.jpg"
}
}
}
}
Example Response
{
"success": true,
"brand_id": 3,
"message": "Brand created successfully."
}
Possible Errors
Code | Message | Description | HTTP Status |
---|---|---|---|
missing_name | Brand name is required. | No brand name was provided in the request. | 400 |
invalid_parent | The specified parent brand does not exist. | The provided parent ID does not correspond to an existing brand. | 400 |
term_creation_failed | [Error message from WordPress] | An error occurred while creating the brand term. | 500 |
not_authorized | Not Authorized | The provided Bearer token is invalid or does not match the configured token. | 401 |