Hi Gainium Team,
I’m running Gainium Self-Hosted (latest version via docker-sh) and building an integration with a Python-based trading automation system. I’ve encountered a specific issue with API authentication for write operations.
Environment
-
Self-Hosted Gainium via Docker (gainium-app-api-1:7503, gainium-app-frontend-1:7500)
-
Nginx Proxy Manager with Let’s Encrypt SSL
-
API URL:
https://api.[my-domain]/api -
Python 3.x with
httpxfor HTTP requests
The Issue
All write operations (POST/PUT/DELETE) return
403 Forbidden
, while read operations (GET) and webhooks work correctly.
| Request Type | Endpoint | Result |
|---|---|---|
| GET |
/api/bots/dca
| GET |
| undefined |
/api/exchanges
| POST |
| undefined |
/trade_signal
(Webhook)
| POST |
| undefined |
/api/startBot?botId=XXX&type=dca
| POST |
| undefined |
/api/updateDCABot?botId=XXX
| PUT |
| undefined |
/api/cloneDCABot?botId=XXX
| DELETE |
| undefined |
/api/stopBot?botId=XXX
What I’ve Verified
1. Signature Algorithm is Correct
I’m using the exact algorithm from the Swagger docs:
python
prehash = body + method + endpoint + timestamp
signature = base64.b64encode(
hmac.new(secret.encode(), prehash.encode(), hashlib.sha256).digest()
).decode()
Proof: GET requests use the same signature logic and work perfectly.
2. Tested Multiple Prehash Formats
I tried both:
-
Without query params:
POST/api/startBot1766513277266 -
With query params:
POST/api/startBot?botId=XXX1766513277266
Both return 403.
3. Tested POST With and Without Body
-
POST /api/startBot(no body) → 403
-
POST /api/updateDCABot(with JSON body) → 403
4. Headers Are Correct
token: [API_KEY]
time: [TIMESTAMP_MS]
signature: [BASE64_SIGNATURE]
Content-Type: application/json
Debug Output
🔐 Testing POST /api/startBot (no body)
Prehash: POST/api/startBot1766513277266
URL: https://api.[my-domain]/api/startBot?botId=[BOT_ID]&type=dca
Response:
Status: 403
Body: Forbidden
For comparison, this GET request works with identical signature logic:
Prehash: GET/api/bots/dca1766507695223
Status: 200 OK
Body: {“status”: “OK”, “data”: {“result”: […]}}
My Questions
-
Are write endpoints (POST/PUT/DELETE) disabled by default on Self-Hosted?
If so, is there a configuration flag in.envor
docker-compose.ymlto enable them?
-
Does the API key require specific permissions for write operations?
I created the key with “Write” permissions in the UI, but perhaps there’s an additional scope required? -
Is there a difference between Cloud and Self-Hosted API capabilities?
The Swagger docs show these endpoints exist, but they seem inaccessible. -
As a workaround: Can webhooks be extended to support
updateSettingsor
changePairactions?
Currently webhooks only support:startBot,
stopBot,
addFunds,
reduceFunds.
What I’m Trying to Achieve
Building a system that:
-
Clones a template bot
-
Updates its settings (pair, TP%, step, etc.) dynamically
-
Starts/stops based on market conditions
Currently I can only use webhooks for start/stop, but cannot update settings or clone bots programmatically.
Any guidance would be greatly appreciated. Happy to provide additional logs or test specific configurations.
Thanks!