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

# Open a port

> Base URL `https://compute.x402layer.cc/pods/v1`. Needs an `X-API-Key` with the `pods:control:write` scope, or a signed-in session. A pod's own key is refused (`403`). See the [Sandbox API guide](/cloud/pods/sandbox).

Publishes a URL that proxies HTTP to a port on the pod. Ports 1024 to 65535, except 8642, 8787 and 18780 to 18799, which the platform uses. Up to 5 open per pod. The URL (and a private port's token) is returned only once; opening the same port again rotates them and returns `200` with `rotated: true`. Each proxied request carries up to 5 MB and must finish within 30 seconds. Rate limit: 30 per minute per account.



## OpenAPI

````yaml /api-reference/openapi.json post /pods/v1/pods/{id}/ports
openapi: 3.1.0
info:
  title: x402 Singularity Layer API
  description: >-
    OpenAPI-backed reference for marketplace discovery, payment routes,
    webhooks, wallet-first auth, agent endpoints, and ERC-8004 flows.
  version: 1.0.0
servers:
  - url: https://api.x402layer.cc
security: []
tags:
  - name: Marketplace
    description: Public discovery and listing lookup
  - name: Public Endpoints
    description: Public endpoint metadata and hosted checkout context
  - name: Public Payment Links
    description: Hosted public payment-link lookup
  - name: Payments
    description: Hosted x402 payment challenge routes
  - name: Receipts
    description: Signed receipt lookup and verification helpers
  - name: Ratings
    description: Public listing ratings and authenticated rating actions
  - name: Webhooks
    description: Seller webhook management API
  - name: Agent Auth
    description: Wallet-first challenge and verification routes
  - name: Agent Endpoints
    description: Create, read, top up, and delete agent endpoints
  - name: ERC-8004
    description: Agent registry and registration lifecycle routes
  - name: Marketplace Agents
    description: Public ERC-8004 marketplace discovery routes
  - name: Compute Catalog
    description: Compute plans, regions, and OS catalog
  - name: Compute Instances
    description: Provision, inspect, extend, and destroy compute instances
  - name: Compute API Keys
    description: API keys for compute agent access
  - name: Fundraiser Campaigns
    description: List, view, create, and edit fundraiser campaigns
  - name: Fundraiser Contributions
    description: Record and list campaign contributions
  - name: Fundraiser Comments
    description: Campaign comment threads
  - name: Fundraiser Media
    description: Campaign image uploads and OG images
  - name: Enterprise
    description: >-
      Enterprise partner configuration, endpoint listing, revenue stats, and
      transaction ledger
  - name: Staking
    description: Agentic $SGL staking
  - name: SGL Grid
    description: >-
      Decentralized, confidential, OpenAI-compatible inference served by
      attested TEE nodes.
  - name: Compute Credits
    description: Prepaid USDC credit balance shared across Machines and Grid.
  - name: Agent Pods
    description: >-
      Deploy and manage hosted agents (Agent Pods), plus the pod's
      OpenAI-compatible adapter for external clients.
  - name: Agent Pods API
    description: >-
      The programmatic `/pods/v1` surface: create, drive and destroy Agent Pods
      with a single `X-API-Key`. Distinct from the Agent Pods dashboard routes,
      which expect a wallet signature or a browser session.
paths:
  /pods/v1/pods/{id}/ports:
    servers:
      - url: https://compute.x402layer.cc
    post:
      tags:
        - Agent Pods API
      summary: Open a port
      description: >-
        Base URL `https://compute.x402layer.cc/pods/v1`. Needs an `X-API-Key`
        with the `pods:control:write` scope, or a signed-in session. A pod's own
        key is refused (`403`). See the [Sandbox API
        guide](/cloud/pods/sandbox).


        Publishes a URL that proxies HTTP to a port on the pod. Ports 1024 to
        65535, except 8642, 8787 and 18780 to 18799, which the platform uses. Up
        to 5 open per pod. The URL (and a private port's token) is returned only
        once; opening the same port again rotates them and returns `200` with
        `rotated: true`. Each proxied request carries up to 5 MB and must finish
        within 30 seconds. Rate limit: 30 per minute per account.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Pod id, as returned by create/list.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - port
              properties:
                port:
                  type: integer
                  minimum: 1024
                  maximum: 65535
                  example: 8080
                visibility:
                  type: string
                  enum:
                    - public
                    - private
                  default: public
      responses:
        '201':
          description: 'Opened (rotated: `200`).'
          content:
            application/json:
              schema:
                type: object
                properties:
                  port:
                    type: object
                    properties:
                      port:
                        type: integer
                      visibility:
                        type: string
                        enum:
                          - public
                          - private
                      url:
                        type: string
                        description: >-
                          Shown only on open. Proxies HTTP to 127.0.0.1:<port>
                          on the pod.
                      token:
                        type: string
                        description: >-
                          Private ports only, shown once. Send it as
                          `x-pod-port-token`.
                      token_header:
                        type: string
                        example: x-pod-port-token
                      note:
                        type: string
                  rotated:
                    type: boolean
        '400':
          description: >-
            `invalid_request`: a blocked or out-of-range port, or a bad
            `visibility`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PodV1Error'
        '401':
          description: '`unauthorized`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PodV1Error'
        '403':
          description: >-
            `forbidden`: a pod key, or a key without `pods:control:write`
            (`details.required_scope`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PodV1Error'
        '404':
          description: '`not_found`: no such pod on your account.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PodV1Error'
        '409':
          description: >-
            `conflict` (the pod is not running) or `limit_exceeded` (5 ports
            already open).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PodV1Error'
        '429':
          description: '`rate_limited`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PodV1Error'
      security:
        - podsApiKey: []
components:
  schemas:
    PodV1Error:
      type: object
      description: >-
        Every `/pods/v1/*` failure has this shape. Branch on `error.code`, never
        on `error.message` - the message is prose and may be reworded.
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              enum:
                - invalid_request
                - unauthorized
                - forbidden
                - not_found
                - conflict
                - limit_exceeded
                - capability_disabled
                - rate_limited
                - not_implemented
                - internal
              description: Stable machine-readable code.
            message:
              type: string
              description: Human-readable explanation.
            details:
              type: object
              description: >-
                Optional structured context, e.g. `{ "code":
                "idempotency_mismatch" }`, `{ "required_scope":
                "pods:wallet:write" }`, `{ "capability": "wallet" }`, `{
                "retry_after_seconds": 60 }`.
  securitySchemes:
    podsApiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        A compute API key (`x402c_...`). Mint one in the dashboard under
        Settings -> API Keys. A signed-in compute session also works. Wallet
        signatures do not: they are bound to method+path+body and do not survive
        the internal hop, so signature callers must use the dashboard routes
        instead. Two extra scopes gate the dangerous powers: `pods:wallet:write`
        (pod wallet money, backup passphrase) and `pods:control:write`
        (connectors, full-power control socket).

````

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