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

# Upload a version

> Compiles source on the server against the view's slot version (the latest unless `slotVersion` is given) and stores it as the next immutable version, with its bundle digest. Refused with nothing stored when it does not compile or typecheck (`view_compile_failed`, with `details`), when the slot version does not exist, or when it declares a request the slot does not allow. Honors `Idempotency-Key`.



## OpenAPI

````yaml /openapi.json post /customization/views/{view}/versions
openapi: 3.0.3
info:
  title: Effective API
  version: 2.0.0
  description: The public Effective REST API. Authenticate using an Effective API key.
servers:
  - url: https://api.canary.effectiveai.app/api/v2
    description: Canary
security:
  - bearerAuth: []
paths:
  /customization/views/{view}/versions:
    post:
      tags:
        - Views
      summary: Upload a version
      description: >-
        Compiles source on the server against the view's slot version (the
        latest unless `slotVersion` is given) and stores it as the next
        immutable version, with its bundle digest. Refused with nothing stored
        when it does not compile or typecheck (`view_compile_failed`, with
        `details`), when the slot version does not exist, or when it declares a
        request the slot does not allow. Honors `Idempotency-Key`.
      operationId: createViewVersion
      parameters:
        - schema:
            type: string
            format: uuid
          required: true
          name: view
          in: path
        - schema:
            type: string
            minLength: 1
            maxLength: 255
          required: false
          name: idempotency-key
          in: header
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                files:
                  type: object
                  additionalProperties:
                    type: string
                    maxLength: 2097152
                entry:
                  type: string
                  minLength: 1
                  maxLength: 240
                requests:
                  type: array
                  items:
                    type: string
                    minLength: 1
                    maxLength: 300
                  maxItems: 50
                  default: []
                slotVersion:
                  type: integer
                  minimum: 0
                  exclusiveMinimum: true
              required:
                - files
                - entry
              additionalProperties: false
      responses:
        '201':
          description: The version, with its source.
          content:
            application/json:
              schema:
                type: object
                properties:
                  warnings:
                    type: array
                    items:
                      type: object
                      properties:
                        code:
                          type: string
                          enum:
                            - slot_version_deprecated
                        message:
                          type: string
                        sunsetAt:
                          type: string
                          nullable: true
                        replacedBy:
                          type: number
                          nullable: true
                      required:
                        - code
                        - message
                        - sunsetAt
                        - replacedBy
                  viewId:
                    type: string
                    format: uuid
                  version:
                    type: number
                  slotVersion:
                    type: number
                  digest:
                    type: string
                  requests:
                    type: array
                    items:
                      type: string
                  compilerRevision:
                    type: string
                  authorUserId:
                    type: string
                  createdAt:
                    type: string
                  source:
                    type: object
                    properties:
                      entry:
                        type: string
                      files:
                        type: object
                        additionalProperties:
                          type: string
                    required:
                      - entry
                      - files
                required:
                  - viewId
                  - version
                  - slotVersion
                  - digest
                  - requests
                  - compilerRevision
                  - authorUserId
                  - createdAt
        '400':
          description: The request is invalid.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                  details:
                    type: array
                    items:
                      type: object
                      properties:
                        location:
                          type: string
                          enum:
                            - body
                        path:
                          type: array
                          items:
                            type: string
                        code:
                          type: string
                          enum:
                            - invalid_value
                        message:
                          type: string
                      required:
                        - location
                        - path
                        - code
                        - message
                required:
                  - error
                  - code
        '403':
          description: >-
            The caller may not do this, or UI Modules are off for the
            organization.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                  details:
                    type: array
                    items:
                      type: object
                      properties:
                        location:
                          type: string
                          enum:
                            - body
                        path:
                          type: array
                          items:
                            type: string
                        code:
                          type: string
                          enum:
                            - invalid_value
                        message:
                          type: string
                      required:
                        - location
                        - path
                        - code
                        - message
                required:
                  - error
                  - code
        '404':
          description: Not found.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                  details:
                    type: array
                    items:
                      type: object
                      properties:
                        location:
                          type: string
                          enum:
                            - body
                        path:
                          type: array
                          items:
                            type: string
                        code:
                          type: string
                          enum:
                            - invalid_value
                        message:
                          type: string
                      required:
                        - location
                        - path
                        - code
                        - message
                required:
                  - error
                  - code
        '409':
          description: The key was used for another request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                  details:
                    type: array
                    items:
                      type: object
                      properties:
                        location:
                          type: string
                          enum:
                            - body
                        path:
                          type: array
                          items:
                            type: string
                        code:
                          type: string
                          enum:
                            - invalid_value
                        message:
                          type: string
                      required:
                        - location
                        - path
                        - code
                        - message
                required:
                  - error
                  - code
        '422':
          description: It does not compile, or declares a request the slot does not allow.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                  details:
                    type: array
                    items:
                      type: object
                      properties:
                        location:
                          type: string
                          enum:
                            - body
                        path:
                          type: array
                          items:
                            type: string
                        code:
                          type: string
                          enum:
                            - invalid_value
                        message:
                          type: string
                      required:
                        - location
                        - path
                        - code
                        - message
                required:
                  - error
                  - code
        '429':
          description: The compiler is busy.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                  details:
                    type: array
                    items:
                      type: object
                      properties:
                        location:
                          type: string
                          enum:
                            - body
                        path:
                          type: array
                          items:
                            type: string
                        code:
                          type: string
                          enum:
                            - invalid_value
                        message:
                          type: string
                      required:
                        - location
                        - path
                        - code
                        - message
                required:
                  - error
                  - code
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Effective API key. Send Authorization: Bearer sk-eai-...'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.