This site requires Javascript to be enabled.

What is Swagger?

Swagger is an open-source software framework that helps developers design, build, document, and consume RESTful Web services.

The Swagger specification serves as the contract for the API. It includes details about endpoints, request/response types, authentication methods, contact information, license, terms of use, and more.

Each endpoint uses the HTTP GET method. Every operation returns either a successful HTTP 200 response with a defined schema or a default error response.

Swagger is provided for both mainnet and testnet.

How to use the swagger?

To use this Swagger API documentation, you must first set up the necessary API calls from a tool or platform that supports RESTful HTTP requests. Here are the general steps you would follow:

  1. Identify the API Endpoint: First, select the API endpoint you want to interact with. For instance, if you want to get the latest block's details for Archway mainnet, the endpoint would be https://api.mainnet.archway.io/cosmos/base/tendermint/v1beta1/blocks/latest.
  2. Choose the HTTP Method: For all the endpoints in this specification, the HTTP method is GET.
  3. Construct the API URL: This involves appending the API endpoint to the base URL of the API.
  4. Include Query Parameters (if needed): Some endpoints require additional parameters that should be included in the request. For instance, the /validatorsets endpoint accepts a block height as a parameter: https://api.mainnet.archway.io//cosmos/base/tendermint/v1beta1/validatorsets/18000.
  5. Send the Request: Use a tool, library, or software that can send HTTP requests. This could be a command-line tool like curl, a programming language with libraries for sending HTTP requests, or a complete API platform like Postman or Insomnia.
  6. Handle the Response: The response will be a JSON object, as defined by the schemas in the Swagger specification.

Example

An example on how to query the information regarding the latest block, would be to launch the following command in your terminal shell:

curl -X 'GET' \  'https://api.mainnet.archway.io/cosmos/base/tendermint/v1beta1/blocks/latest' \  -H 'accept: application/json'