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

# Download a site's code project as a zip

> Streams the site's code project as the zip it would build from: a site you brought as a finished bundle gives back its newest staged revision (the platform's own `bundle.json` left out and its migration relocation undone, so the zip re-imports as it is); a site built here gives back its current source tree. The bytes are built on the way out and never stored, auth is re-checked on every call, and the zip is deterministic for a given revision. `X-Goosy-Export-Ref` names the revision or source ref the zip is byte-identical to. The site's database, storage, media and data tables are not part of the code project and are not in the zip. Pulling a site's code is recorded on the audit ledger and is not metered.



## OpenAPI

````yaml /openapi.json get /api/pages/{siteId}/export
openapi: 3.1.0
info:
  title: Goosy Bear API
  version: 1.0.0-beta
  summary: Manage workspace content, projects, Data tables, Pages, library and credits.
  description: >-
    BETA. This API is in beta: paths, request shapes and response envelopes may
    change, and every response carries an `x-goosy-api: beta` header for as long
    as that is true. Pin the OpenAPI document you generated against and
    re-generate when it changes.
servers:
  - url: https://app.goosybear.ai
    description: Production
security:
  - tenantApiKey: []
paths:
  /api/pages/{siteId}/export:
    get:
      tags:
        - pages
      summary: Download a site's code project as a zip
      description: >-
        Streams the site's code project as the zip it would build from: a site
        you brought as a finished bundle gives back its newest staged revision
        (the platform's own `bundle.json` left out and its migration relocation
        undone, so the zip re-imports as it is); a site built here gives back
        its current source tree. The bytes are built on the way out and never
        stored, auth is re-checked on every call, and the zip is deterministic
        for a given revision. `X-Goosy-Export-Ref` names the revision or source
        ref the zip is byte-identical to. The site's database, storage, media
        and data tables are not part of the code project and are not in the zip.
        Pulling a site's code is recorded on the audit ledger and is not
        metered.
      operationId: exportPageProject
      parameters:
        - name: siteId
          in: path
          required: true
          description: The UUID of a site in the resolved workspace.
          schema:
            type: string
            format: uuid
        - name: workspace
          in: query
          required: false
          description: >-
            Which workspace to act in — its slug or id. The SAME argument every
            workspace-scoped tool takes, resolved the same way: an account-wide
            key may select any workspace its holder currently reaches, a
            workspace-pinned key may only name its own, and a call that names
            nothing falls through to your default. It is a QUERY parameter
            rather than a body field on purpose: this endpoint's body is a
            multipart upload, and reading a field out of it would decode that
            body before the bearer and the rate limiter had run.
          schema:
            type: string
            minLength: 1
      responses:
        '200':
          description: >-
            The zip. `Content-Disposition: attachment;
            filename="<site>-<ref>.zip"`, `X-Goosy-Export-Kind` (`managed` or
            `bundle`) and `X-Goosy-Export-Ref` (the ref the zip is
            byte-identical to).
          headers:
            x-goosy-api:
              description: Present while this API is in beta; the value is `beta`.
              schema:
                type: string
                const: beta
            X-Goosy-Export-Kind:
              description: >-
                `managed` — the current source tree; `bundle` — the newest
                staged revision.
              schema:
                type: string
                enum:
                  - managed
                  - bundle
            X-Goosy-Export-Ref:
              description: >-
                The source ref or revision this zip re-imports to, byte for
                byte.
              schema:
                type: string
          content:
            application/zip:
              schema:
                type: string
                format: binary
        '401':
          description: No bearer credential, or one that did not resolve.
          headers:
            x-goosy-api:
              description: Present while this API is in beta; the value is `beta`.
              schema:
                type: string
                const: beta
          content:
            text/plain:
              schema:
                type: string
        '403':
          description: >-
            Programmatic access is unavailable to this holder, the named
            workspace is outside the key's scope, or the holder lacks
            `pages.manage`.
          headers:
            x-goosy-api:
              description: Present while this API is in beta; the value is `beta`.
              schema:
                type: string
                const: beta
          content:
            text/plain:
              schema:
                type: string
        '404':
          description: >-
            The `siteId` is not a site in the resolved workspace, or the site
            holds nothing to export yet.
          headers:
            x-goosy-api:
              description: Present while this API is in beta; the value is `beta`.
              schema:
                type: string
                const: beta
          content:
            text/plain:
              schema:
                type: string
        '500':
          description: An unexpected server error occurred while building the zip.
          headers:
            x-goosy-api:
              description: Present while this API is in beta; the value is `beta`.
              schema:
                type: string
                const: beta
          content:
            text/plain:
              schema:
                type: string
components:
  securitySchemes:
    tenantApiKey:
      type: http
      scheme: bearer
      description: >-
        An API key minted at Settings › API & MCP. Send it as `Authorization:
        Bearer <key>`. A key carries its holder's own permissions, resolved on
        every call — revoking a membership closes the key's reach immediately.
        Keep it in an environment variable (`GOOSY_API_KEY`), never in a
        committed file.

````