Skip to content

Add a brand rule

POST
/api/v1/brand/rules
curl --request POST \
--url http://localhost:3000/api/v1/brand/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "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 } ] } } }'

One per key and context; 409 when it exists. value must match type. ?brand= picks the brand; the default otherwise. Every change to rules lands in the brand’s history.

Scope: write.

brand
string

A brand’s slug

Media typeapplication/json
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

Created

Media typeapplication/json
object
data
required
object
id
required
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)$/
brand
required

The brand’s slug

string
key
required

Dotted, e.g. color.primary

string
label
required

The heading readers see; null: the key, in words

string | null
context
required

Null: the default

string | null
type
required
string
Allowed values: color text number list font
value
required
Any of:
string
spec
required
Any of:
object
key
additional properties
usage
required
string | null
assets
required

Assets it points at, in order: /a/{id}, or /a/{id}/{rendition} when it names one

Array<object>
object
id
required
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)$/
rendition
required
string | null
title
required
string | null
filename
required
string
mime
required
string
width
required
Any of:
integer
>= -9007199254740991 <= 9007199254740991
height
required
Any of:
integer
>= -9007199254740991 <= 9007199254740991
updatedAt
required
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$/
Example
{
"data": {
"type": "color"
}
}

An error

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