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

# Add a brand rule

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



## OpenAPI

````yaml /openapi.json post /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:
    post:
      summary: Add a brand rule
      description: >-
        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`.
      parameters:
        - name: brand
          in: query
          schema:
            type: string
          description: A brand's slug
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  properties:
                    key:
                      type: string
                      maxLength: 120
                      pattern: ^[a-z][a-zA-Z0-9]*(\.[a-z][a-zA-Z0-9]*)*$
                    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
                  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]*)*$
                    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
                  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]*)*$
                    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
                  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]*)*$
                    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]*)*$
                    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
                  required:
                    - key
                    - type
                    - value
                  additionalProperties: false
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    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)$
                      brand:
                        type: string
                        description: The brand's slug
                      key:
                        type: string
                        description: Dotted, e.g. color.primary
                      context:
                        description: 'null: the default'
                        type:
                          - string
                          - 'null'
                      type:
                        type: string
                        enum:
                          - color
                          - text
                          - number
                          - list
                          - font
                      value:
                        anyOf:
                          - type: string
                          - type: number
                          - type: array
                            items:
                              type:
                                - string
                                - number
                          - 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:
                        type:
                          - string
                          - 'null'
                      assets:
                        type: array
                        items:
                          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:
                              type:
                                - string
                                - 'null'
                            title:
                              type:
                                - string
                                - 'null'
                            filename:
                              type: string
                            mime:
                              type: string
                            width:
                              anyOf:
                                - type: integer
                                  minimum: -9007199254740991
                                  maximum: 9007199254740991
                                - type: 'null'
                            height:
                              anyOf:
                                - type: integer
                                  minimum: -9007199254740991
                                  maximum: 9007199254740991
                                - type: 'null'
                          required:
                            - id
                            - rendition
                            - title
                            - filename
                            - mime
                            - width
                            - height
                          additionalProperties: false
                        description: >-
                          Assets it points at, in order: /a/{id}, or
                          /a/{id}/{rendition} when it names one
                      updatedAt:
                        type: string
                        format: date-time
                        pattern: >-
                          ^(?:(?:\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)))$
                    required:
                      - id
                      - brand
                      - key
                      - context
                      - type
                      - value
                      - usage
                      - assets
                      - updatedAt
                    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

````