OpenAPI Spec

Suwappu publishes an OpenAPI 3.1.0 specification that describes all REST API endpoints. The spec enables automated code generation, API documentation, and programmatic agent discovery.

Endpoint

GET https://api.suwappu.bot/v1/agent/openapi

No authentication is required to fetch the OpenAPI spec.

Fetching the Spec

curl https://api.suwappu.bot/v1/agent/openapi

To save it to a file:

curl -o suwappu-openapi.json https://api.suwappu.bot/v1/agent/openapi

To pretty-print it:

curl -s https://api.suwappu.bot/v1/agent/openapi | python3 -m json.tool

What the Spec Contains

The OpenAPI 3.1.0 JSON document describes:

  • Info --- API name, version, description, and contact details.

  • Servers --- Base URL (https://api.suwappu.bot).

  • Paths --- All REST API endpoints with request/response schemas, including:

    • POST /v1/agent/register --- Agent registration

    • GET /v1/agent/quote --- Get a swap quote

    • POST /v1/agent/swap --- Execute a swap

    • GET /v1/agent/portfolio --- Check wallet portfolio

    • GET /v1/agent/prices --- Get token prices

    • GET /v1/agent/chains --- List supported chains

    • GET /v1/agent/tokens --- List and search tokens

    • GET /v1/agent/openapi --- This spec itself

  • Components --- Reusable schemas for request/response objects.

  • Security --- Bearer token authentication scheme.

Using with Code Generation Tools

openapi-generator

Generate a client library in any supported language:

openapi-typescript

Generate TypeScript types from the spec:

Swagger UI

You can load the spec into Swagger UI for an interactive API explorer:

Then open http://localhost:8080 in your browser.

Programmatic Usage

Auto-Discovery (Python)

An agent can fetch the spec at runtime to discover endpoints and their parameters without any hardcoded knowledge:

Auto-Discovery (JavaScript)

Dynamic Client Construction

AI agents can use the OpenAPI spec to dynamically build API calls without pre-built client libraries:

Relationship to Other Protocols

The OpenAPI spec describes the REST API. The same underlying functionality is also available through:

  • A2A Protocol (/a2a) --- Natural language interface over JSON-RPC. See A2A Protocol.

  • MCP Protocol (/mcp) --- Tool-based interface for LLMs. See MCP Protocol.

The agent card at /.well-known/agent.json includes the openApiUrl field pointing to this spec, enabling agents to discover both the A2A and REST interfaces from a single entry point. See Agent Card.

Last updated