인증 및 토큰
모든 GraphQL 요청은 Authorization 헤더에 Bearer token을, c-id(클라이언트 ID) 헤더에 클라이언트 ID를 포함해야 합니다. 두 가지 모두 PlainApp Settings → Sessions & API Tokens에서 가져올 수 있습니다. ADB token은 별도이며 Android 자동화로 HTTP 서버를 시작하거나 중지하는 데만 사용됩니다 — Settings → Developer Options에서 찾을 수 있습니다.
타입 정의
# GraphQL requests must include both headers:
c-id: <client-id>
Authorization: Bearer <api-token>
# Endpoint : POST /graphql작업
API Token
PlainApp Settings → Sessions & API Tokens → API Tokens 탭에서 API token을 생성합니다. 각 token에는 클라이언트 ID와 token 값이 포함됩니다. 두 가지를 모두 요청 헤더로 전송하십시오: c-id는 클라이언트 ID용, Authorization: Bearer는 token용입니다.
# On your Android device:
# 1. Open PlainApp
# 2. Go to Settings → Sessions & API Tokens
# 3. Open the "API Tokens" tab
# 4. Tap + to create a new token
# 5. Copy the c-id and token values shown
curl --request POST \
--url http://192.168.1.100:8080/graphql \
--header 'c-id: <your-client-id>' \
--header 'Authorization: Bearer <your-api-token>' \
--header 'Content-Type: application/json' \
--data '{"query":"{ chatItems { content } }"}'ADB Token
ADB token은 Android 자동화 전용입니다 — adb broadcast를 통해 PlainApp HTTP 서버를 시작하고 중지합니다. PlainApp Settings → Developer Options에서 찾을 수 있습니다. GraphQL 요청용 Bearer token이 아닙니다.
# Start the HTTP server
adb shell am broadcast -a com.ismartcoding.plain.action.START_HTTP_SERVER -p com.ismartcoding.plain --es token <your-adb-token>
# Stop the HTTP server
adb shell am broadcast -a com.ismartcoding.plain.action.STOP_HTTP_SERVER -p com.ismartcoding.plain --es token <your-adb-token>plainapp-cli (AI Agent)
plainapp-cli는 AI 호출 가능 CLI로 설계된 Rust 명령줄 도구입니다. 셸 명령을 실행할 수 있는 AI agent에게 전달하면, 해당 agent가 PlainApp GraphQL API를 통해 연락처, SMS, 파일, 메모, 통화 등의 휴대폰 데이터를 검사하고 제어할 수 있습니다.
# Install (macOS & Linux one-liner)
bash <(curl -fsSL https://raw.githubusercontent.com/plainhub/plainapp-cli/main/install.sh)
# Or build from source (requires Rust ≥ 1.75)
cargo install --path .
# --- Setup ---
# 1. Open PlainApp → Settings → Sessions & API Tokens → API Tokens tab
# 2. Tap + to create a token, note the Client ID and Token
# 3. Run to generate config:
plainapp-cli --init
# Edit ~/.config/plainapp-cli/config.toml:
# api_url = "https://192.168.1.100:8443"
# client_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
# token = "BASE64_ENCODED_32_BYTE_TOKEN"
# --- Usage ---
# Fetch the full GraphQL schema (for AI introspection)
plainapp-cli --schema
# Execute any GraphQL query or mutation
plainapp-cli --exec '<json>'
# Examples:
# List SMS conversations
plainapp-cli -e '{"query":"{ smses(limit:20,offset:0) { id address body date } }","variables":null}'
# List notes
plainapp-cli -e '{"query":"{ app { battery sdcardPath } }","variables":null}'
# Delete a file
plainapp-cli -e '{
"query": "mutation DeleteFiles($paths:[String!]!) { deleteFiles(paths:$paths) }",
"variables": {"paths":["/sdcard/tmp/test.txt"]}
}'