API

API 레퍼런스

DisHost API의 모든 엔드포인트를 용도별로 정리했습니다

전체 기술 명세는 Swagger UI에서 확인할 수 있습니다.


🤖 봇 관리

내 봇 목록

GET /bots
curl -H "x-api-key: dsh_live_xxx" \
  https://api.dishost.kr/api/v1/bots

봇 상세 정보

GET /bots/:id

봇 생성

POST /bots
{
  "name": "my-bot",
  "type": "git",
  "language": "javascript",
  "gitUrl": "https://github.com/user/repo.git",
  "gitBranch": "main",
  "autoDeployEnabled": true
}

type 옵션:

  • "custom" — 빈 프로젝트로 시작
  • "git" — GitHub에서 가져오기
  • "marketplace" — 템플릿으로 시작

봇 수정

PATCH /bots/:id
{ "name": "새 이름", "autoDeployEnabled": false }

봇 삭제

DELETE /bots/:id

갱신 (7일 연장)

POST /bots/:id/renew

🚀 배포

배포 이력

GET /bots/:id/deployments?page=1&limit=20

배포 실행

POST /deployments
{
  "botId": "abc123",
  "source": "cli"
}

⚡ 서버 관리

# 시작 / 정지 / 재시작
POST /servers/:identifier/power
{ "signal": "start" }  // "start" | "stop" | "restart"

# 리소스 사용량
GET /servers/:identifier/resources

# 환경변수 조회
GET /servers/:identifier/startup

# 환경변수 수정
PUT /servers/:identifier/startup/variable
{ "key": "DISCORD_TOKEN", "value": "..." }

🔗 GitHub

# 설치 목록
GET /github/installations

# 설치된 레포지토리 목록
GET /github/installations/:id/repos

# 레포-봇 연결
POST /github/connect-repo
{ "installationId": 123, "repoFullName": "user/repo", "repoId": 456, "botId": "abc" }

🔐 GitHub OAuth

# 연결 상태
GET /auth/github/status

# 연결 해제
DELETE /auth/github/disconnect

🔑 API Key 관리

# 생성
POST /auth/api-keys
{ "name": "my-token" }

# 목록
GET /auth/api-keys

# 폐기
DELETE /auth/api-keys/:id

🪝 Webhook

# 구독
POST /webhooks/subscriptions
{
  "url": "https://my-app.com/webhook",
  "events": ["deploy.completed", "server.crashed"],
  "secret": "my-secret"
}

# 구독 목록
GET /webhooks/subscriptions

# 구독 해제
DELETE /webhooks/subscriptions/:id

📊 Public API (인증 불필요)

# 서버 상태
GET /health

# 버전
GET /version

# 템플릿 목록
GET /templates