Item Categories

Create an item category

Changed on

Create an item category

Required scopes: business/catalogue:read, business/catalogue:write

post/v1/item_categories/

Request

  • Base URL
    https://api.yoco.com
  • Auth
    HTTP bearer

Request body

namestring required

The name of the category. Leading and trailing whitespace is removed, and the name that remains must be 1 to 255 characters long, and unique among the business's categories.

descriptionstring nullable

A description of the category. Leading and trailing whitespace is removed, and the description that remains must be 1 to 255 characters long. Leave it out, or send null, for no description.

parent_category_idstring nullable

The unique identifier of the parent category. The parent must be another category of the business. Leave it out, or send null, for a category with no parent.

image_idstring nullable

The id of a media item uploaded with POST /v1/media/, shown as the image of the category. Leave it out, or send null, for a category with no image.

Example request

{
  "description": "A home for all our beverages.",
  "image_id": "1757533814961-58f649da-81e3-4877-8769-f407cfba8aff",
  "name": "Beverages",
  "parent_category_id": "1757511225824-ab79f3ee-5a21-4bca-a060-ef27d9aae788"
}

Response

Successful Response

idstring required

The unique identifier of the category.

namestring required

The name of the category.

descriptionstring nullable required

A description of the category.

created_atstring date-time required

The category creation date and time in ISO 8601 format.

updated_atstring date-time nullable required

The date and time the category was last modified in ISO 8601 format.

Example response

{
  "created_at": "2024-11-19T15:27:02+00:00",
  "description": "A home for all our tasty warm beverages.",
  "id": "1757511249593-dd25e17c-5541-4276-a078-8c3dcca296de",
  "image": {
    "created_at": "2024-11-19T15:27:02+00:00",
    "id": "1757533814961-58f649da-81e3-4877-8769-f407cfba8aff",
    "mime_type": "image/jpeg",
    "type": "image",
    "updated_at": "2024-11-19T16:27:23+00:00",
    "url": "https://images.yoco.com/foo/bar.jpg"
  },
  "name": "Hot Beverages",
  "parent_category": {
    "created_at": "2024-11-19T15:27:02+00:00",
    "description": "A home for all our beverages.",
    "id": "1757511225824-ab79f3ee-5a21-4bca-a060-ef27d9aae788",
    "image": {
      "created_at": "2024-11-19T15:27:02+00:00",
      "id": "1757533814961-58f649da-81e3-4877-8769-f407cfba8aff",
      "mime_type": "image/jpeg",
      "type": "image",
      "updated_at": "2024-11-19T16:27:23+00:00",
      "url": "https://images.yoco.com/foo/bar.jpg"
    },
    "name": "Beverages",
    "updated_at": "2024-11-19T16:27:23+00:00"
  },
  "updated_at": "2024-11-19T16:27:23+00:00"
}

Changes