API
Deplite는 세 가지 인증 방식을 가진 REST API를 제공해요.
인증 방식
| 방식 | 헤더 | 누가 씀 |
|---|---|---|
| JWT | Authorization: Bearer <jwt> | 대시보드 사용자 |
| API Token | Authorization: Bearer tk_... | 외부 시스템·CI |
| Agent 서명 | X-Agent-Id, X-Timestamp, X-Nonce, X-Signature | Agent ↔ Server 전용 |
Base URL
- 사용자 API:
https://app.deplite.io/api - Agent API:
https://api.deplite.io
Trigger
| 메서드 | 경로 | 인증 | 설명 |
|---|---|---|---|
| GET | /orgs/:orgId/triggers | JWT | 조직 내 트리거 목록 |
| POST | /orgs/:orgId/triggers | JWT (owner) | 트리거 생성 |
| GET | /triggers/:id | JWT | 트리거 상세 |
| PATCH | /triggers/:id | JWT (owner) | 트리거 수정 |
| DELETE | /triggers/:id | JWT (owner) | 트리거 삭제 |
| POST | /triggers/:id/run-manual | JWT | 대시보드 수동 실행 |
| POST | /triggers/:id/run | API Token | Webhook 실행 |
POST /triggers/:id/run
curl -X POST https://api.deplite.io/triggers/<id>/run \
-H "Authorization: Bearer tk_..." \
-H "Idempotency-Key: <unique>" \
-d '{
"ref": "main",
"debug": false,
"workflowName": "deploy",
"params": { "env": "prod" }
}'응답 (async):
{ "jobId": "...", "status": "queued", "statusUrl": "/api/jobs/..." }응답 (sync, 워크플로우 완료 시):
{ "jobId": "...", "status": "success", "exitCode": 0, "output": {...} }Job
| 메서드 | 경로 | 인증 | 설명 |
|---|---|---|---|
| GET | /api/jobs/:id | JWT 또는 Token | Job 상세 |
| GET | /api/jobs/:id/logs | JWT 또는 Token | Job 로그 |
API Token
| 메서드 | 경로 | 인증 | 설명 |
|---|---|---|---|
| GET | /orgs/:orgId/api-tokens | JWT | 토큰 목록 |
| POST | /orgs/:orgId/api-tokens | JWT (owner) | 토큰 발급 |
| POST | /orgs/:orgId/api-tokens/:id/rotate | JWT (owner) | 재발급 |
| DELETE | /orgs/:orgId/api-tokens/:id | JWT (owner) | 회수 |
POST /orgs/:orgId/api-tokens
{
"name": "CI/CD Pipeline",
"scopeType": "trigger",
"triggerIds": ["<trigger-id>"],
"rateLimitPerMinute": 10,
"rateLimitPerHour": 100,
"expiresAt": "2027-01-01T00:00:00Z"
}응답에서 plainToken은 이때 한 번만 보여요. 안전하게 보관하세요.
Agent 관리
| 메서드 | 경로 | 인증 | 설명 |
|---|---|---|---|
| GET | /orgs/:orgId/agents | JWT | Agent 목록 |
| POST | /orgs/:orgId/agents/enroll-tokens | JWT (owner) | Enrollment Token 발급 |
| GET | /agents/:id | JWT | Agent 상세 |
| PATCH | /agents/:id | JWT (owner) | Agent 이름 변경 |
| DELETE | /agents/:id | JWT (owner) | Agent 회수 |
Workflow
| 메서드 | 경로 | 인증 | 설명 |
|---|---|---|---|
| GET | /agents/:agentId/workflows | JWT | Agent의 워크플로우 메타 목록 |
| PATCH | /agents/:agentId/workflows/:name/rate-limit | JWT (owner) | 서버 측 워크플로우 리밋 |
| POST | /agents/:agentId/workflows/refresh | JWT (owner) | 즉시 재스캔 요청 |
Slack
| 메서드 | 경로 | 인증 | 설명 |
|---|---|---|---|
| GET | /orgs/:orgId/slack/install-url | JWT | OAuth URL 생성 |
| GET | /slack/oauth/callback | Public | OAuth 콜백 |
| GET | /orgs/:orgId/slack/installations | JWT | Slack 연결 목록 |
| DELETE | /orgs/:orgId/slack/installations/:teamId | JWT (owner) | 해제 |
| POST | /slack/events | Slack 서명 | Slack 이벤트 |
| POST | /slack/commands | Slack 서명 | Slack 슬래시 명령 |
File Storage
| 메서드 | 경로 | 인증 | 설명 |
|---|---|---|---|
| POST | /orgs/:orgId/files/presign-upload | JWT | 업로드 사전 서명 URL |
| POST | /orgs/:orgId/files/:id/complete | JWT | 업로드 완료 알림 |
| GET | /orgs/:orgId/files/:id/download-url | JWT | 다운로드 URL |
| GET | /orgs/:orgId/files/:id | JWT | 메타 |
| GET | /orgs/:orgId/files | JWT | 목록 |
| DELETE | /orgs/:orgId/files/:id | JWT | 삭제 |
Agent API (참고)
Agent ↔ Server 전용 엔드포인트예요. 외부에서 직접 호출할 일은 없어요.
| 메서드 | 경로 | 설명 |
|---|---|---|
| POST | /agent/enroll | Enrollment Token으로 등록 |
| GET | /agent/stream | SSE 이벤트 수신 |
| POST | /agent/heartbeat | 60초 주기 생존 신호 |
| POST | /agent/workflows/report | 워크플로우 메타 보고 |
| POST | /agent/jobs/:id/logs | 로그 업로드 |
| POST | /agent/jobs/:id/result | 결과 제출 |
에러 응답
{
"statusCode": 429,
"code": "rate_limited",
"message": "Rate limit exceeded",
"retryAfter": 42
}| HTTP | 상황 |
|---|---|
| 401 | 토큰 없음/무효 |
| 403 | 권한 부족 |
| 404 | 리소스 없음 |
| 409 | 중복 (idempotency 충돌 등) |
| 422 | 입력 검증 실패 |
| 429 | 레이트 리밋 초과 |
| 500 | 서버 에러 |
완전한 사용 흐름 예시
새 organization에서 “Agent 등록 → 트리거 생성 → 토큰 발급 → 실행”까지 전 과정을 curl로 보여드릴게요.
# 변수 정의
ORG_ID="org-abc"
JWT="<your-jwt>"
# [1] Enrollment token 발급 → Agent 머신에서 사용
curl -s -X POST https://app.deplite.io/api/orgs/$ORG_ID/agents/enroll-tokens \
-H "Authorization: Bearer $JWT" \
-H "Content-Type: application/json" \
-d '{"label": "prod-server-01"}' | jq
# → { "token": "enr_..." }# [2] (Agent 머신에서) 등록
export DEPLITE_TOKEN="enr_..."
./deplite-agent
# → "Enrolled as agent ag-abc1234"# [3] Agent ID 확인
AGENT_ID=$(curl -s https://app.deplite.io/api/orgs/$ORG_ID/agents \
-H "Authorization: Bearer $JWT" | jq -r '.[0].id')
echo "Agent: $AGENT_ID"
# [4] Workflow가 보고됐는지 확인
curl -s https://app.deplite.io/api/agents/$AGENT_ID/workflows \
-H "Authorization: Bearer $JWT" | jq
# → [{"name":"deploy-prod","secretsKeys":["DATABASE_URL"]}]
# [5] Trigger 생성
TRIGGER=$(curl -s -X POST https://app.deplite.io/api/orgs/$ORG_ID/triggers \
-H "Authorization: Bearer $JWT" \
-H "Content-Type: application/json" \
-d "{
\"agentId\": \"$AGENT_ID\",
\"name\": \"Deploy Prod\",
\"workflowName\": \"deploy-prod\",
\"scopeType\": \"workflow\",
\"type\": \"webhook\",
\"responseMode\": \"async\",
\"allowedRefs\": [\"main\", \"release/*\"]
}" | jq -r '.id')
echo "Trigger: $TRIGGER"
# [6] API Token 발급 (trigger scope, 분당 10회 제한)
TOKEN=$(curl -s -X POST https://app.deplite.io/api/orgs/$ORG_ID/api-tokens \
-H "Authorization: Bearer $JWT" \
-H "Content-Type: application/json" \
-d "{
\"name\": \"CI Pipeline\",
\"scopeType\": \"trigger\",
\"triggerIds\": [\"$TRIGGER\"],
\"rateLimitPerMinute\": 10
}" | jq -r '.plainToken')
echo "Token: $TOKEN (이 시점 외엔 복원 불가)"
# [7] Webhook으로 실행
JOB=$(curl -s -X POST https://api.deplite.io/triggers/$TRIGGER/run \
-H "Authorization: Bearer $TOKEN" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"ref": "main", "params": {"replicas": "3"}}' | jq -r '.jobId')
echo "Job: $JOB"
# [8] Job 상태 폴링
while true; do
STATUS=$(curl -s https://app.deplite.io/api/jobs/$JOB \
-H "Authorization: Bearer $TOKEN" | jq -r '.status')
echo " status: $STATUS"
[ "$STATUS" = "success" ] || [ "$STATUS" = "failed" ] && break
sleep 2
done
# [9] 로그 확인
curl -s https://app.deplite.io/api/jobs/$JOB/logs \
-H "Authorization: Bearer $TOKEN" | jq '.items[:5]'이 흐름을 한 번 통과하면 Deplite의 거의 모든 API를 다 써본 거예요.
응답 페이로드 형태
GET /api/jobs/:id
{
"id": "j-abc-1234",
"agentId": "ag-abc1234",
"workflowName": "deploy-prod",
"status": "success",
"ref": "main",
"debug": false,
"exitCode": 0,
"output": {
"deployedRef": "main-7f3a9b",
"url": "https://app.example.com"
},
"queuedAt": "2026-05-31T13:42:18Z",
"startedAt": "2026-05-31T13:42:19Z",
"finishedAt": "2026-05-31T13:44:53Z"
}GET /api/jobs/:id/logs
{
"items": [
{ "seq": 0, "stream": "summary", "stepName": "build", "level": "info", "content": "Build started" },
{ "seq": 1, "stream": "raw", "stepName": "build", "content": "Step 1/5 : FROM node:18\n" },
{ "seq": 2, "stream": "summary", "stepName": "", "level": "info", "content": "Workflow completed: success" }
],
"nextSeq": 3
}다음으로
최종 수정 일자: