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

# Preview a proposed change

> A pull request's files as the brand's site, at a link that needs no account, and what they would change of the brand as it stands. Checked as an import is. One preview per `ref`: saving again keeps its link. It opens for 30 days after its last save.

Scope: `write`.



## OpenAPI

````yaml /openapi.json post /api/v1/brands/{slug}/previews
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/brands/{slug}/previews:
    parameters:
      - name: slug
        in: path
        required: true
        description: Brand slug
        schema:
          type: string
    post:
      summary: Preview a proposed change
      description: >-
        A pull request's files as the brand's site, at a link that needs no
        account, and what they would change of the brand as it stands. Checked
        as an import is. One preview per `ref`: saving again keeps its link. It
        opens for 30 days after its last save.


        Scope: `write`.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                ref:
                  type: string
                  minLength: 1
                  maxLength: 200
                  description: >-
                    What proposes it, as its host names it: pull/12. One preview
                    each; saving again updates it
                title:
                  type: string
                  maxLength: 300
                commit:
                  type: string
                  minLength: 1
                  maxLength: 100
                files:
                  type: object
                  propertyNames:
                    type: string
                    minLength: 1
                    maxLength: 300
                  additionalProperties:
                    type: string
                    maxLength: 2000000
                  description: >-
                    The brand's files by path in its folder: brand.yaml,
                    rules/*.yaml, pages/*.yaml. Others are left alone
                assets:
                  description: >-
                    The files under assets/ the brand's files point at: path to
                    asset id, or to the SHA-256 of its bytes (upload first)
                  type: object
                  propertyNames:
                    type: string
                    minLength: 1
                    maxLength: 300
                  additionalProperties:
                    type: string
                    maxLength: 64
              required:
                - ref
                - files
              additionalProperties: false
      responses:
        '200':
          description: The preview
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      brand:
                        type: string
                      ref:
                        type: string
                      url:
                        type: string
                        format: uri
                        description: The site as the files say it; no account needed
                      pages:
                        type: array
                        items:
                          type: object
                          properties:
                            slug:
                              type: string
                            title:
                              type: string
                            url:
                              type: string
                              format: uri
                          required:
                            - slug
                            - title
                            - url
                          additionalProperties: false
                      expiresAt:
                        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)))$
                      diff:
                        type: object
                        properties:
                          name:
                            anyOf:
                              - type: object
                                properties:
                                  before:
                                    type: string
                                  after:
                                    type: string
                                required:
                                  - before
                                  - after
                                additionalProperties: false
                              - type: 'null'
                          rules:
                            type: array
                            items:
                              type: object
                              properties:
                                change:
                                  type: string
                                  enum:
                                    - added
                                    - removed
                                    - changed
                                key:
                                  type: string
                                context:
                                  type:
                                    - string
                                    - 'null'
                                type:
                                  type: string
                                  enum:
                                    - color
                                    - text
                                    - number
                                    - list
                                    - font
                                before: {}
                                after: {}
                                fields:
                                  description: >-
                                    What changed: value, usage, label, spec,
                                    assets, type
                                  type: array
                                  items:
                                    type: string
                              required:
                                - change
                                - key
                                - context
                                - type
                              additionalProperties: false
                          pages:
                            type: array
                            items:
                              type: object
                              properties:
                                change:
                                  type: string
                                  enum:
                                    - added
                                    - removed
                                    - changed
                                    - moved
                                slug:
                                  type: string
                                title:
                                  type: string
                              required:
                                - change
                                - slug
                                - title
                              additionalProperties: false
                          theme:
                            type: array
                            items:
                              type: string
                            description: Theme settings changed
                          reordered:
                            type: boolean
                            description: The rules' order changed
                        required:
                          - name
                          - rules
                          - pages
                          - theme
                          - reordered
                        additionalProperties: false
                        description: What it would change of the brand as it stands
                      warnings:
                        type: array
                        items:
                          type: object
                          properties:
                            file:
                              type: string
                            line:
                              type: integer
                              minimum: -9007199254740991
                              maximum: 9007199254740991
                            message:
                              type: string
                          required:
                            - file
                            - message
                          additionalProperties: false
                    required:
                      - brand
                      - ref
                      - url
                      - pages
                      - expiresAt
                      - diff
                      - warnings
                    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

````