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

# Export API as OpenAPI



## OpenAPI

````yaml /openapi.json get /v1/apis/{api_id}/exports/openapi
openapi: 3.1.0
info:
  title: Peel API
  version: '2026-03-21'
  description: >-
    Public Peel API for creating APIs from URLs, inspecting them, calling
    generated endpoints, revising builds, and exporting OpenAPI or MCP
    definitions.
servers:
  - url: https://api.peel.sh
security: []
tags:
  - name: APIs
    description: Create, list, inspect, revise, rebuild, and export APIs.
  - name: Account
    description: Credits and account usage surfaces used by CLI, REST, and MCP clients.
  - name: Device Auth
    description: CLI browser-login device flow helpers.
  - name: Endpoint Execution
    description: Execute generated endpoints through a stable API resource.
  - name: OAuth
    description: OAuth discovery and token flows for hosted MCP clients.
  - name: MCP
    description: Hosted MCP transport and discovery surface.
paths:
  /v1/apis/{api_id}/exports/openapi:
    get:
      tags:
        - APIs
      summary: Export API as OpenAPI
      operationId: exportApiOpenApi
      parameters:
        - $ref: '#/components/parameters/ApiId'
      responses:
        '200':
          description: Generated OpenAPI export.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GeneratedOpenApiExport'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: The API has not published exportable endpoints yet.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - ApiKeyAuth: []
        - SessionCookieAuth: []
components:
  parameters:
    ApiId:
      in: path
      name: api_id
      required: true
      schema:
        type: string
        format: uuid
  schemas:
    GeneratedOpenApiExport:
      type: object
      required:
        - openapi
        - info
        - servers
        - paths
        - x-auth
        - x-api-identity
      properties:
        openapi:
          type: string
          const: 3.1.0
        info:
          type: object
          required:
            - title
            - version
          properties:
            title:
              type: string
            version:
              type: string
            description:
              type: string
          additionalProperties: true
        servers:
          type: array
          items:
            type: object
            required:
              - url
            properties:
              url:
                type: string
            additionalProperties: true
        paths:
          type: object
          additionalProperties: true
        components:
          type: object
          additionalProperties: true
        security:
          type: array
          items:
            type: object
            additionalProperties: true
        x-auth:
          type: object
          additionalProperties: true
        x-api-identity:
          $ref: '#/components/schemas/PublicApiIdentity'
        x-binding-id:
          type: string
        x-version-id:
          type: string
      additionalProperties: true
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        code:
          type: string
        detail:
          oneOf:
            - type: string
            - type: object
            - type: array
        error:
          type: string
      additionalProperties: true
    PublicApiIdentity:
      type: object
      required:
        - api_id
        - binding_id
        - version_id
      properties:
        api_id:
          type: string
        binding_id:
          oneOf:
            - type: string
            - type: 'null'
        version_id:
          oneOf:
            - type: string
            - type: 'null'
      additionalProperties: false
  responses:
    Unauthorized:
      description: Missing or invalid auth.
      headers:
        WWW-Authenticate:
          schema:
            type: string
          description: OAuth bearer challenge with MCP resource metadata when available.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
            additionalProperties: true
    NotFound:
      description: Requested API or endpoint was not found.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
            additionalProperties: true
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
    SessionCookieAuth:
      type: apiKey
      in: cookie
      name: better-auth.session_token

````