> ## 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.

> ## Agent Instructions
> Peel builds APIs from a URL and a task. Use only the REST routes under https://api.peel.sh and the hosted MCP server at https://api.peel.sh/mcp. Authenticate with the X-API-Key header, or send the same key as Authorization: Bearer. Errors carry code, message, retryable, retry, docs_url and details; branch on code. The peel CLI and the open-source SDK are not published; do not run npm install peel, which is an unrelated package. The keyless routes need no key and no session: the GET /public/marketplace routes, POST /v1/marketplace/{marketplace_id}/endpoints/{endpoint_name}:call and https://api.peel.sh/mcp/keyless. Account routes take a key or a signed-in session and answer 401 without one. These take only a session from peel.sh and refuse a key: GET /v1/accounts, POST /v1/accounts/join, POST /v1/accounts/{account_id}/leave, POST /v1/team/invites, GET /v1/connected-apps, DELETE /v1/connected-apps/{client_id}, PUT /v1/logins, DELETE /v1/logins, GET /v1/logins/code and the /account/billing routes. Every route with its schemas is in https://docs.peel.sh/openapi.json. Use the exact route, field and error-code names shown in these pages, and read the API Reference tab for request and response schemas.

# Publish an owned API to the public marketplace



## OpenAPI

````yaml /openapi.json post /v1/apis/{api_id}/marketplace/publish
openapi: 3.1.0
info:
  title: Peel API
  version: 0.1.0
  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 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.
  - name: Marketplace
    description: Discover, install, publish, and explicitly contribute APIs.
  - name: Execution Jobs
    description: Start, reconnect, answer and cancel owner-scoped host executions.
  - name: Runs
    description: >-
      Every call, batch item and execution you ran, with its outcome and its
      requests to the site.
  - name: Files
    description: Encrypted owner-scoped files for declared runtime uploads and downloads.
  - name: Logins
    description: >-
      Saved site logins Peel signs in with for endpoints that need a signed-in
      session.
  - name: Webhooks
    description: Signed Standard Webhooks events for builds and execution jobs.
  - name: Schedules
    description: Run a data endpoint on a schedule and hear when its answer changes.
paths:
  /v1/apis/{api_id}/marketplace/publish:
    post:
      tags:
        - Marketplace
      summary: Publish an owned API to the public marketplace
      operationId: publishApiToMarketplace
      parameters:
        - $ref: '#/components/parameters/ApiId'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                expected_marketplace_version_id:
                  type: string
                  description: >-
                    Required for contribution-back; the canonical version must
                    still equal this compare-and-swap value.
              additionalProperties: false
      responses:
        '200':
          description: The current API version was contributed or was already published.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarketplacePublication'
        '201':
          description: The current API version was published.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarketplacePublication'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: >-
            The API is not publishable or its canonical marketplace key is
            already owned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - ApiKeyAuth: []
        - SessionCookieAuth: []
components:
  parameters:
    ApiId:
      in: path
      name: api_id
      required: true
      schema:
        type: string
  schemas:
    MarketplacePublication:
      type: object
      required:
        - published
        - already_published
        - publication_kind
        - marketplace_id
        - api_id
        - version_id
        - source_version_id
      properties:
        published:
          type: boolean
          const: true
        already_published:
          type: boolean
        publication_kind:
          type: string
          enum:
            - first_publish
            - contribution
        marketplace_id:
          type: string
        api_id:
          type: string
        version_id:
          type: string
          description: Immutable public marketplace snapshot version.
        source_version_id:
          type: string
          description: Owned private version explicitly contributed.
      additionalProperties: false
    ErrorResponse:
      type: object
      required:
        - type
        - title
        - status
        - instance
        - code
        - message
        - retryable
        - retry
        - docs_url
        - details
      properties:
        type:
          type: string
          format: uri
          description: >-
            RFC 9457 problem type: https://docs.peel.sh/errors/ followed by the
            code.
        title:
          type: string
          description: >-
            Short summary of the problem type. The same for every error with
            this code.
        status:
          type: integer
          minimum: 400
          maximum: 599
          description: The HTTP status of this response.
        instance:
          type: string
          description: >-
            This occurrence: urn:peel:request: followed by the request id, which
            x-request-id also carries.
        code:
          type: string
          description: Stable snake_case error code.
        message:
          type: string
        retryable:
          type: boolean
          description: Whether the same request can succeed later.
        retry:
          type: string
          enum:
            - same_key
            - fix_request
          description: >-
            A request answered with this envelope did not commit a write.
            same_key: send the same request again, with the same
            Idempotency-Key. fix_request: change the request, key or plan first.
        docs_url:
          type: string
          format: uri
        details:
          type: object
          additionalProperties: true
      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:
            $ref: '#/components/schemas/ErrorResponse'
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Requested API or endpoint was not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
    SessionCookieAuth:
      type: apiKey
      in: cookie
      name: better-auth.session_token

````

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