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

# Commit

> Commit and push session changes, then build and snapshot in the background.

`commit` regenerates types, commits and pushes, then **builds and snapshots in the background** — the
returned `changedApps` report `buildStatus: "building"`. Poll
[`GET /apps/{appId}`](/build-api/workspaces/get-app) until the build is `success`, then
[publish](/build-api/deployments/publish-deployment).

<Note>
  If the workspace has newer commits than your session, `commit` returns `CONFLICT`. Pull and rebase
  inside the session ([`POST /bash`](/build-api/sessions/run-command) with `git pull --rebase origin main`),
  resolve, and commit again.
</Note>


## OpenAPI

````yaml build-api/openapi.json POST /sessions/{sessionId}/commit
openapi: 3.0.1
info:
  title: Zite Build API
  description: >-
    Create, build, and deploy Zite apps programmatically — the REST equivalent
    of the Zite MCP build tools. Use it from a script, a CI pipeline, or your
    own agent.


    ## Authentication


    All requests require a Bearer API key from your Developer settings:

    ```

    Authorization: Bearer YOUR_API_KEY

    ```

    The key acts as you — it can only see and change workspaces you have access
    to, and every change is attributed to you.


    ## Base URL


    https://api.zite.com/v1


    ## Errors


    Errors return `{ "statusCode": 404, "error": "Not Found", "message":
    "Workspace not found" }`. Notable statuses: `401` (bad or missing key),
    `402` (the build tools aren't in your plan), `404`, `409` (a commit push
    conflict — pull, rebase, and commit again), and `400` for validation
    failures and publishing before a build is green.
  version: 1.0.0
servers:
  - url: https://api.zite.com/v1
    description: Zite Build API
security:
  - bearerAuth: []
tags:
  - name: Workspaces
    description: Create workspaces and inspect the apps in them.
  - name: Build sessions
    description: >-
      Open an isolated checkout of a workspace, create apps, edit files, check,
      and commit.
  - name: Deployments
    description: Publish built apps, manage versions, roll back, and read runtime logs.
paths:
  /sessions/{sessionId}/commit:
    post:
      tags:
        - Build sessions
      summary: Commit
      description: >-
        Regenerates types, commits and pushes, then builds and snapshots in the
        background — the returned `changedApps` report `buildStatus:
        "building"`. Poll `GET /apps/{appId}` until the build is `success`, then
        publish. If the workspace has newer commits than your session, `commit`
        returns `CONFLICT` — pull and rebase inside the session, resolve, and
        commit again.
      operationId: commitSession
      parameters:
        - $ref: '#/components/parameters/SessionId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - message
              properties:
                message:
                  type: string
                  description: Commit message.
                  example: Add ticket list endpoint and UI
            example:
              message: Add ticket list endpoint and UI
      responses:
        '200':
          description: The commit and the apps it changed
          content:
            application/json:
              schema:
                type: object
                properties:
                  commitSha:
                    type: string
                    nullable: true
                    description: Null when there was nothing to commit.
                  changedApps:
                    type: array
                    description: >-
                      Apps the commit touched. Each starts a background build —
                      poll `GET /apps/{appId}` until `buildStatus` is `success`.
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        name:
                          type: string
                        buildStatus:
                          $ref: '#/components/schemas/BuildStatus'
                  workspaceId:
                    type: string
              example:
                commitSha: 3c24814
                changedApps:
                  - id: app_a1b2c3
                    name: Agent console
                    buildStatus: building
                    editorUrl: https://app.zite.com/editor/zite/app_a1b2c3
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
components:
  parameters:
    SessionId:
      name: sessionId
      in: path
      required: true
      description: The build session ID from Open a session.
      schema:
        type: string
      example: ses_9f2a1c7b40e8
  schemas:
    BuildStatus:
      type: string
      enum:
        - none
        - building
        - success
        - failure
      description: >-
        The state of the app's most recent build. `none` means the app has never
        been built.
    Error:
      type: object
      properties:
        statusCode:
          type: integer
          example: 404
        error:
          type: string
          example: Not Found
        message:
          type: string
          example: Workspace not found
  responses:
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: UNAUTHORIZED
              message: Missing or invalid API key.
    NotFound:
      description: The resource does not exist or your key cannot access it.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: NOT_FOUND
              message: Workspace not found.
    Conflict:
      description: The workspace has newer commits than your session.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: CONFLICT
              message: >-
                The workspace has newer commits. Pull and rebase inside the
                session, then commit again.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Enter your Zite API key. Format: Bearer <api_key>'

````