Percher Export API

The Export API from Percher — 12 operation(s) for export.

GitHub OpenAPI

Operations 12

POST /export/v2/prepare Request export preparation #
GET /export/v2/status Read export preparation status #
POST /export/v2/grants Issue an export download grant #
GET /apps/{appRef}/export/git/check Check Git history export availability #
GET /apps/{appRef}/export/git Download deploy history as a Git bundle #
GET /apps/{appRef}/data/export/check Check PocketBase data export availability #
GET /apps/{appRef}/data/export Download PocketBase data as a compressed archive #
POST /apps/{appRef}/export/mint Mint an export credential #
POST /internal/exports/mint Mint a secrets-bearing export token (internal-only) #
POST /apps/{appRef}/export/tokens/{tokenId}/revoke Revoke an unredeemed export token #
GET /apps/{appRef}/export/history List recent export attempts for an app #
GET /export/download/{token} Redeem an export token and download the bundle #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/percher-app:percher-app-export-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

percher-app-export-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Percher Export API
  version: 1.0.0
  description: AI-native hosting platform. Deploy apps via CLI, MCP, or API — live at name.percher.run.
  contact:
    url: https://percher.app
servers:
- url: https://api.percher.run
  description: Production
- url: http://localhost:3000
  description: Local development
tags:
- name: Export
paths:
  /export/v2/prepare:
    post:
      tags:
      - Export
      summary: Request export preparation
      description: Explicit v2 only. Enqueues once; retries retain the original operation and expiry. No legacy fallback. Does not return archive bytes.
      security:
      - exportPreparation: []
      responses:
        '200':
          description: Already ready
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                required:
                - operationId
                - state
                - revision
                - deadline
                - cleanupReason
                properties:
                  operationId:
                    type: string
                  state:
                    type: string
                    enum:
                    - NOT_REQUESTED
                    - REQUESTED
                    - PREPARING
                    - READY
                    - CLEANUP_REQUIRED
                  revision:
                    type: integer
                    minimum: 0
                  deadline:
                    type: integer
                    description: Original expiry, Unix milliseconds; never extended.
                  cleanupReason:
                    type:
                    - string
                    - 'null'
        '202':
          description: Queued, preparing or cleanup required
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                required:
                - operationId
                - state
                - revision
                - deadline
                - cleanupReason
                properties:
                  operationId:
                    type: string
                  state:
                    type: string
                    enum:
                    - NOT_REQUESTED
                    - REQUESTED
                    - PREPARING
                    - READY
                    - CLEANUP_REQUIRED
                  revision:
                    type: integer
                    minimum: 0
                  deadline:
                    type: integer
                    description: Original expiry, Unix milliseconds; never extended.
                  cleanupReason:
                    type:
                    - string
                    - 'null'
        '404':
          description: Preparation capability or current access invalid
        '409':
          description: Busy, not ready or conflicting state
        '503':
          description: Feature disabled, capacity or storage unavailable
      operationId: postExportV2Prepare
      x-operation-id-source: derived
  /export/v2/status:
    get:
      tags:
      - Export
      summary: Read export preparation status
      description: Metadata only. Never starts work, extends expiry or redeems a download.
      security:
      - exportPreparation: []
      responses:
        '200':
          description: Current bounded state
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                required:
                - operationId
                - state
                - revision
                - deadline
                - cleanupReason
                properties:
                  operationId:
                    type: string
                  state:
                    type: string
                    enum:
                    - NOT_REQUESTED
                    - REQUESTED
                    - PREPARING
                    - READY
                    - CLEANUP_REQUIRED
                  revision:
                    type: integer
                    minimum: 0
                  deadline:
                    type: integer
                    description: Original expiry, Unix milliseconds; never extended.
                  cleanupReason:
                    type:
                    - string
                    - 'null'
        '404':
          description: Preparation capability or current access invalid
        '409':
          description: Busy, not ready or conflicting state
        '503':
          description: Feature disabled, capacity or storage unavailable
      operationId: getExportV2Status
      x-operation-id-source: derived
  /export/v2/grants:
    post:
      tags:
      - Export
      summary: Issue an export download grant
      description: READY only. Replaces an unspent grant after a lost reply; refuses replacement while a claim is unsettled. At most eight grants within the original expiry. The final binary GET does no source preparation.
      security:
      - exportPreparation: []
      responses:
        '201':
          description: One-use grant (at most 60 seconds, bounded by original expiry)
          content:
            application/json:
              schema:
                type: object
                required:
                - downloadUrl
                - expiresAt
                properties:
                  downloadUrl:
                    type: string
                    format: uri
                  expiresAt:
                    type: string
                    format: date-time
        '404':
          description: Preparation capability or current access invalid
        '409':
          description: Busy, not ready or conflicting state
        '410':
          description: Grant limit or completed delivery
        '503':
          description: Feature disabled, capacity or storage unavailable
      operationId: postExportV2Grants
      x-operation-id-source: derived
  /apps/{appRef}/export/git/check:
    get:
      tags:
      - Export
      summary: Check Git history export availability
      description: Owner-only preflight for deploy history, repository size and daily quota. Does not consume quota, reserve concurrency or create a bundle. Success does not reserve a later download.
      security:
      - bearer: []
      parameters:
      - name: appRef
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Git export preflight passed
          content:
            application/json:
              schema:
                type: object
                required:
                - ok
                - estimatedBytes
                properties:
                  ok:
                    type: boolean
                    const: true
                  estimatedBytes:
                    type: number
                    minimum: 0
        '401':
          description: Authentication required
        '403':
          description: Owner access required
        '404':
          description: App or deploy history not found
        '413':
          description: Repository exceeds the configured export size limit
        '429':
          description: Daily export quota exhausted
        '503':
          description: Repository size could not be checked
      operationId: getAppsByAppRefExportGitCheck
      x-operation-id-source: derived
  /apps/{appRef}/export/git:
    get:
      tags:
      - Export
      summary: Download deploy history as a Git bundle
      description: Owner-only streaming export of available deploy history. Subject to repository/bundle size, generation timeout, concurrency and per-app daily quota limits. Does not export environment variable values.
      security:
      - bearer: []
      parameters:
      - name: appRef
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Git bundle stream
          content:
            application/x-git-bundle:
              schema:
                type: string
                format: binary
        '401':
          description: Authentication required
        '403':
          description: Owner access required
        '404':
          description: App or deploy history not found
        '413':
          description: Repository or bundle exceeds the configured size limit
        '429':
          description: Daily quota exhausted or export concurrency busy
        '499':
          description: Client disconnected during bundle generation
        '502':
          description: Bundle generation failed
        '503':
          description: Repository size could not be checked
        '504':
          description: Bundle generation timed out
      operationId: getAppsByAppRefExportGit
      x-operation-id-source: derived
  /apps/{appRef}/data/export/check:
    get:
      tags:
      - Export
      summary: Check PocketBase data export availability
      description: Checks app access, PocketBase mode, daily quota and a running PocketBase container without consuming export quota or creating a snapshot. Success does not reserve a later download.
      security:
      - bearer: []
      parameters:
      - name: appRef
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: PocketBase export preflight passed
          content:
            application/json:
              schema:
                type: object
                required:
                - ok
                properties:
                  ok:
                    type: boolean
                    const: true
        '401':
          description: Authentication required
        '403':
          description: App access denied
        '404':
          description: App not found, PocketBase not enabled or container not running
        '409':
          description: Multiple PocketBase containers matched
        '429':
          description: Daily export quota exhausted
        '502':
          description: Worker could not check container status
      operationId: getAppsByAppRefDataExportCheck
      x-operation-id-source: derived
  /apps/{appRef}/data/export:
    get:
      tags:
      - Export
      summary: Download PocketBase data as a compressed archive
      description: Authenticated per-app export of pb_data from a running PocketBase container, streamed as tar.gz. Enforces app access and the per-plan daily export quota, and records the attempt before requesting the worker snapshot.
      security:
      - bearer: []
      parameters:
      - name: appRef
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: PocketBase data archive stream
          content:
            application/gzip:
              schema:
                type: string
                format: binary
        '401':
          description: Authentication required
        '403':
          description: App access denied
        '404':
          description: App not found, PocketBase not enabled or container not running
        '409':
          description: Multiple PocketBase containers matched
        '429':
          description: Daily export quota exhausted
        '502':
          description: Worker could not produce a snapshot
      operationId: getAppsByAppRefDataExport
      x-operation-id-source: derived
  /apps/{appRef}/export/mint:
    post:
      tags:
      - Export
      summary: Mint an export credential
      description: 'Set protocolVersion:2 to receive a preparationToken and operationId instead of a download URL; preparation/status/grants use that capability in Authorization. V2 requires the configured feature and never falls back. The omitted protocol keeps the legacy contract. Returns a single-use download URL valid for 15 minutes. The raw token is never persisted server-side — only sha256(token) is stored. Re-downloading requires a fresh mint. Rate-limited to 10 mints per app per user per 24h.


        This route hard-rejects `includeSecrets: true` with 400. Secrets export is browser-only and goes through the dashboard''s password-confirm flow, which calls the internal `/internal/exports/mint` endpoint. The CLI, MCP, and any bearer-token client cannot produce a bundle containing env values.'
      security:
      - bearer: []
      parameters:
      - name: appRef
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                deliveryKind:
                  type: string
                  enum:
                  - dashboard
                  - cli
                  - mcp
                  - sunset_email
                includeSecrets:
                  type: boolean
                  description: Must be omitted or `false`. Setting to `true` returns 400.
                protocolVersion:
                  type: integer
                  enum:
                  - 2
                  description: Explicit async non-secrets protocol; omit for legacy.
      responses:
        '201':
          description: Token minted
          content:
            application/json:
              schema:
                oneOf:
                - type: object
                  required:
                  - protocolVersion
                  - operationId
                  - tokenId
                  - preparationToken
                  - expiresAt
                  - ttlSeconds
                  - includeSecrets
                  properties:
                    protocolVersion:
                      type: integer
                      const: 2
                    operationId:
                      type: string
                    tokenId:
                      type: string
                    preparationToken:
                      type: string
                      pattern: ^pce_[A-Za-z0-9_-]{43}$
                    expiresAt:
                      type: string
                      format: date-time
                    ttlSeconds:
                      type: integer
                    includeSecrets:
                      type: boolean
                      const: false
                - type: object
                  properties:
                    tokenId:
                      type: string
                    downloadUrl:
                      type: string
                      format: uri
                    expiresAt:
                      type: string
                      format: date-time
                    ttlSeconds:
                      type: integer
                    includeSecrets:
                      type: boolean
        '400':
          description: includeSecrets=true is not allowed on this route
        '404':
          description: App not found
        '429':
          description: Daily mint rate limit reached
      operationId: postAppsByAppRefExportMint
      x-operation-id-source: derived
  /internal/exports/mint:
    post:
      tags:
      - Export
      summary: Mint a secrets-bearing export token (internal-only)
      description: 'Service-to-service. The dashboard server action is the only legitimate caller: it verifies the BetterAuth session, re-confirms the user''s password fresh, then calls this endpoint. Returns `rawToken` (the credential) and `tokenId` — the caller assembles the user-facing download URL using its own knowledge of the public API origin. The internal route deliberately does not return a `downloadUrl` because it cannot know which public host the user should be sent to.'
      security:
      - internalSecret: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                userId:
                  type: string
                appId:
                  type: string
                includeSecrets:
                  type: boolean
                deliveryKind:
                  type: string
                  enum:
                  - dashboard
                  - cli
                  - mcp
                  - sunset_email
                  default: dashboard
              required:
              - userId
              - appId
              - includeSecrets
      responses:
        '201':
          description: Token minted
          content:
            application/json:
              schema:
                type: object
                properties:
                  tokenId:
                    type: string
                  rawToken:
                    type: string
                  expiresAt:
                    type: string
                    format: date-time
                  ttlSeconds:
                    type: integer
                  includeSecrets:
                    type: boolean
                required:
                - tokenId
                - rawToken
                - expiresAt
                - ttlSeconds
                - includeSecrets
        '401':
          description: Missing or invalid X-Internal-Secret
        '404':
          description: App not found for this user
        '429':
          description: Daily mint rate limit reached
      operationId: postInternalExportsMint
      x-operation-id-source: derived
  /apps/{appRef}/export/tokens/{tokenId}/revoke:
    post:
      tags:
      - Export
      summary: Revoke an unredeemed export token
      description: Owner-only. No-op if the token is already redeemed, revoked, or expired.
      security:
      - bearer: []
      parameters:
      - name: appRef
        in: path
        required: true
        schema:
          type: string
      - name: tokenId
        in: path
        required: true
        schema:
          type: string
      responses:
        '204':
          description: Revoked
        '404':
          description: Token not found or no longer revocable
      operationId: postAppsByAppRefExportTokensByTokenIdRevoke
      x-operation-id-source: derived
  /apps/{appRef}/export/history:
    get:
      tags:
      - Export
      summary: List recent export attempts for an app
      description: Last 10 export events (mints + redemptions) with token expiry and revoke status. Powers the dashboard's Export history table; consumed by the Sunset T-14 nudge skip query.
      security:
      - bearer: []
      parameters:
      - name: appRef
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Export history
      operationId: getAppsByAppRefExportHistory
      x-operation-id-source: derived
  /export/download/{token}:
    get:
      tags:
      - Export
      summary: Redeem an export token and download the bundle
      description: 'Public route — the token IS the credential. Single-use: the first GET wins, concurrent or subsequent reads return 410. Streams a `.tar.gz` archive containing source code, `percher.toml`, env keys, custom domains, deploy history, and a per-framework migration README. Env values are included only when the mint request set `includeSecrets: true`.'
      parameters:
      - name: token
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Bundle stream
          content:
            application/gzip:
              schema:
                type: string
                format: binary
        '404':
          description: Token or app not found
        '410':
          description: Token expired, revoked, or already redeemed
      operationId: getExportDownloadByToken
      x-operation-id-source: derived
components:
  securitySchemes:
    exportPreparation:
      type: http
      scheme: bearer
      bearerFormat: pce_<43 base64url characters>
      description: Separate preparation capability. An account API/OAuth token or operation ID is not a preparation credential.
    bearer:
      type: http
      scheme: bearer
      description: API token from `percher login`
    internalSecret:
      type: apiKey
      in: header
      name: X-Internal-Secret
      description: Internal service secret