RenzoDocs

Authentication

Sign in with an email code or a social provider, use and refresh tokens, sign out, and handle every auth error.

View as Markdown

The REST API has one credential: the customer access token. It is a JWT that you send as a bearer token. You get it by signing in. Renzo does not issue API keys.

curl "$BASE/api/v1/users/me" -H "Authorization: Bearer $TOKEN"

Calls marked "Token" in these docs need it. Public reads work without it. A few public reads take it when you have one. For example, GET /api/v1/articles/{slug} returns more of a gated article.

Ways to sign in

MethodWho can use itEndpoints
Email code (OTP)Everyone. This is the method for API clients.POST/api/v1/auth/otp/request
POST/api/v1/auth/otp/verify
Social sign-inReaders on the Renzo website and apps./api/v1/auth/social/...
PasswordOnly review accounts that Renzo gives to app-store and directory reviewers.POST/api/v1/auth/password/login

All three return the same answer: a token pair, the profile, and created.

Email code (OTP)

1. Request a code.

curl -X POST "$BASE/api/v1/auth/otp/request" \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com"}'

The answer is 202:

Response
{
  "challenge_token": "ch_7Hq2mXz9Kp4TnV1b",
  "expires_at": "2026-11-04T13:45:00Z",
  "code_expires_at": "2026-11-04T13:40:00Z",
  "attempts_remaining": 5
}
  • The answer is the same whether or not the address has an account. This stops anyone from learning who has one.
  • The email holds a six-digit code and a link. The link signs in on the Renzo website. API clients use the code.
  • The code works for 10 minutes (code_expires_at). The challenge works for 15 minutes (expires_at).
  • Each request opens an independent challenge with its own code and attempt budget. Other live challenges remain usable until consumed or expired. Use the code from the email matching your sign-in request.
  • One email address gets at most one code a minute and 5 an hour. Requests are also limited per IP address: 10 in 15 minutes, shared with email-change codes. Over a limit, the answer is 429 rate_limited with Retry-After. See Rate limits.

2. Verify the code.

curl -X POST "$BASE/api/v1/auth/otp/verify" \
  -H "Content-Type: application/json" \
  -d '{"challenge_token": "ch_7Hq2mXz9Kp4TnV1b", "code": "482913", "timezone": "Europe/London"}'

Optional fields: timezone (an IANA name, saved on a new account), referral_code and referral_source (see Referrals).

The answer is 200:

Response
{
  "tokens": {
    "access_token": "eyJhbGciOiJIUzI1NiIs...example",
    "refresh_token": "eyJhbGciOiJIUzI1NiIs...refresh-example",
    "token_type": "Bearer",
    "expires_in": 900,
    "expires_at": "2026-11-04T13:45:00Z",
    "refresh_expires_at": "2026-12-04T13:30:00Z"
  },
  "profile": {
    "id": "eca8506d-1dfa-56a2-8765-96305e99f89c",
    "email": "you@example.com",
    "username": "marketwatcher",
    "status": "active",
    "country": "GB",
    "ui_language": "en",
    "article_language": "en",
    "timezone": "Europe/London",
    "currency": "USD",
    "mobile": null,
    "created_at": "2026-10-01T09:12:00Z",
    "last_login_at": "2026-11-04T13:30:00Z"
  },
  "created": false
}
  • The first sign-in creates the account. created is true and profile.status is pending_profile. Set a username with PATCH /api/v1/users/me to make it active. Until then, most writes answer 409 profile_incomplete.
  • A new account with a disposable email address is refused: 422 email_domain_not_allowed.
  • Asking for another code does not invalidate an existing challenge or spend its verification attempts. Each request receives its own code and challenge token.
  • Each wrong code lowers attempts_remaining. After 5 wrong codes the challenge is dead: otp_too_many_attempts.
  • Signing in to an account that is waiting for deletion cancels the deletion.

Password sign-in (review accounts only)

POST /api/v1/auth/password/login takes {"email": "...", "password": "..."}. It works only for review accounts that Renzo makes for app-store and directory reviewers. Every other address answers 401 invalid_credentials, even with a right password. It allows 20 tries per IP address and 5 per email address in 15 minutes.

Social sign-in

Readers can sign in with Google, Apple, Facebook, X or GitHub. GET /api/v1/auth/social/providers lists the providers that are switched on:

{ "providers": ["google", "apple", "github"] }

The provider sends the browser back to the Renzo website, not to your app. So this flow serves Renzo's own website and apps. A third-party integration should use the email code.

The flow:

  1. POST /api/v1/auth/social/{provider}/start with {"intent": "login"} returns an authorization_url. Send the browser there. The attempt lives 10 minutes and works once.
  2. The provider returns the browser with code and state. The Renzo website posts both to POST /api/v1/auth/social/{provider}/callback.
  3. The callback answers 200 with a status:
statusMeaningNext step
signed_inDone. The body holds tokens, profile and created.None.
verify_emailA six-digit code went to the provider's email address. The body holds challenge_token and masked_email.POST/api/v1/auth/social/verify with challenge_token and code.
email_requiredThe provider gave no email address. The body holds pending_token.POST/api/v1/auth/social/email with pending_token and email. A code goes there; then verify as above.
linkedA link finished (see below). The body holds identity.None.

