# somaro HTTP API 개요와 인증

> somaro HTTP API의 기준 주소, 두 가지 인증 방식, 응답 형식, 전체 엔드포인트 색인.

웹 페이지: https://guides.somaro.ai/api/overview.html

somaro에 앱을 올리고 돌보는 일은 모두 HTTP 호출로 돼요. 에이전트가 curl로 부르는 호출과 CLI가 부르는 호출은 같은 서버의 같은 기능이에요. 이 레퍼런스는 그 호출을 하나씩 정리한 거예요.

**참고: 공식 명세가 따로 없어요**
somaro는 OpenAPI 문서를 내지 않아요. 이 레퍼런스는 [skill.md](https://somaro.ai/skill.md)(2026-12-04c판)와 [manual](https://somaro.ai/manual)에 적힌 내용만 옮겼어요. 원문이 응답의 필드를 말하지 않은 곳에는 예시 응답을 싣지 않았어요. 2026-12-05 기준이고 둘이 다르면 원문이 맞아요.

## 기준 주소

| 서버 | 주소 | 쓰임 |
|---|---|---|
| 본 서버 | `https://somaro.ai` | 앱을 계속 두는 곳 |
| 테스트넷 | `https://dev.somaro.ai` | 시험해 보는 곳. 모든 앱이 첫 배포 하루 뒤 삭제돼요 |

경로는 두 서버가 같아요. 테스트넷의 절차는 그 서버의 [skill.md](https://dev.somaro.ai/skill.md)가 말해요. 앱과 데이터는 두 서버 사이를 옮겨 다니지 않아요.

앱 자체는 `https://<이름>.somaro.dev` 주소에서 열려요. 그 주소에서 쓰는 경로와 헤더는 [앱 주소에서 쓰는 경로와 헤더](https://guides.somaro.ai/api/in-app.html)에 따로 정리했어요.

## 인증

계정은 패스포트예요. 가입도 로그인도 없고 컴퓨터에 있는 파일 하나가 패스포트의 키예요. 키를 쓰는 방식은 두 가지고 서버는 둘에게 같은 일을 해 줘요.

**curl**

`POST /v1/passports`가 답으로 주는 텍스트를 `~/.somaro/somaro.ai/token`에 저장해요. 이 파일은 curl 설정 파일 형식이라서 모든 호출이 `-K`로 읽어요. 그래서 토큰이 명령줄에 드러나지 않아요.

```sh
curl -sS -K "$HOME/.somaro/somaro.ai/token" https://somaro.ai/v1/me
```

PowerShell에서는 `curl.exe`와 `"$env:USERPROFILE\.somaro\somaro.ai\token"`을 써요.

- 토큰은 만든 서버에서만 통해요. 서버마다 그 서버 이름의 폴더에 하나씩 둬요.
- 토큰은 요청마다 함께 가요. 파일이나 요청 하나를 읽은 사람은 계정을 가진 셈이에요.

**CLI**

CLI는 `~/.somaro/passport`(또는 `$SOMARO_PASSPORT`)에 키를 만들고 요청마다 그 키로 서명해요. 키는 컴퓨터를 떠나지 않아요.

```sh
somaro passport
```

- 서버 주소는 `$SOMARO_API`가 있으면 그 값, 없으면 `~/.somaro/server`에 적힌 주소예요.
- CLI의 패스포트는 테스트넷에서도 그대로 통해요.

한 컴퓨터에서 두 방식을 다 쓰면 패스포트가 둘이 되고 한쪽의 앱은 다른 쪽 것이 아니에요. 한 가지를 골라 계속 쓰거나, [이메일 인증](https://guides.somaro.ai/api/guardian.html)으로 둘을 하나로 합쳐요.

패스포트 없이 보낸 제안이나 배포는 `unsigned`라고 답하고 아무것도 만들지 않아요.

### 인증 없이 부를 수 있는 것

| 경로 | 내용 |
|---|---|
| `GET /v1/plans` | 플랜 단계와 가격, 결제 수단, link 한도. [플랜과 결제](https://guides.somaro.ai/api/plans.html) |
| `GET /v1/health` | 서버 상태와 앱 유지 기간. [신고와 상태 확인](https://guides.somaro.ai/api/reports.html) |
| `GET /coming.json` | 준비 중인 기능 목록 |
| `GET /skill.md` | 에이전트가 읽는 사용법 |
| `GET /manual` | CLI 전체 설명서 |
| `GET /llms.txt` | 위 문서들의 목록 |

`https://somaro.ai/`는 `Accept: text/html` 없이 물으면 `llms.txt`와 같은 텍스트로 답해요.

## 응답 형식

- 제안과 배포(`PUT /v1/apps/<name>`)는 사람이 읽는 텍스트로 답해요. 배포는 단계를 한 줄씩 내보내고 `ok: <name> is up at <address>` 또는 `failed:`로 끝나요.
- `POST /v1/passports`는 curl 설정 파일의 텍스트로 답해요.
- 나머지는 JSON으로 답해요. 거절하면 `error`에 이유와 할 일이 담겨요.

오류 코드는 [오류 코드](https://guides.somaro.ai/api/errors.html)에 모았어요.

## `X-Somaro-Skill` 헤더

skill.md의 배포 명령은 읽은 skill.md의 판 날짜를 헤더로 함께 보내요.

```sh
curl -sS -K "$HOME/.somaro/somaro.ai/token" -H "X-Somaro-Skill: 2026-12-04c" -T "$HOME/.somaro/<name>.tgz" https://somaro.ai/v1/apps/<name>
```

2026-12-05 기준 값은 `2026-12-04c`예요. skill.md가 바뀌면 이 값도 바뀌고 제안의 답에 `guide` 줄이 있으면 skill.md가 바뀌었다는 뜻이에요. 그러니 이 값을 문서에서 복사하지 말고 [skill.md](https://somaro.ai/skill.md)에서 가져오세요.

## 요청 한도

한 주소나 한 패스포트가 1분 동안 서버가 받는 것보다 많이 보내면 `rate_limited`로 거절돼요. 메시지가 몇 초 뒤에 다시 하라고 알려 줘요. 그만큼 기다렸다가 같은 요청을 보내세요. 기다리지 않고 되풀이하지는 마세요.

## 엔드포인트 색인

`<name>`은 앱 이름이에요.

### 패스포트와 키

| 메서드 | 경로 | 하는 일 | 문서 |
|---|---|---|---|
| POST | `/v1/passports` | 패스포트(토큰) 만들기 | [패스포트와 키](https://guides.somaro.ai/api/passports.html) |
| GET | `/v1/me` | 패스포트 ID와 허용량 | [패스포트와 키](https://guides.somaro.ai/api/passports.html) |
| GET | `/v1/keys` | 패스포트의 키 목록 | [패스포트와 키](https://guides.somaro.ai/api/passports.html) |
| DELETE | `/v1/keys/<key>` | 키 하나 빼기 | [패스포트와 키](https://guides.somaro.ai/api/passports.html) |
| DELETE | `/v1/keep` | 이메일 인증 링크 취소 | [패스포트와 키](https://guides.somaro.ai/api/passports.html) |

### 앱

| 메서드 | 경로 | 하는 일 | 문서 |
|---|---|---|---|
| PUT | `/v1/apps/<name>` | 제안 받기(아무것도 바꾸지 않음) | [앱 배포·조회·삭제](https://guides.somaro.ai/api/apps.html) |
| PUT | `/v1/apps/<name>?yes` | 배포 | [앱 배포·조회·삭제](https://guides.somaro.ai/api/apps.html) |
| GET | `/v1/apps` | 내 앱 목록 | [앱 배포·조회·삭제](https://guides.somaro.ai/api/apps.html) |
| GET | `/v1/apps/<name>` | 앱 하나의 상태와 주소, 기한 | [앱 배포·조회·삭제](https://guides.somaro.ai/api/apps.html) |
| DELETE | `/v1/apps/<name>` | 앱과 데이터 삭제 | [앱 배포·조회·삭제](https://guides.somaro.ai/api/apps.html) |
| PUT | `/v1/apps/<name>/env` | 환경 변수 넣기·빼기 | [환경 변수·재시작·로그](https://guides.somaro.ai/api/runtime.html) |
| POST | `/v1/apps/<name>/restart` | 다시 시작 | [환경 변수·재시작·로그](https://guides.somaro.ai/api/runtime.html) |
| GET | `/v1/apps/<name>/logs?tail=100` | 로그 | [환경 변수·재시작·로그](https://guides.somaro.ai/api/runtime.html) |
| GET | `/v1/apps/<name>/stats?since=7d` | 방문 통계 | [방문 통계](https://guides.somaro.ai/api/stats.html) |
| POST | `/v1/apps/<name>/test-visitor` | 시험용 로그인 쿠키 | [앱 주소에서 쓰는 경로와 헤더](https://guides.somaro.ai/api/in-app.html) |

### 데이터

| 메서드 | 경로 | 하는 일 | 문서 |
|---|---|---|---|
| GET | `/v1/apps/<name>/db` | SQLite 데이터베이스 목록 | [데이터베이스·백업·복원](https://guides.somaro.ai/api/data.html) |
| GET | `/v1/apps/<name>/db/pull?path=<path>` | 데이터베이스 사본 받기 | [데이터베이스·백업·복원](https://guides.somaro.ai/api/data.html) |
| POST | `/v1/apps/<name>/backup` | 지금 복원 지점 만들기 | [데이터베이스·백업·복원](https://guides.somaro.ai/api/data.html) |
| GET | `/v1/apps/<name>/backups` | 복원 지점 목록 | [데이터베이스·백업·복원](https://guides.somaro.ai/api/data.html) |
| POST | `/v1/apps/<name>/restore?point=<point>` | 그 지점으로 되돌리기 | [데이터베이스·백업·복원](https://guides.somaro.ai/api/data.html) |

### 이메일 인증, 플랜, 도메인, 신고

| 메서드 | 경로 | 하는 일 | 문서 |
|---|---|---|---|
| POST | `/v1/guardian` | 인증 메일 보내기 | [이메일 인증](https://guides.somaro.ai/api/guardian.html) |
| GET | `/v1/guardian` | 인증이 어디까지 됐는지 | [이메일 인증](https://guides.somaro.ai/api/guardian.html) |
| DELETE | `/v1/guardian` | 소유자 이메일 떼기 | [이메일 인증](https://guides.somaro.ai/api/guardian.html) |
| GET | `/v1/plans` | 플랜 단계와 가격 | [플랜과 결제](https://guides.somaro.ai/api/plans.html) |
| POST | `/v1/passports/<passport-id>/plan?tier=<tier>` | 플랜 결제(x402) | [플랜과 결제](https://guides.somaro.ai/api/plans.html) |
| POST | `/v1/passports/<passport-id>/plan/transfer?tier=<tier>` | 브라우저 지갑 결제 | [플랜과 결제](https://guides.somaro.ai/api/plans.html) |
| GET·POST | `/v1/apps/<name>/domains` | 커스텀 도메인 | [도메인](https://guides.somaro.ai/api/domains.html) |
| POST | `/v1/reports` | 서버 쪽 문제 알리기 | [신고와 상태 확인](https://guides.somaro.ai/api/reports.html) |
| GET | `/v1/health` | 서버 상태 | [신고와 상태 확인](https://guides.somaro.ai/api/reports.html) |

## 관련 문서

- [패스포트와 키](https://guides.somaro.ai/api/passports.html)
- [오류 코드](https://guides.somaro.ai/api/errors.html)
- [CLI 명령어](https://guides.somaro.ai/cli/commands.html)
- [curl과 tar로 직접 올리기](https://guides.somaro.ai/guides/curl-tar.html)
