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

# Publish pending dimension changes

> Promotes pending dimension changes: the label configuration supplied inline in `labels`, and every pending virtual-dimension draft in the organization. `scope` narrows the publish to labels or virtual dimensions only.

Each draft is validated on its own and the valid set is promoted atomically. A `200` therefore does not mean everything was published: `unpublished[]` lists the drafts that failed validation, with per-draft error messages, while `publishedLabels` and `publishedVdimIds` report what did go live. A `400` means the request as a whole was rejected and nothing was promoted.

A successful publish enqueues an asynchronous BigQuery refresh (a full feature-engineering refresh when labels changed, a lighter update otherwise), so newly published dimensions are not immediately queryable.



## OpenAPI

````yaml /api-reference/openapi.json post /dimensions/publish
openapi: 3.0.0
info:
  title: Costory
  version: '1.0'
  description: API Documentation
servers:
  - url: ''
    description: Production server
security: []
paths:
  /dimensions/publish:
    post:
      tags:
        - Dimensions
      summary: Publish pending dimension changes
      description: >-
        Promotes pending dimension changes: the label configuration supplied
        inline in `labels`, and every pending virtual-dimension draft in the
        organization. `scope` narrows the publish to labels or virtual
        dimensions only.


        Each draft is validated on its own and the valid set is promoted
        atomically. A `200` therefore does not mean everything was published:
        `unpublished[]` lists the drafts that failed validation, with per-draft
        error messages, while `publishedLabels` and `publishedVdimIds` report
        what did go live. A `400` means the request as a whole was rejected and
        nothing was promoted.


        A successful publish enqueues an asynchronous BigQuery refresh (a full
        feature-engineering refresh when labels changed, a lighter update
        otherwise), so newly published dimensions are not immediately queryable.
      operationId: publishDimensions
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                scope:
                  type: string
                  enum:
                    - all
                    - labels
                    - vdims
                  default: all
                labels:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                        minLength: 1
                      name:
                        type: string
                        pattern: ^[A-Za-z_][A-Za-z0-9_]{0,299}$
                      columnsMerged:
                        type: array
                        items:
                          type: object
                          properties:
                            name:
                              type: string
                            type:
                              type: string
                              enum:
                                - label
                                - focus
                            ingested:
                              type: boolean
                          required:
                            - name
                            - type
                      maps:
                        type: array
                        items:
                          type: object
                          properties:
                            value:
                              type: string
                            to:
                              type: string
                          required:
                            - value
                            - to
                      category:
                        type: string
                        enum:
                          - environment
                          - boolean_flag
                          - team
                          - cost_significant
                    required:
                      - name
                      - columnsMerged
                      - maps
            example:
              scope: all
              labels:
                - name: environment
                  columnsMerged:
                    - name: env
                      type: label
                    - name: Environment
                      type: label
                  maps:
                    - value: prd
                      to: production
      responses:
        '200':
          description: Publish completed; `unpublished` may still list per-draft failures
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublishDimensionsSuccess'
        '400':
          description: Nothing was published
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublishDimensionsFailure'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Unauthorized'
      security:
        - bearerAuth: []
components:
  schemas:
    PublishDimensionsSuccess:
      type: object
      properties:
        ok:
          type: boolean
          enum:
            - true
        publishedLabels:
          type: boolean
        publishedVdimIds:
          type: array
          items:
            type: string
        unpublished:
          type: array
          items:
            oneOf:
              - type: object
                properties:
                  kind:
                    type: string
                    enum:
                      - label
                  errors:
                    type: array
                    items:
                      oneOf:
                        - type: object
                          properties:
                            kind:
                              type: string
                              enum:
                                - label
                            message:
                              type: string
                          required:
                            - kind
                            - message
                        - type: object
                          properties:
                            kind:
                              type: string
                              enum:
                                - vdim
                            vdimId:
                              type: string
                            vdimName:
                              type: string
                            message:
                              type: string
                          required:
                            - kind
                            - vdimId
                            - vdimName
                            - message
                      discriminator:
                        propertyName: kind
                required:
                  - kind
                  - errors
              - type: object
                properties:
                  kind:
                    type: string
                    enum:
                      - vdim
                  vdimId:
                    type: string
                  vdimName:
                    type: string
                  errors:
                    type: array
                    items:
                      oneOf:
                        - type: object
                          properties:
                            kind:
                              type: string
                              enum:
                                - label
                            message:
                              type: string
                          required:
                            - kind
                            - message
                        - type: object
                          properties:
                            kind:
                              type: string
                              enum:
                                - vdim
                            vdimId:
                              type: string
                            vdimName:
                              type: string
                            message:
                              type: string
                          required:
                            - kind
                            - vdimId
                            - vdimName
                            - message
                      discriminator:
                        propertyName: kind
                required:
                  - kind
                  - vdimId
                  - vdimName
                  - errors
            discriminator:
              propertyName: kind
      required:
        - ok
        - publishedLabels
        - publishedVdimIds
        - unpublished
    PublishDimensionsFailure:
      type: object
      properties:
        ok:
          type: boolean
          enum:
            - false
        errors:
          type: array
          items:
            oneOf:
              - type: object
                properties:
                  kind:
                    type: string
                    enum:
                      - label
                  message:
                    type: string
                required:
                  - kind
                  - message
              - type: object
                properties:
                  kind:
                    type: string
                    enum:
                      - vdim
                  vdimId:
                    type: string
                  vdimName:
                    type: string
                  message:
                    type: string
                required:
                  - kind
                  - vdimId
                  - vdimName
                  - message
            discriminator:
              propertyName: kind
      required:
        - ok
        - errors
    Unauthorized:
      type: object
      properties:
        error:
          type: string
          description: Unauthorized error message
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT or Clerk ak_* API key
      description: >-
        Send `Authorization: Bearer <credential>` using either a Clerk session
        JWT or a Clerk API key (`ak_*`). API keys may identify a user (`user_*`)
        or organization (`org_*`) principal and are generated in the Clerk
        Dashboard under API keys.

````