swagger.json


Overview

This file is an OpenAPI 3.0 specification document that defines the RESTful API for the [@shapeshiftoss/polygon-api](/projects/291/69128) project, version 10.0.0. The API provides programmatic access to Polygon (an EVM-compatible blockchain) coinstack data and operations, including account details, transaction history, transaction details, sending transactions, JSON-RPC calls, token metadata, and gas fee estimation.

The file serves as a formal contract describing the available endpoints, request and response schemas, error handling, and usage examples. It enables automatic generation of API client libraries, server stubs, and interactive documentation.


Detailed Explanation

Components

The [components](/projects/291/69205) section defines reusable schemas (data models) used throughout the API. These schemas describe the structure of request bodies and responses, including detailed property types, descriptions, required fields, and constraints.

Key schemas include:


Paths (API Endpoints)

Each path corresponds to a RESTful endpoint with HTTP methods, request parameters, request body schemas, responses, and descriptions.

1. /api/v1/info (GET) — GetInfo

2. /api/v1/account/{pubkey} (GET) — GetAccount

3. /api/v1/account/{pubkey}/txs (GET) — GetTxHistory

4. /api/v1/tx/{txid} (GET) — GetTransaction

5. /api/v1/send (POST) — SendTx

6. /api/v1/jsonrpc (POST) — DoRpcRequest

7. /api/v1/metadata/token (GET) — GetTokenMetadata

8. /api/v1/gas/estimate (POST) — EstimateGas

9. /api/v1/gas/fees (GET) — GetGasFees


Important Implementation Details


Interactions With Other System Components


Usage Examples Summary


Visual Diagram: API Structure (Component Diagram)

flowchart TD
    subgraph Info
        A1[GET /api/v1/info]
    end

    subgraph Account
        A2[GET /api/v1/account/{pubkey}]
        A3[GET /api/v1/account/{pubkey}/txs]
    end

    subgraph Transaction
        A4[GET /api/v1/tx/{txid}]
        A5[POST /api/v1/send]
    end

    subgraph RPC
        A6[POST /api/v1/jsonrpc]
    end

    subgraph TokenMetadata
        A7[GET /api/v1/metadata/token]
    end

    subgraph Gas
        A8[POST /api/v1/gas/estimate]
        A9[GET /api/v1/gas/fees]
    end

    Client --> A1
    Client --> A2
    Client --> A3
    Client --> A4
    Client --> A5
    Client --> A6
    Client --> A7
    Client --> A8
    Client --> A9

    A5 -->|Broadcast Tx| Node
    A6 -->|JSON-RPC| Node
    A8 -->|Estimate Gas| Node
    A9 -->|Get Fees| Node
    A2 -->|Fetch Account Data| Node
    A3 -->|Fetch Tx History| Node
    A4 -->|Fetch Tx Details| Node
    A7 -->|Fetch Metadata| MetadataStorage

Summary

The [swagger.json](/projects/291/68851) file comprehensively documents the Polygon API, specifying endpoints for blockchain data retrieval, transaction broadcasting, gas estimation, and token metadata. It uses detailed JSON schemas for robust data validation and includes extensive error handling. The API facilitates easy integration for developers building blockchain-enabled applications on Polygon, enabling both RESTful and JSON-RPC interactions. This specification enables automation in client/server code generation and API documentation tooling, ensuring consistency and maintainability across the project.