Skip to content

Set brand rules in one go

PATCH
/api/v1/brand/rules
curl --request PATCH \
--url http://localhost:3000/api/v1/brand/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "set": [ { "key": "example", "label": "example", "context": "example", "type": "color", "value": "example", "usage": "example", "assets": [ { "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "rendition": "example" } ], "spec": { "token": "example", "group": "example", "weight": 1, "pair": "example", "tints": [ 1 ], "cmyk": [ "example" ], "pantone": [ "example" ], "ral": "example", "rgb": [ "example" ], "print": "specified", "texture": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "gradient": { "kind": "linear", "angle": 1, "stops": [ { "color": "example", "at": 1, "opacity": 1 } ] } } } ], "remove": [ { "key": "example", "context": "example" } ] }'

The MCP tool set_rules. Each of set is made, or changes the rule with its key and context (its type can’t change: remove it first); each of remove goes, a key without a context with every context version. All or none, checked together, so a gradient and the colors it names can arrive at once: a 422 lists every problem with its path, e.g. set[0].spec: .... One change in the brand’s history.

Scope: write.

brand
string

A brand’s slug; the default brand when left out

Media typeapplication/json
object
set

Rules to make, or change where the key and context exist

Array
<= 100 items
One of:
object
key
required
string
<= 120 characters /^[a-z][a-zA-Z0-9]*(\.[a-z][a-zA-Z0-9]*)*$/
label
Any of:
string
>= 1 characters <= 120 characters
context
Any of:
string
<= 64 characters /^[a-z0-9]+(-[a-z0-9]+)*$/
type
required
string
Allowed value: color
value
required
string
/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/
usage
Any of:
string
<= 10000 characters
assets

Assets it points at, in order: an id, or { id, rendition }. Replaces the list

Array
<= 24 items
Any of:
string format: uuid
/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/
spec
Any of:
object
token

A scale name beside the brand name: Pink-500

string
<= 60 characters
group

Primary, Secondary, Neutrals: palettes group by it

string
<= 60 characters
weight

Its share of the brand’s color, for the proportion bar

number
<= 100
pair

The color set on it: text on this ground, or its light partner

string
<= 120 characters /^[a-z][a-zA-Z0-9]*(\.[a-z][a-zA-Z0-9]*)*$/
tints

Tint steps in percent: [80, 60, 40, 20]

Array<integer>
<= 12 items
cmyk
array
>= 4 items <= 4 items
pantone

Free codes, coated and uncoated: 485 C, 485 U

Array<string>
<= 4 items
ral
string
<= 20 characters
rgb

When the book states it rather than deriving it from the hex

array
>= 3 items <= 3 items
print

Whether the print values were given or converted

string
Allowed values: specified converted
texture

An image laid over the swatch

string format: uuid
/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/
gradient

Makes the rule a gradient; its value is the solid to use where a gradient can’t go

object
kind
string
Allowed values: linear radial conic
angle
number
<= 360
stops
required
Array<object>
>= 2 items <= 8 items
object
color
required
Any of:
string
<= 120 characters /^[a-z][a-zA-Z0-9]*(\.[a-z][a-zA-Z0-9]*)*$/
at
number
<= 100
opacity
number
<= 1
remove
Array<object>
<= 100 items
object
key
required
string
<= 120 characters /^[a-z][a-zA-Z0-9]*(\.[a-z][a-zA-Z0-9]*)*$/
context
Any of:
string
<= 64 characters /^[a-z0-9]+(-[a-z0-9]+)*$/

What changed, each as key (context)

Media typeapplication/json
object
data
required
object
brand
required
string
created
required
Array<string>
updated
required
Array<string>
removed
required
Array<string>
Examplegenerated
{
"data": {
"brand": "example",
"created": [
"example"
],
"updated": [
"example"
],
"removed": [
"example"
]
}
}

An error

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
detail
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"detail": "example"
}
}