Renzo signs in without a code only when it trusts the provider's address: a Google gmail.com or googlemail.com address, or an Apple address that is not a private relay address. Every other address gets verify_email first. POST /api/v1/auth/social/verify links the provider to the account on that address, or creates an account.

Linking a provider to an account

A signed-in customer can add a provider as a second way to sign in:

  1. POST /api/v1/auth/social/{provider}/start with {"intent": "link"} and the customer's token.
  2. The callback must carry the same customer's token. Then it answers status: "linked". Renzo emails the account a notice.

A provider account belongs to at most one Renzo account and never moves. Linking one that is on another account answers 409 identity_in_use. Linking a second account of the same provider answers 409 identity_already_linked.

GET /api/v1/users/me/identities lists the linked providers. DELETE /api/v1/users/me/identities/{provider} removes one and answers 204. It is always allowed, because the email code still works. See Account.

The token pair

FieldMeaning
access_tokenSend as Authorization: Bearer <access_token>.
token_typeAlways Bearer.
expires_inSeconds until the access token ends. Today 900 (15 minutes).
expires_atWhen the access token ends, in UTC.
refresh_tokenSwap it for a new pair before the session ends.
refresh_expires_atWhen the refresh token ends. Today 30 days after it was issued.

Treat both tokens as secrets. Answers that carry tokens are sent with Cache-Control: no-store. The lifetimes may change, so read expires_in and refresh_expires_at rather than hard-coding them.

Refresh the token pair

When the access token ends, calls answer 401 token_expired. Swap the refresh token for a new pair. No access token is needed:

curl -X POST "$BASE/api/v1/auth/refresh" \
  -H "Content-Type: application/json" \
  -d '{"refresh_token": "eyJhbGciOiJIUzI1NiIs...refresh-example"}'
Response
{
  "access_token": "eyJhbGciOiJIUzI1NiIs...example",
  "refresh_token": "eyJhbGciOiJIUzI1NiIs...refresh-example-2",
  "token_type": "Bearer",
  "expires_in": 900,
  "expires_at": "2026-11-04T14:00:00Z",
  "refresh_expires_at": "2026-12-04T13:45:00Z"
}
  • A refresh token works once. Store the new pair every time. Sending a used refresh token again ends the whole session: session_revoked. This guards against a stolen token. Run one refresh at a time, so two parallel calls do not spend the same token.
  • The session slides. Each refresh gives a refresh token with a fresh 30-day life. A session ends after 30 days without a refresh.
  • A failed refresh means the user must sign in again.

Sign out

# This session only
curl -X POST "$BASE/api/v1/auth/logout" -H "Authorization: Bearer $TOKEN"

# Every session of the account
curl -X POST "$BASE/api/v1/auth/logout-all" -H "Authorization: Bearer $TOKEN"

Both answer 204. The access token stops working at once, and the session's refresh token dies.

Auth errors

Every auth failure is a problem+json body with a stable code. See Errors.

CodeStatusWhenWhat to do
missing_credentials401No Authorization header on a call that needs one.Send the access token.
invalid_token401The token is malformed, wrongly signed or already used.Sign in again.
token_expired401The access or refresh token has ended.Refresh; if the refresh token ended, sign in again.
session_revoked401The session ended: sign-out, a reused refresh token, or account deletion.Sign in again.
wrong_token_audience401A token of another kind, such as an MCP token, was sent to the REST API.Use a customer access token.
invalid_credentials401Password sign-in failed, or the account is not a review account.Use the email code.
otp_code_incorrect401The code is wrong.Try again while attempts_remaining is above 0.
otp_code_expired401The code is older than 10 minutes.Request a new code.
otp_challenge_expired401The challenge is older than 15 minutes.Request a new code.
otp_challenge_invalid401The challenge_token is unknown or already used.Request a new code.
otp_too_many_attempts4015 wrong codes on this challenge.Request a new code.
invalid_state401The social sign-in attempt expired or was used, or a link callback came without the same token.Start again.
social_login_failed401The provider refused the code.Start again.
social_pending_invalid401The pending_token expired or is unknown.Start again.
provider_not_enabled404The provider is switched off.Use a provider from the list.
identity_in_use409The provider account is on another Renzo account.Sign in to that account instead.
identity_already_linked409The account already has an account of this provider.Unlink the old one first.
customer_account_deactivated403Staff deactivated the account.Contact support.
customer_account_deleted403The account was deleted.Sign up again.
email_domain_not_allowed422A new account with a disposable address.Use a lasting address.
rate_limited429Too many sign-in calls from this IP address.Wait Retry-After seconds.
auth_temporarily_unavailable503The sign-in limiter is down, so sign-in is paused.Retry after Retry-After seconds.
dependency_unavailable503The email or social provider did not answer.Retry after Retry-After seconds.

Next steps

  • Quickstart: the whole flow in curl, Python and JavaScript.
  • MCP: how AI apps get their own, separate tokens.
  • Rate limits: the limits on every sign-in call.

On this page