Developer Auth
Signup, login, token refresh, logout, and current-developer lookup.
The control plane owns developer credentials (not Supabase). All state — developers and developer_sessions — lives in the control-plane Neon database. Passwords are hashed with pgcrypto bcrypt (crypt(pw, gen_salt('bf', 10))). Refresh tokens are stored as sha256 hashes so a DB dump can't replay them.
Source: apps/api/src/routes/auth/developer.ts.
Rate limits
Per-IP, two-tier (fast + daily):
| Route | Per minute | Per day |
|---|---|---|
POST /auth/developer/signup | 5 | 50 |
POST /auth/developer/login | 10 | 100 |
POST /auth/developer/refresh | 30 | — |
/logout and /me are not rate-limited beyond the global gateway defaults.
POST /auth/developer/signup
Create a new developer and return an access + refresh token pair.
Request
| Field | Type | Required | Description |
|---|---|---|---|
email | string | yes | Unique email address. |
password | string | yes | Minimum 8 characters. Bcrypt-hashed server-side. |
name | string | no | Display name. |
Response 201
Errors
400 INVALID_INPUT— missing email or password.400 WEAK_PASSWORD— password is shorter than 8 characters.409 EMAIL_EXISTS— email already registered.429— rate limited.500 CREATE_FAILED— database error. Inspect server logs.
Try it:
/auth/developer/signupcurl -X POST 'https://api.amba.dev/auth/developer/signup'Curl:
POST /auth/developer/login
Exchange email + password for tokens.
Request
| Field | Type | Required |
|---|---|---|
email | string | yes |
password | string | yes |
Response 200
Errors
400 INVALID_INPUT— missing email or password.401 INVALID_CREDENTIALS— wrong email or password. (Generic on purpose — never leak whether the email exists.)429— rate limited.500 LOGIN_FAILED.
Try it:
/auth/developer/logincurl -X POST 'https://api.amba.dev/auth/developer/login'Curl:
POST /auth/developer/refresh
Rotate the refresh token. The old session is revoked and a new access + refresh pair are issued. If the same refresh token is presented twice the second call fails — that's how we detect token theft.
Request
| Field | Type | Required |
|---|---|---|
refresh_token | string | yes |
Response 200
Errors
400 INVALID_INPUT.401 INVALID_TOKEN— token signature failed, session not found, expired, or already revoked.429— rate limited.500 REFRESH_FAILED.
Try it:
/auth/developer/refreshcurl -X POST 'https://api.amba.dev/auth/developer/refresh'Curl:
POST /auth/developer/logout
Revoke the session referenced by the refresh token. Idempotent — an already-invalid token returns success.
Request
| Field | Type | Required |
|---|---|---|
refresh_token | string | yes |
Response 200
Errors
400 INVALID_INPUT.500 LOGOUT_FAILED.
Try it:
/auth/developer/logoutcurl -X POST 'https://api.amba.dev/auth/developer/logout'Curl:
GET /auth/developer/me
Return the current developer profile. Requires a valid access token.
Request
Response 200
Errors
401 UNAUTHORIZED— missing or invalid access token.404 NOT_FOUND— the developer the token references no longer exists.500 FETCH_FAILED.
Try it:
/auth/developer/mecurl -X GET 'https://api.amba.dev/auth/developer/me'Curl: