Diese Anleitung beschreibt die Nutzung der Coolify API für automatisierte Deployments der Telegram-Bots.
Coolify Instanz: https://app.coolify.io API Version: v1 Authentifizierung: Bearer Token
Das API Token wird in den Benutzereinstellungen von Coolify generiert:
Alle API-Requests benötigen den Header:
Authorization: Bearer $COOLIFY_API_TOKEN Content-Type: application/json
Hinweis: Das Token sollte als Umgebungsvariable ($COOLIFY_API_TOKEN) gespeichert werden, niemals hardcoded.
GET /api/v1/projects
Beispiel:
curl -s "https://app.coolify.io/api/v1/projects" \ -H "Authorization: Bearer $COOLIFY_API_TOKEN" \ -H "Content-Type: application/json"
Response:
[
{
"id": 1038,
"uuid": "bso4sss",
"name": "Anti Spam ohne Vornamenprüfung"
}
]
POST /api/v1/applications/{uuid}/restart
Beispiel - AntiSpam-ohneVorname:
# Application UUID: x4wco4k curl -s -X POST \ "https://app.coolify.io/api/v1/applications/x4wco4k/restart" \ -H "Authorization: Bearer $COOLIFY_API_TOKEN" \ -H "Content-Type: application/json"
Response:
{
"message": "Restart request queued",
"deployment_uuid": "..."
}
GET /api/v1/deployments/{uuid}
Beispiel:
curl -s \ "https://app.coolify.io/api/v1/deployments/DEPLOYMENT_UUID" \ -H "Authorization: Bearer $COOLIFY_API_TOKEN" \ -H "Content-Type: application/json" | \ python3 -m json.tool
| Bot | Application UUID | Projekt ID |
|---|---|---|
| Anti Spam ohne Vornamenprüfung | x4wco4k | 1038 |
| AntiSpamBot Recode V2.0 | uokcw80 | - |
| AntiSpamMessageScanBot | wgcs8ss | - |
| Anti Deleted Account System | bsosk48 | 834 |
Eigene UUIDs finden:
curl -s "https://app.coolify.io/api/v1/applications" \ -H "Authorization: Bearer $COOLIFY_API_TOKEN" \ -H "Content-Type: application/json" | \ python3 -c "import sys,json; [print(f\"{a['name']}: {a['uuid']}\") for a in json.load(sys.stdin)]"
URL: https://git.thepain.dev/ThePain/AntiSpam-ohneVorname/settings/hooks
Konfiguration:
Wichtig: Der Webhook benötigt KEIN Bearer Token, da Coolify den Request intern verarbeitet.
#!/bin/bash # deploy-bot.sh - Manuelles Deployment eines Bots # Benötigt: COOLIFY_API_TOKEN als Umgebungsvariable APPLICATION_UUID="$1" # z.B. x4wco4k if [ -z "$COOLIFY_API_TOKEN" ]; then echo "❌ Fehler: COOLIFY_API_TOKEN nicht gesetzt" echo "export COOLIFY_API_TOKEN='dein-token-hier'" exit 1 fi if [ -z "$APPLICATION_UUID" ]; then echo "Usage: $0 <application-uuid>" echo "Beispiel: $0 x4wco4k" exit 1 fi echo "Starting deployment for $APPLICATION_UUID..." RESPONSE=$(curl -s -X POST \ "https://app.coolify.io/api/v1/applications/$APPLICATION_UUID/restart" \ -H "Authorization: Bearer $COOLIFY_API_TOKEN" \ -H "Content-Type: application/json") DEPLOYMENT_UUID=$(echo $RESPONSE | python3 -c "import sys,json; print(json.load(sys.stdin)['deployment_uuid'])") echo "Deployment queued: $DEPLOYMENT_UUID" # Warte auf Abschluss (optional) echo "Warte auf Deployment..." for i in {1..30}; do STATUS=$(curl -s \ "https://app.coolify.io/api/v1/deployments/$DEPLOYMENT_UUID" \ -H "Authorization: Bearer $COOLIFY_API_TOKEN" \ -H "Content-Type: application/json" | \ python3 -c "import sys,json; print(json.load(sys.stdin)['status'])") echo "Status: $STATUS" if [ "$STATUS" = "finished" ]; then echo "✅ Deployment erfolgreich!" exit 0 elif [ "$STATUS" = "failed" ]; then echo "❌ Deployment fehlgeschlagen!" exit 1 fi sleep 5 done echo "⚠️ Timeout - prüfe manuell in Coolify Dashboard"
export COOLIFY_API_TOKEN=…/api/v1/applications prüfenexport COOLIFY_API_TOKEN=“…„ in ~/.bashrc oder ~/.zshrcFalls das Token kompromittiert wurde:
1. In Coolify: Settings → API → Token löschen 2. Neuen Token generieren 3. Alte Umgebungsvariablen aktualisieren
Letzte Aktualisierung: 2026-02-17
Autor: Klaus 🦞
Hinweis: Diese Anleitung enthält keine sensible Daten. Token müssen lokal gesetzt werden.