API reference
Early accessPartner account and session
Sign-up, sign-in, two-factor authentication and the current user. The dashboard calls these routes on its own origin with a session cookie; server integrations never call them.
Authentication: Dashboard session cookie (__Host-terra_partner) plus the X-Terra-CSRF header on state-changing requests.
Guide: Authentication
| Method | Path | Summary |
|---|---|---|
| GET | /v1/auth/providers | Which sign-in methods are on |
| GET | /v1/auth/csrf | The CSRF token (also set as the __Host-terra_csrf cookie); send it as X-Terra-CSRF on every write |
| POST | /v1/auth/signup | Create an account (sends a 6-digit code and a link; the answer is the same whether or not the email exists) |
| POST | /v1/auth/verify-email | Confirm the sign-up code and start a session |
| POST | /v1/auth/login | Sign in with email and password |
| POST | /v1/auth/mfa/verify | The authenticator step of a sign-in (TOTP or a recovery code) |
| POST | /v1/auth/logout | Sign out (revokes this session) |
| POST | /v1/auth/password/forgot | Send a reset link (always the same answer) |
| POST | /v1/auth/password/reset | Choose a new password with the emailed token (signs out every session) |
| POST | /v1/auth/mfa/totp/setup | Start authenticator setup: returns the otpauth URL for the QR code |
| POST | /v1/auth/mfa/totp/enable | Turn on two-step sign-in; returns 10 recovery codes once |
| POST | /v1/auth/mfa/totp/disable | Turn off two-step sign-in (needs a current authenticator code) |
| POST | /v1/auth/mfa/step-up | Confirm with an authenticator code before live actions (valid 15 minutes) |
| POST | /v1/auth/mfa/recovery-codes | Replace the recovery codes (needs an authenticator code); shown once |
| GET | /v1/auth/oauth/{provider}/start | Start Google, GitHub or X sign-in (302 to the provider) |
| GET | /v1/auth/oauth/{provider}/callback | The provider's callback (302 to the dashboard, or to /signin?error=CODE) |
| POST | /v1/auth/oauth/{provider}/link | Link Google, GitHub or X to the signed-in account: returns the provider URL to open |
| GET | /v1/me | The signed-in account and its organizations |
| PATCH | /v1/me | Change the display name |
| POST | /v1/me/email | Add an email to an account without one (sends a code) |
| POST | /v1/me/email/verify | Confirm the added email with its code |
| POST | /v1/me/password | Change (or set) the password; signs out the other sessions |
| GET | /v1/me/sessions | Active sessions |
| DELETE | /v1/me/sessions/{id} | Sign out one session |
| POST | /v1/me/sessions/revoke-others | Sign out every other session |
| DELETE | /v1/me/identities/{provider} | Unlink Google, GitHub or X (one sign-in method must remain) |
| GET | /v1/me/security-events | Recent sign-ins and security changes of this account |
GET/v1/auth/providers#
Which sign-in methods are on
- Operation id:
PlatformAuthController_providers(contract name:listAuthProviders) - Authentication: None (public)
Response#
Status 200.
| Name | Type | Required | Notes |
|---|---|---|---|
object | string (auth_providers) | yes | |
providers | array of object | yes | |
signup | object | yes |
Notes#
- A method that is switched off is hidden here, and its routes return 403 METHOD_DISABLED.
GET/v1/auth/csrf#
The CSRF token (also set as the __Host-terra_csrf cookie); send it as X-Terra-CSRF on every write
- Operation id:
PlatformAuthController_csrfToken - Authentication: None (public)
Response#
Status 200.
POST/v1/auth/signup#
Create an account (sends a 6-digit code and a link; the answer is the same whether or not the email exists)
- Operation id:
PlatformAuthController_signup(contract name:signUp) - Authentication: None (public)
Request body#
| Name | Type | Required | Notes |
|---|---|---|---|
email | string (email) | yes | length 3 to 254 |
password | string | yes | length 10 to 128 |
name | string | yes | length 1 to 100 |
turnstileToken | string | yes | length 1 to 2048 |
Response#
Status 201.
Errors#
| Status | Code | When |
|---|---|---|
| 403 | METHOD_DISABLED | Email sign-up is switched off. |
POST/v1/auth/verify-email#
Confirm the sign-up code and start a session
- Operation id:
PlatformAuthController_verifyEmail(contract name:verifyEmail) - Authentication: None (public)
Request body#
| Name | Type | Required | Notes |
|---|---|---|---|
email | string (email) | yes | length 3 to 254 |
code | string | yes | pattern ^\d{6}$ |
Response#
Status 200.
| Name | Type | Required | Notes |
|---|---|---|---|
object | string (session) | yes | |
session | object | yes | |
user | object | yes | |
csrf_token | string | yes |
POST/v1/auth/login#
Sign in with email and password
- Operation id:
PlatformAuthController_login(contract name:logIn) - Authentication: None (public)
Request body#
| Name | Type | Required | Notes |
|---|---|---|---|
email | string (email) | yes | length 3 to 254 |
password | string | yes | length 1 to 128 |
turnstileToken | string | yes | length 1 to 2048 |
Response#
Status 200.
Notes#
- Lockout after 10 failures in 15 minutes per account, plus exponential backoff.
POST/v1/auth/mfa/verify#
The authenticator step of a sign-in (TOTP or a recovery code)
- Operation id:
PlatformAuthController_mfaVerify(contract name:verifyMfa) - Authentication: None (public)
Request body#
| Name | Type | Required | Notes |
|---|---|---|---|
mfa_token | string | yes | pattern ^[A-Za-z0-9_-]{43}$ |
code | string | yes | length 6 to 32 |
Response#
Status 200.
| Name | Type | Required | Notes |
|---|---|---|---|
object | string (session) | yes | |
session | object | yes | |
user | object | yes | |
csrf_token | string | yes |
POST/v1/auth/logout#
Sign out (revokes this session)
- Operation id:
PlatformAuthController_logout(contract name:logOut) - Authentication: Dashboard session
Response#
Status 200.
POST/v1/auth/password/forgot#
Send a reset link (always the same answer)
- Operation id:
PlatformAuthController_forgot(contract name:forgotPassword) - Authentication: None (public)
Request body#
| Name | Type | Required | Notes |
|---|---|---|---|
email | string (email) | yes | length 3 to 254 |
turnstileToken | string | yes | length 1 to 2048 |
Response#
Status 200.
POST/v1/auth/password/reset#
Choose a new password with the emailed token (signs out every session)
- Operation id:
PlatformAuthController_reset(contract name:resetPassword) - Authentication: None (public)
Request body#
| Name | Type | Required | Notes |
|---|---|---|---|
token | string | yes | length 0 to 128 |
password | string | yes | length 10 to 128 |
Response#
Status 200.
POST/v1/auth/mfa/totp/setup#
Start authenticator setup: returns the otpauth URL for the QR code
- Operation id:
PlatformAuthController_totpSetup(contract name:setupTotp) - Authentication: Dashboard session
Response#
Status 200.
POST/v1/auth/mfa/totp/enable#
Turn on two-step sign-in; returns 10 recovery codes once
- Operation id:
PlatformAuthController_totpEnable(contract name:enableTotp) - Authentication: Dashboard session
Request body#
| Name | Type | Required | Notes |
|---|---|---|---|
code | string | yes | pattern ^\d{6}$ |
Response#
Status 200.
POST/v1/auth/mfa/totp/disable#
Turn off two-step sign-in (needs a current authenticator code)
- Operation id:
PlatformAuthController_totpDisable(contract name:disableTotp) - Authentication: Dashboard session
Request body#
| Name | Type | Required | Notes |
|---|---|---|---|
code | string | yes | pattern ^\d{6}$ |
Response#
Status 200.
POST/v1/auth/mfa/step-up#
Confirm with an authenticator code before live actions (valid 15 minutes)
- Operation id:
PlatformAuthController_stepUp - Authentication: Dashboard session
Request body#
| Name | Type | Required | Notes |
|---|---|---|---|
code | string | yes | pattern ^\d{6}$ |
Response#
Status 200.
POST/v1/auth/mfa/recovery-codes#
Replace the recovery codes (needs an authenticator code); shown once
- Operation id:
PlatformAuthController_recoveryCodes - Authentication: Dashboard session
Request body#
| Name | Type | Required | Notes |
|---|---|---|---|
code | string | yes | pattern ^\d{6}$ |
Response#
Status 200.
GET/v1/auth/oauth/{provider}/start#
Start Google, GitHub or X sign-in (302 to the provider)
- Operation id:
PlatformAuthController_start(contract name:startOAuth) - Authentication: None (public)
Path parameters#
| Name | Type | Required | Notes |
|---|---|---|---|
provider | string | yes | google | github | x |
Query parameters#
| Name | Type | Required | Notes |
|---|---|---|---|
redirect | string | no |
Response#
Status 302.
Redirect
GET/v1/auth/oauth/{provider}/callback#
The provider's callback (302 to the dashboard, or to /signin?error=CODE)
- Operation id:
PlatformAuthController_callback(contract name:oauthCallback) - Authentication: None (public)
Path parameters#
| Name | Type | Required | Notes |
|---|---|---|---|
provider | string | yes | google | github | x |
Response#
Status 302.
Redirect
Notes#
- An OAuth identity links to an existing account only when the provider's email is verified and equals the account's verified email.
- Identities are keyed by provider and provider user id, never by email.
- X may return no email: the account is then created without one, and an email must be added and verified before creating keys.
POST/v1/auth/oauth/{provider}/link#
Link Google, GitHub or X to the signed-in account: returns the provider URL to open
- Operation id:
PlatformAuthController_link - Authentication: Dashboard session
Path parameters#
| Name | Type | Required | Notes |
|---|---|---|---|
provider | string | yes | google | github | x |
Request body#
| Name | Type | Required | Notes |
|---|---|---|---|
redirect | string | no | length 0 to 512 |
Response#
Status 200.
GET/v1/me#
The signed-in account and its organizations
- Operation id:
PlatformMeController_me(contract name:getMe) - Authentication: Dashboard session
Response#
Status 200.
| Name | Type | Required | Notes |
|---|---|---|---|
user | object | yes | |
orgs | array of object | yes |
PATCH/v1/me#
Change the display name
- Operation id:
PlatformMeController_update - Authentication: Dashboard session
Request body#
| Name | Type | Required | Notes |
|---|---|---|---|
name | string | yes | length 1 to 100 |
Response#
Status 200.
| Name | Type | Required | Notes |
|---|---|---|---|
user | object | yes | |
orgs | array of object | yes |
POST/v1/me/email#
Add an email to an account without one (sends a code)
- Operation id:
PlatformMeController_addEmail - Authentication: Dashboard session
Request body#
| Name | Type | Required | Notes |
|---|---|---|---|
email | string (email) | yes | length 3 to 254 |
Response#
Status 200.
POST/v1/me/email/verify#
Confirm the added email with its code
- Operation id:
PlatformMeController_confirmEmail - Authentication: Dashboard session
Request body#
| Name | Type | Required | Notes |
|---|---|---|---|
code | string | yes | pattern ^\d{6}$ |
Response#
Status 200.
| Name | Type | Required | Notes |
|---|---|---|---|
user | object | yes | |
orgs | array of object | yes |
POST/v1/me/password#
Change (or set) the password; signs out the other sessions
- Operation id:
PlatformMeController_changePassword - Authentication: Dashboard session
Request body#
| Name | Type | Required | Notes |
|---|---|---|---|
current_password | string | no | length 1 to 128 |
new_password | string | yes | length 10 to 128 |
Response#
Status 200.
GET/v1/me/sessions#
Active sessions
- Operation id:
PlatformMeController_listSessions - Authentication: Dashboard session
Response#
Status 200.
| Name | Type | Required | Notes |
|---|---|---|---|
data | array of object | no |
DELETE/v1/me/sessions/{id}#
Sign out one session
- Operation id:
PlatformMeController_revokeSession - Authentication: Dashboard session
Path parameters#
| Name | Type | Required | Notes |
|---|---|---|---|
id | string | yes | ses_... |
Response#
Status 200.
POST/v1/me/sessions/revoke-others#
Sign out every other session
- Operation id:
PlatformMeController_revokeOthers - Authentication: Dashboard session
Response#
Status 200.
DELETE/v1/me/identities/{provider}#
Unlink Google, GitHub or X (one sign-in method must remain)
- Operation id:
PlatformMeController_unlink - Authentication: Dashboard session
Path parameters#
| Name | Type | Required | Notes |
|---|---|---|---|
provider | string | yes | google | github | x |
Response#
Status 200.
GET/v1/me/security-events#
Recent sign-ins and security changes of this account
- Operation id:
PlatformMeController_securityEvents - Authentication: Dashboard session
Query parameters#
| Name | Type | Required | Notes |
|---|---|---|---|
limit | integer | no | |
starting_after | string | no |
Response#
Status 200.