콘텐츠로 이동

자동화 API

MyPanel은 주로 UI를 구동하는 REST API를 제공합니다. 이 페이지에서는 자동화(CI/CD, 운영 스크립트)에 유용한 안정적인 엔드포인트를 나열합니다. API 토큰으로 인증하세요 (Pro).

모든 요청에는 다음 헤더가 포함됩니다.

Authorization: Bearer mpat_xxxxxxxx

기본 URL은 패널 주소입니다(예: https://panel.example.com). 아래 예제에서는 두 개의 변수를 사용합니다.

Terminal window
PANEL=https://panel.example.com
TOKEN=mpat_xxxxxxxx
Terminal window
# 웹사이트 목록 조회
curl -H "Authorization: Bearer $TOKEN" $PANEL/api/sites
# 웹사이트 생성 (reverseproxy / static / nixpacks / dockerfile / image / wordpress)
curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"domain":"app.example.com","buildKind":"reverseproxy","source":"http://127.0.0.1:3000"}' \
$PANEL/api/sites
# id로 웹사이트 배포
curl -X POST -H "Authorization: Bearer $TOKEN" $PANEL/api/sites/1/deploy
# 최신 배포 상태 조회
curl -H "Authorization: Bearer $TOKEN" $PANEL/api/sites/1/deployment
# 웹사이트 삭제
curl -X DELETE -H "Authorization: Bearer $TOKEN" $PANEL/api/sites/1
Terminal window
# 데이터베이스 목록 조회
curl -H "Authorization: Bearer $TOKEN" $PANEL/api/databases
# 데이터베이스 생성
curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"engine":"MySQL","name":"app_prod"}' $PANEL/api/databases
# id로 데이터베이스 백업 트리거
curl -X POST -H "Authorization: Bearer $TOKEN" $PANEL/api/databases/1/backups
Terminal window
# 서버 정보 (호스트명, OS, 가동 시간, 부하, 버전)
curl -H "Authorization: Bearer $TOKEN" $PANEL/api/system
# 업데이트 상태 (현재 / 최신 버전)
curl -H "Authorization: Bearer $TOKEN" $PANEL/api/update
코드의미
200 / 201 / 202 / 204성공
400잘못된 요청 본문
401토큰 누락 또는 유효하지 않음
402플랜 한도 도달 ({"upgrade":"pro"} 포함)
403권한 부족
404리소스를 찾을 수 없음