Account Hosting API
Onboard Claude accounts into DeRouter hosting from your own app. Two ways: interactive browser login, or bulk sessionKey import.
All endpoints authenticate with a Manager Key (sk-mgr-...) — each key can only manage accounts under its own wallet.
Authorization: Bearer sk-mgr-...
- 1.Log into DeRouter
- 2.Go to the "API Usage" page
- 3."Manage API Keys" tab
- 4."+ New Manager Key", copy the one-time-shown string
Interactive OAuth
The end user logs into claude.ai once in their browser — you never handle their cookie or sessionKey.
1. authorize
Generates a claude.ai authorization link for the end user to open in their browser.
curl -X POST "https://beta-api.derouter.network/api/containers/claude-oauth/authorize" \
-H "Authorization: Bearer sk-mgr-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"region": "sgp"}'
# => { "auth_url": "https://claude.ai/oauth/authorize?...", "session_id": "3f9a2e1b..." }
# KEEP session_id — you pass it back in step 2 (exchange). It links the two calls.
# open auth_url in the END USER's browser (not your server's).
# region picks the egress IP; token is minted from that same IP (revoke-safe).
# region is optional (default sgp) but fixed once set — to change it, call authorize again.2. exchange
Trades the Authorization Code the user got for a token, and lands the account as a hosted container.
curl -X POST "https://beta-api.derouter.network/api/containers/claude-oauth/exchange" \
-H "Authorization: Bearer sk-mgr-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"session_id": "3f9a2e1b...",
"code": "xxxxxxxxxxxxxxxx#yyyyyyyyyyyy"
}'
# => { "status": "running", "account_id": "2eab80c1-...", "email": "user@example.com", "plan": "max", ... }
# session_id = the one returned by authorize in step 1 (that's where it comes from).
# Expires in 30 min, single-use.
# code = the Authorization Code shown on the claude.ai callback page
# (the user copies + sends it to you). NOT a sessionKey (sk-ant-sid...).⚠ code is the Authorization Code, not a sessionKey — the two are not interchangeable. All three onboarding paths (interactive OAuth / single cookie / bulk cookie) share the same per-wallet quota. Full params & error codes: docs/INTERACTIVE_OAUTH_API.md.
Manage your accounts from the dashboard, or contact support for help.
Back to API Dashboard