Gunbot REST API Introduction
The Gunbot REST API enables you to programmatically interact with Gunbot, allowing automation and integration with your own applications and services. It provides a single API to control trading operations on many exchanges.
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.
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 is identical to the GUI port for your Gunbot instance.
When not using the API on localhost
, make sure to configure HTTPS.
Authentication​
The API uses token-based authentication. Before accessing protected endpoints, you must authenticate and obtain a token.
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 are similar to using Gunbot in any other way:
- Add the trading pair to the configuration with a valid strategy.
- Start the core to activate trading operations.
After completing these steps, you can access API endpoints for market data and trading actions. Gunbot will actively monitor and execute strategies for the specified pairs.
Except for API endpoints that place orders or fetch pair lists, the returned data comes from Gunbot core directly.