Skip to content

Create a shop category

POST
/categories
curl --request POST \
--url https://example.com/categories \
--header 'Content-Type: application/json' \
--cookie bottle.session_token=<bottle.session_token> \
--data '{ "name": "example", "slug": "example", "description": "example", "imageDataUrl": "example", "sortOrder": 1 }'

The address (slug) is made from the name unless one is given, with a number added when it is already used in this business. Goes last in the order unless sortOrder says otherwise. A tile picture can be sent as a data URL; it is kept with sizes made for the shop.

Media typeapplication/json
object
name
required
string
>= 1 characters <= 80 characters
slug

Left out, made from the name. A number is added when it is taken.

string
<= 60 characters /^[\da-z]+(?:-[\da-z]+)*$/
description
string | null
<= 2000 characters
imageDataUrl

A tile picture as a data URL (JPEG, PNG, WebP, AVIF or GIF, up to 15 MB). On an update, null takes the picture away.

string | null
<= 21000000 characters /^data:image\/(png|jpeg|webp|avif|gif);base64,/
sortOrder
integer
<= 10000
Examplegenerated
{
"name": "example",
"slug": "example",
"description": "example",
"imageDataUrl": "example",
"sortOrder": 1
}

Created

Media typeapplication/json
object
id
required

UUID v7

string format: uuid
name
required
string
slug
required

In the shop’s address: /c/bottled-gas. Unique within the business.

string
description
required
string | null
imageKey
required
string | null
image
required

The tile picture at three sizes, WebP. Null when there is none.

object
thumb
required
string
card
required
string
large
required
string
sortOrder
required
integer
productCount
required
integer
archivedAt
required
string | null format: date-time
createdAt
required
string format: date-time
updatedAt
required
string format: date-time
Example
{
"id": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f",
"name": "Bottled gas",
"slug": "bottled-gas"
}

Not signed in

Media typeapplication/json
object
error
required
string
message
required
string
Example
{
"error": "not_found",
"message": "Customer not found"
}

Not a member, or without the permission this needs

Media typeapplication/json
object
error
required
string
message
required
string
Example
{
"error": "not_found",
"message": "Customer not found"
}

The slug asked for is already used in this business

Media typeapplication/json
object
error
required
string
message
required
string
Example
{
"error": "not_found",
"message": "Customer not found"
}

Validation failed, or the picture is not one Bottle takes

Media typeapplication/json
object
error
required
string
Allowed values: validation
message
required
string
issues
required
Array<object>
object
path
required
string
message
required
string
Example
{
"error": "validation",
"issues": [
{
"path": "email",
"message": "Invalid email"
}
]
}