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

# Execute API via /execute



## OpenAPI

````yaml /openapi/public-gateway.json post /{api_slug}/execute
openapi: 3.1.0
info:
  title: Apiosk Gateway Public API
  version: 1.1.0
  description: >-
    Sanitized public API reference for the Apiosk gateway. This document covers
    the integration contract for discovery, metadata, execution, payments, and
    community API publishing without exposing internal gateway implementation
    details.
servers:
  - url: https://gateway.apiosk.com
    description: Production gateway
security: []
tags:
  - name: Discovery
    description: Browse listing groups, APIs, and listing detail.
  - name: Execution
    description: Call APIs through public metadata and uniform execute routes.
  - name: Payments
    description: 'Public x402 boundary: 402 responses and payment proof header.'
  - name: Publishing
    description: Register, inspect, update, and deactivate community APIs.
  - name: Metrics
    description: Public wallet and traffic summary routes.
paths:
  /{api_slug}/execute:
    post:
      tags:
        - Execution
        - Payments
      summary: Execute API
      operationId: executeApi
      parameters:
        - name: api_slug
          in: path
          required: true
          description: Gateway API slug.
          schema:
            type: string
          example: neural-sync-01
      requestBody:
        required: true
        content:
          application/json:
            schema:
              description: >-
                Either raw JSON for the default operation or an explicit
                envelope with operation, input, query, and path_params.
              oneOf:
                - $ref: '#/components/schemas/ExecuteEnvelopeRequest'
                - type: object
                  additionalProperties: true
            examples:
              rawDefault:
                summary: Raw default-operation input
                value:
                  query: What does Apiosk do?
                  context: Apiosk is a pay-per-call API marketplace for agents.
              explicitEnvelope:
                summary: Explicit operation envelope
                value:
                  operation: extract
                  input:
                    text: >-
                      OpenAI partnered with Microsoft to scale AI
                      infrastructure.
      responses:
        '200':
          description: Wrapped execute response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExecuteResponse'
        '402':
          description: Payment required. Attach an x402 payment proof in x-payment.
          headers:
            X-Payment-Protocol:
              schema:
                type: string
                example: x402
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentRequiredResponse'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    ExecuteEnvelopeRequest:
      type: object
      additionalProperties: false
      properties:
        operation:
          type: string
          description: >-
            Optional operation selector. Accepts an operation id, path, or
            METHOD /path key.
        input:
          description: JSON payload forwarded to the selected operation.
        query:
          type: object
          additionalProperties: true
          description: Optional query override for GET/HEAD or explicit query forwarding.
        path_params:
          type: object
          additionalProperties: true
          description: >-
            Optional path parameter replacements for routes containing
            placeholders.
    ExecuteResponse:
      type: object
      properties:
        status:
          type: string
          enum:
            - success
            - error
        result: {}
        cost:
          type: number
        latency:
          type: integer
        operation:
          type: string
        api:
          type: string
        upstream_status:
          type: integer
        error:
          type: object
          nullable: true
          properties:
            code:
              type: string
            message:
              type: string
    PaymentRequiredResponse:
      type: object
      properties:
        error:
          type: string
          const: Payment required
        accepts:
          type: array
          items:
            $ref: '#/components/schemas/PaymentRequirement'
        x402Version:
          type: integer
          const: 1
    PaymentRequirement:
      type: object
      properties:
        scheme:
          type: string
        network:
          type: string
        maxAmountRequired:
          type: string
        resource:
          type: string
        description:
          type: string
        mimeType:
          type: string
        payTo:
          type: string
        maxTimeoutSeconds:
          type: integer
        asset:
          type: string
        extra:
          $ref: '#/components/schemas/PaymentRequirementExtra'
    PaymentRequirementExtra:
      type: object
      properties:
        name:
          type: string
        version:
          type: string
  responses:
    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            type: object
            additionalProperties: true

````