> ## Documentation Index
> Fetch the complete documentation index at: https://docs.artbucket.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Set brand rules in one go

> 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`.



## OpenAPI

````yaml /openapi.json patch /api/v1/brand/rules
openapi: 3.1.0
info:
  title: artbucket
  version: '1'
  description: >-
    Agent-first asset management. The web UI is built on this API and nothing
    else, beside signing in at /api/auth. Send `Authorization: Bearer <key>`: a
    key works in one workspace with one scope, and scopes are a ladder: read <
    propose < write < admin. People signed in to the app carry a session cookie
    instead, and their scope is what their grants add up to: on the
    organization, the workspace, or single collections and assets. A scope shown
    as needed on the workspace is also enough on the one collection or asset a
    route acts on. Agents (MCP at POST /api/v1/mcp) usually get `propose`: what
    they add waits for a human.
servers:
  - url: http://localhost:3000
security:
  - bearer: []
  - session: []
  - {}
paths:
  /api/v1/brand/rules:
    patch:
      summary: Set brand rules in one go
      description: >-
        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`.
      parameters:
        - name: brand
          in: query
          schema:
            type: string
          description: A brand's slug; the default brand when left out
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                set:
                  description: Rules to make, or change where the key and context exist
                  maxItems: 100
                  type: array
                  items:
                    oneOf:
                      - type: object
                        properties:
                          key:
                            type: string
                            maxLength: 120
                            pattern: ^[a-z][a-zA-Z0-9]*(\.[a-z][a-zA-Z0-9]*)*$
                          label:
                            description: >-
                              The heading readers see; from the key when left
                              out
                            anyOf:
                              - type: string
                                minLength: 1
                                maxLength: 120
                              - type: 'null'
                          context:
                            description: Only in this context; omit for the default
                            anyOf:
                              - type: string
                                maxLength: 64
                                pattern: ^[a-z0-9]+(-[a-z0-9]+)*$
                              - type: 'null'
                          type:
                            type: string
                            const: color
                          value:
                            type: string
                            pattern: ^#([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$
                          usage:
                            description: How and when to use it, in Markdown (GFM)
                            anyOf:
                              - type: string
                                maxLength: 10000
                              - type: 'null'
                          assets:
                            description: >-
                              Assets it points at, in order: an id, or { id,
                              rendition }. Replaces the list
                            maxItems: 24
                            type: array
                            items:
                              anyOf:
                                - type: string
                                  format: uuid
                                  pattern: >-
                                    ^([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)$
                                - type: object
                                  properties:
                                    id:
                                      type: string
                                      format: uuid
                                      pattern: >-
                                        ^([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:
                                      anyOf:
                                        - description: >-
                                            A rendition spec, e.g. w_512,f_png; null
                                            for the original
                                          type: string
                                          maxLength: 120
                                        - type: 'null'
                                  required:
                                    - id
                          spec:
                            description: Details beyond the value; null clears
                            anyOf:
                              - type: object
                                properties:
                                  token:
                                    description: >-
                                      A scale name beside the brand name:
                                      Pink-500
                                    type: string
                                    maxLength: 60
                                  group:
                                    description: >-
                                      Primary, Secondary, Neutrals: palettes
                                      group by it
                                    type: string
                                    maxLength: 60
                                  weight:
                                    description: >-
                                      Its share of the brand's color, for the
                                      proportion bar
                                    type: number
                                    minimum: 0
                                    maximum: 100
                                  pair:
                                    description: >-
                                      The color set on it: text on this ground,
                                      or its light partner
                                    type: string
                                    maxLength: 120
                                    pattern: ^[a-z][a-zA-Z0-9]*(\.[a-z][a-zA-Z0-9]*)*$
                                  tints:
                                    description: 'Tint steps in percent: [80, 60, 40, 20]'
                                    maxItems: 12
                                    type: array
                                    items:
                                      type: integer
                                      minimum: 1
                                      maximum: 99
                                  cmyk:
                                    type: array
                                    prefixItems:
                                      - type: number
                                        minimum: 0
                                        maximum: 100
                                      - type: number
                                        minimum: 0
                                        maximum: 100
                                      - type: number
                                        minimum: 0
                                        maximum: 100
                                      - type: number
                                        minimum: 0
                                        maximum: 100
                                    items: false
                                    minItems: 4
                                    maxItems: 4
                                  pantone:
                                    description: >-
                                      Free codes, coated and uncoated: 485 C,
                                      485 U
                                    maxItems: 4
                                    type: array
                                    items:
                                      type: string
                                      minLength: 1
                                      maxLength: 40
                                  ral:
                                    type: string
                                    maxLength: 20
                                  rgb:
                                    description: >-
                                      When the book states it rather than
                                      deriving it from the hex
                                    type: array
                                    prefixItems:
                                      - type: integer
                                        minimum: 0
                                        maximum: 255
                                      - type: integer
                                        minimum: 0
                                        maximum: 255
                                      - type: integer
                                        minimum: 0
                                        maximum: 255
                                    items: false
                                    minItems: 3
                                    maxItems: 3
                                  print:
                                    description: >-
                                      Whether the print values were given or
                                      converted
                                    type: string
                                    enum:
                                      - specified
                                      - converted
                                  texture:
                                    description: An image laid over the swatch
                                    type: string
                                    format: uuid
                                    pattern: >-
                                      ^([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:
                                    description: >-
                                      Makes the rule a gradient; its value is
                                      the solid to use where a gradient can't go
                                    type: object
                                    properties:
                                      kind:
                                        type: string
                                        enum:
                                          - linear
                                          - radial
                                          - conic
                                      angle:
                                        type: number
                                        minimum: 0
                                        maximum: 360
                                      stops:
                                        minItems: 2
                                        maxItems: 8
                                        type: array
                                        items:
                                          type: object
                                          properties:
                                            color:
                                              anyOf:
                                                - type: string
                                                  maxLength: 120
                                                  pattern: >-
                                                    ^[a-z][a-zA-Z0-9]*(\.[a-z][a-zA-Z0-9]*)*$
                                                - type: string
                                                  pattern: ^#([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$
                                              description: A color rule's key, or a hex
                                            at:
                                              type: number
                                              minimum: 0
                                              maximum: 100
                                            opacity:
                                              type: number
                                              minimum: 0
                                              maximum: 1
                                          required:
                                            - color
                                          additionalProperties: false
                                    required:
                                      - stops
                                    additionalProperties: false
                                additionalProperties: false
                              - type: 'null'
                        required:
                          - key
                          - type
                          - value
                        additionalProperties: false
                      - type: object
                        properties:
                          key:
                            type: string
                            maxLength: 120
                            pattern: ^[a-z][a-zA-Z0-9]*(\.[a-z][a-zA-Z0-9]*)*$
                          label:
                            description: >-
                              The heading readers see; from the key when left
                              out
                            anyOf:
                              - type: string
                                minLength: 1
                                maxLength: 120
                              - type: 'null'
                          context:
                            description: Only in this context; omit for the default
                            anyOf:
                              - type: string
                                maxLength: 64
                                pattern: ^[a-z0-9]+(-[a-z0-9]+)*$
                              - type: 'null'
                          type:
                            type: string
                            const: text
                          value:
                            type: string
                            minLength: 1
                            maxLength: 20000
                            description: Markdown (GFM)
                          usage:
                            description: How and when to use it, in Markdown (GFM)
                            anyOf:
                              - type: string
                                maxLength: 10000
                              - type: 'null'
                          assets:
                            description: >-
                              Assets it points at, in order: an id, or { id,
                              rendition }. Replaces the list
                            maxItems: 24
                            type: array
                            items:
                              anyOf:
                                - type: string
                                  format: uuid
                                  pattern: >-
                                    ^([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)$
                                - type: object
                                  properties:
                                    id:
                                      type: string
                                      format: uuid
                                      pattern: >-
                                        ^([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:
                                      anyOf:
                                        - description: >-
                                            A rendition spec, e.g. w_512,f_png; null
                                            for the original
                                          type: string
                                          maxLength: 120
                                        - type: 'null'
                                  required:
                                    - id
                          spec:
                            description: Details beyond the value; null clears
                            anyOf:
                              - type: object
                                properties:
                                  copy:
                                    description: 'Readers paste it as it is: a copy button'
                                    type: boolean
                                  max:
                                    description: >-
                                      The most characters it may take where it
                                      goes: 30 for a subtitle
                                    type: integer
                                    minimum: 1
                                    maximum: 20000
                                additionalProperties: false
                              - type: 'null'
                        required:
                          - key
                          - type
                          - value
                        additionalProperties: false
                      - type: object
                        properties:
                          key:
                            type: string
                            maxLength: 120
                            pattern: ^[a-z][a-zA-Z0-9]*(\.[a-z][a-zA-Z0-9]*)*$
                          label:
                            description: >-
                              The heading readers see; from the key when left
                              out
                            anyOf:
                              - type: string
                                minLength: 1
                                maxLength: 120
                              - type: 'null'
                          context:
                            description: Only in this context; omit for the default
                            anyOf:
                              - type: string
                                maxLength: 64
                                pattern: ^[a-z0-9]+(-[a-z0-9]+)*$
                              - type: 'null'
                          type:
                            type: string
                            const: number
                          value:
                            type: number
                          usage:
                            description: How and when to use it, in Markdown (GFM)
                            anyOf:
                              - type: string
                                maxLength: 10000
                              - type: 'null'
                          assets:
                            description: >-
                              Assets it points at, in order: an id, or { id,
                              rendition }. Replaces the list
                            maxItems: 24
                            type: array
                            items:
                              anyOf:
                                - type: string
                                  format: uuid
                                  pattern: >-
                                    ^([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)$
                                - type: object
                                  properties:
                                    id:
                                      type: string
                                      format: uuid
                                      pattern: >-
                                        ^([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:
                                      anyOf:
                                        - description: >-
                                            A rendition spec, e.g. w_512,f_png; null
                                            for the original
                                          type: string
                                          maxLength: 120
                                        - type: 'null'
                                  required:
                                    - id
                          spec:
                            description: Details beyond the value; null clears
                            anyOf:
                              - type: object
                                properties:
                                  unit:
                                    type: string
                                    enum:
                                      - px
                                      - pt
                                      - mm
                                      - cm
                                      - in
                                      - '%'
                                      - em
                                      - rem
                                      - x
                                      - ms
                                  of:
                                    description: 'What x or % is of: the mark''s height'
                                    type: string
                                    maxLength: 80
                                additionalProperties: false
                              - type: 'null'
                        required:
                          - key
                          - type
                          - value
                        additionalProperties: false
                      - type: object
                        properties:
                          key:
                            type: string
                            maxLength: 120
                            pattern: ^[a-z][a-zA-Z0-9]*(\.[a-z][a-zA-Z0-9]*)*$
                          label:
                            description: >-
                              The heading readers see; from the key when left
                              out
                            anyOf:
                              - type: string
                                minLength: 1
                                maxLength: 120
                              - type: 'null'
                          context:
                            description: Only in this context; omit for the default
                            anyOf:
                              - type: string
                                maxLength: 64
                                pattern: ^[a-z0-9]+(-[a-z0-9]+)*$
                              - type: 'null'
                          type:
                            type: string
                            const: list
                          value:
                            minItems: 1
                            maxItems: 100
                            type: array
                            items:
                              anyOf:
                                - type: string
                                  minLength: 1
                                  maxLength: 500
                                - type: number
                          usage:
                            description: How and when to use it, in Markdown (GFM)
                            anyOf:
                              - type: string
                                maxLength: 10000
                              - type: 'null'
                          assets:
                            description: >-
                              Assets it points at, in order: an id, or { id,
                              rendition }. Replaces the list
                            maxItems: 24
                            type: array
                            items:
                              anyOf:
                                - type: string
                                  format: uuid
                                  pattern: >-
                                    ^([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)$
                                - type: object
                                  properties:
                                    id:
                                      type: string
                                      format: uuid
                                      pattern: >-
                                        ^([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:
                                      anyOf:
                                        - description: >-
                                            A rendition spec, e.g. w_512,f_png; null
                                            for the original
                                          type: string
                                          maxLength: 120
                                        - type: 'null'
                                  required:
                                    - id
                        required:
                          - key
                          - type
                          - value
                        additionalProperties: false
                      - type: object
                        properties:
                          key:
                            type: string
                            maxLength: 120
                            pattern: ^[a-z][a-zA-Z0-9]*(\.[a-z][a-zA-Z0-9]*)*$
                          label:
                            description: >-
                              The heading readers see; from the key when left
                              out
                            anyOf:
                              - type: string
                                minLength: 1
                                maxLength: 120
                              - type: 'null'
                          context:
                            description: Only in this context; omit for the default
                            anyOf:
                              - type: string
                                maxLength: 64
                                pattern: ^[a-z0-9]+(-[a-z0-9]+)*$
                              - type: 'null'
                          type:
                            type: string
                            const: font
                          value:
                            anyOf:
                              - type: string
                                minLength: 1
                                maxLength: 120
                              - type: object
                                properties:
                                  family:
                                    type: string
                                    minLength: 1
                                    maxLength: 120
                                  size:
                                    description: Pixels
                                    type: number
                                    exclusiveMinimum: 0
                                    maximum: 1000
                                  weight:
                                    description: 400 regular, 700 bold
                                    type: integer
                                    minimum: 1
                                    maximum: 1000
                                required:
                                  - family
                                additionalProperties: false
                          usage:
                            description: How and when to use it, in Markdown (GFM)
                            anyOf:
                              - type: string
                                maxLength: 10000
                              - type: 'null'
                          assets:
                            description: >-
                              Assets it points at, in order: an id, or { id,
                              rendition }. Replaces the list
                            maxItems: 24
                            type: array
                            items:
                              anyOf:
                                - type: string
                                  format: uuid
                                  pattern: >-
                                    ^([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)$
                                - type: object
                                  properties:
                                    id:
                                      type: string
                                      format: uuid
                                      pattern: >-
                                        ^([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:
                                      anyOf:
                                        - description: >-
                                            A rendition spec, e.g. w_512,f_png; null
                                            for the original
                                          type: string
                                          maxLength: 120
                                        - type: 'null'
                                  required:
                                    - id
                          spec:
                            description: Details beyond the value; null clears
                            anyOf:
                              - type: object
                                properties:
                                  role:
                                    type: string
                                    enum:
                                      - display
                                      - headline
                                      - subhead
                                      - body
                                      - label
                                      - button
                                      - caption
                                      - code
                                  lineHeight:
                                    type: number
                                    minimum: 0.5
                                    maximum: 3
                                  tracking:
                                    description: In em, or [size, em] pairs by size
                                    anyOf:
                                      - type: number
                                        minimum: -0.2
                                        maximum: 1
                                      - maxItems: 12
                                        type: array
                                        items:
                                          type: array
                                          prefixItems:
                                            - type: number
                                              exclusiveMinimum: 0
                                            - type: number
                                              minimum: -0.2
                                              maximum: 1
                                          items: false
                                          minItems: 2
                                          maxItems: 2
                                  case:
                                    type: string
                                    enum:
                                      - none
                                      - upper
                                      - lower
                                      - title
                                      - small-caps
                                  script:
                                    description: 'ISO 15924: Latn, Arab'
                                    type: string
                                    pattern: ^[A-Z][a-z]{3}$
                                  features:
                                    description: 'OpenType features on: ss01, tnum'
                                    maxItems: 20
                                    type: array
                                    items:
                                      type: string
                                      pattern: ^[a-z0-9]{4}$
                                  source:
                                    type: string
                                    enum:
                                      - files
                                      - google
                                      - adobe
                                      - system
                                      - other
                                  url:
                                    description: >-
                                      Where the family comes from, or its
                                      license
                                    type: string
                                    maxLength: 500
                                    format: uri
                                  license:
                                    type: string
                                    maxLength: 300
                                  fallback:
                                    description: 'A CSS stack: Georgia, serif'
                                    type: string
                                    maxLength: 200
                                  download:
                                    description: >-
                                      false: readers see the face but get no
                                      files
                                    type: boolean
                                additionalProperties: false
                              - type: 'null'
                        required:
                          - key
                          - type
                          - value
                        additionalProperties: false
                remove:
                  maxItems: 100
                  type: array
                  items:
                    type: object
                    properties:
                      key:
                        type: string
                        maxLength: 120
                        pattern: ^[a-z][a-zA-Z0-9]*(\.[a-z][a-zA-Z0-9]*)*$
                      context:
                        description: >-
                          Only this context's version; the key and every version
                          when left out
                        anyOf:
                          - type: string
                            maxLength: 64
                            pattern: ^[a-z0-9]+(-[a-z0-9]+)*$
                          - type: 'null'
                    required:
                      - key
                    additionalProperties: false
              additionalProperties: false
      responses:
        '200':
          description: What changed, each as key (context)
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      brand:
                        type: string
                      created:
                        type: array
                        items:
                          type: string
                      updated:
                        type: array
                        items:
                          type: string
                      removed:
                        type: array
                        items:
                          type: string
                    required:
                      - brand
                      - created
                      - updated
                      - removed
                    additionalProperties: false
                required:
                  - data
                additionalProperties: false
        default:
          description: An error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      detail: {}
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
components:
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: 'An API key: ab_...'
    session:
      type: apiKey
      in: cookie
      name: better-auth.session_token
      description: Signed in, at /api/auth

````