# Coolify API Documentation

## Base URL
```
https://redbull.rede5.com.br/api/v1
```

## Authentication
Use Bearer token authentication:
```bash
curl -H "Authorization: Bearer $TOKEN" ...
```

Token: `2|tjaxz6z6osQUz6whMvNMw23kcBqgToQAvMjSLos347164da9`

## Quick Commands

### List all applications
```bash
curl -s -H "Authorization: Bearer $(cat ~/.ssh/coolify-redbull-token)" "https://redbull.rede5.com.br/api/v1/applications"
```

### Deploy by UUID
```bash
# Frontend
curl -s -X GET -H "Authorization: Bearer $TOKEN" "https://redbull.rede5.com.br/api/v1/deploy?uuid=ao8g40scws0w4cgo8coc8o40"

# Backend
curl -s -X GET -H "Authorization: Bearer $TOKEN" "https://redbull.rede5.com.br/api/v1/deploy?uuid=iw4sow8s0kkg4cccsk08gsoo"
```

### Check deployment status
```bash
curl -s -H "Authorization: Bearer $TOKEN" "https://redbull.rede5.com.br/api/v1/deployments/{deployment_uuid}"
```

### Start/Stop/Restart application
```bash
# Start
curl -s -H "Authorization: Bearer $TOKEN" "https://redbull.rede5.com.br/api/v1/applications/{uuid}/start"

# Stop
curl -s -H "Authorization: Bearer $TOKEN" "https://redbull.rede5.com.br/api/v1/applications/{uuid}/stop"

# Restart
curl -s -H "Authorization: Bearer $TOKEN" "https://redbull.rede5.com.br/api/v1/applications/{uuid}/restart"
```

## Application UUIDs

| App | UUID |
|-----|------|
| gohorsejobs-backend-dev | iw4sow8s0kkg4cccsk08gsoo |
| gohorsejobs-backoffice-dev | hg48wkw4wggwsswcwc8sooo4 |
| gohorsejobs-frontend-dev | ao8g40scws0w4cgo8coc8o40 |
| gohorsejobs-seeder-dev | q4w48gos8cgssso00o8w8gck |
| rodiziosdaqui-backend-dev | ecso4woo4woo0ks84888k8ck |
| rodiziosdaqui-backoffice-dev | s4kskw08400wcw8g40ossggo |
| rodiziosdaqui-frontend-dev | l4g4cc884gc04kg8s480gs48 |
| rodiziosdaqui-seeder-dev | ko0kkw4kw8g80scksg8sk0wc |
| q1food-backend-dev | eosgwscc4g044c884k0ws4gc |
| q1food-frontend-dev | g8w440g0w0oowo8skss440wk |

## Scripts

### Health Check Script
```bash
#!/bin/bash
TOKEN=$(cat ~/.ssh/coolify-redbull-token | tr -d '\n')
echo "=== Coolify Health Check ==="
curl -s -H "Authorization: Bearer $TOKEN" "http://185.194.141.70:8000/api/v1/applications" | python -c "
import json,sys
d = json.load(sys.stdin)
for a in d:
    status = a.get('status','unknown')
    icon = '✅' if 'running' in status else '❌'
    print(f'{icon} {a[\"name\"]}: {status}')
"
```

### Restart All Services
```bash
#!/bin/bash
TOKEN=$(cat ~/.ssh/coolify-redbull-token | tr -d '\n')
UUIDS=(
  "ao8g40scws0w4cgo8coc8o40"
  "q4w48gos8cgssso00o8w8gck"
  "iw4sow8s0kkg4cccsk08gsoo"
  "hg48wkw4wggwsswcwc8sooo4"
  "ecso4woo4woo0ks84888k8ck"
  "s4kskw08400wcw8g40ossggo"
  "l4g4cc884gc04kg8s480gs48"
  "ko0kkw4kw8g80scksg8sk0wc"
)
for uuid in "${UUIDS[@]}"; do
  echo "Deploying $uuid..."
  curl -s -X GET -H "Authorization: Bearer $TOKEN" "http://185.194.141.70:8000/api/v1/deploy?uuid=$uuid"
done
```

## Useful Links
- Coolify Docs: https://coolify.io/docs
- API Reference: https://coolify.io/docs/api-reference/authorization
