API

API 레퍼런스

DisHost REST API 엔드포인트 규격과 요청 예시를 기능별로 정리한 레퍼런스입니다.

상세한 인터랙티브 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 연동

# 설치된 GitHub App 목록
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

# GitHub 계정 연결 해제
DELETE /auth/github/disconnect

API Key 관리

# 새 API Key 발급
POST /auth/api-keys
{ "name": "my-cli-token" }

# 보유 API Key 목록
GET /auth/api-keys

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

웹훅(Webhook) 구독

# 이벤트 웹훅 등록
POST /webhooks/subscriptions
{
  "url": "https://my-app.com/webhook",
  "events": ["deploy.completed", "server.crashed"],
  "secret": "my-secret-token"
}

# 웹훅 구독 목록
GET /webhooks/subscriptions

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

Public API (인증 불필요)

# 서버 상태 확인
GET /health

# API 버전 확인
GET /version

# 마켓플레이스 템플릿 목록
GET /templates