Skip to main content

Gunbot REST API Introduction

The Gunbot REST API lets you programmatically interact with Gunbot for automation and integration with your own applications and services. It provides a single API surface to control trading operations across multiple exchanges.

Info

A REST API (Representational State Transfer Application Programming Interface) is a set of rules that developers follow when they create an API. One of these rules states that you should be able to get a piece of data (called a resource) when you link to a specific URL.

note

We also have Software Development Kits (SDKs) to make it easier to get started using the API:

Base URL

All API endpoints use the following base URL:

http://your-gunbot-instance.com:3000/api/v1/
https://your-gunbot-instance.com:3000/api/v1/

Replace your-gunbot-instance.com with the actual domain or IP address of your Gunbot instance. The port matches the GUI port for your Gunbot instance. When you are not calling the API from localhost, configure HTTPS.

Authentication

The API uses token-based authentication. Authenticate first to obtain a token before calling protected endpoints.

Data Format

  • The API accepts and returns data in JSON (JavaScript Object Notation) format.
  • It uses standard HTTP response codes to indicate request outcomes.

Response Codes

  • 200 OK: The request was successful.
  • 400 Bad Request: The request was invalid or cannot be processed.
  • 401 Unauthorized: Authentication failed, or the user lacks the necessary permissions.
  • 500 Internal Server Error: A server-side error occurred.

Gunbot Workflow

To automate trading for any trading pair using the API, follow these steps, which match the usual Gunbot workflow:

  1. Add the trading pair to the configuration with a valid strategy.
  2. Start the core to activate trading operations.

After completing these steps, you can access API endpoints for market data and trading actions. Gunbot will monitor and execute strategies for the specified pairs.

Except for API endpoints that place orders or fetch pair lists, the returned data comes directly from the Gunbot core.