Skip to content

Auth endpoints

Every endpoint under /auth/v1 and /auth/v1/admin, with what it takes and returns.

Applies to EngineCloud
View as Markdown
On this page
  1. Sign-up and sign-in
  2. Links, codes and recovery
  3. The signed-in user
  4. Providers
  5. Admin (secret key)

All take the project key in apikey. Signed-in calls also send the user’s access token.

Sign-up and sign-in

POST /auth/v1/signup EngineCloud
  • email
    string required
    The person’s e-mail.
  • password
    string optional
    Optional: without it, «e-mail first».
  • data
    object optional
    Goes to user_metadata.
  • redirect_to
    string optional
    Where the confirmation link returns; must be an allowed redirect URL.
  • captcha_token
    string optional
    Required when the project has a CAPTCHA.
  • Authentication
    publishable key

    Returns the user (unconfirmed), or a session if confirmation is off. Errors: email_exists, email_unconfirmed, invalid_email, weak_password, signup_disabled, email_provider_disabled, captcha_required, 429 rate_limited, and 409 email_provider_required when the sign-up needs an e-mail and the project has no provider (the same answer from otp, recover, reauthenticate, an e-mail change and admin/invite).

    POST /auth/v1/token?grant_type=password EngineCloud
  • email
    string required
    The e-mail.
  • password
    string required
    The password.
  • captcha_token
    string optional
    Required when the project has a CAPTCHA.
  • Authentication
    publishable key

    Errors: invalid_credentials, email_not_confirmed, user_banned, captcha_required, 429 rate_limited (also while the account waits after repeated failures).

    POST /auth/v1/token?grant_type=refresh_token EngineCloud
  • refresh_token
    string required
    The current refresh token; a new one comes back.
  • Authentication
    publishable key

    Errors: invalid_refresh_token, refresh_token_reused, session_expired, session_revoked, invalid_dpop_proof (a refresh token bound to a key). A refresh token of an agent session is renewed at /auth/v1/oauth/token instead (invalid_grant here).

    POST /auth/v1/token?grant_type=pkce EngineCloud
  • auth_code
    string required
    The code from the provider redirect.
  • code_verifier
    string required
    The verifier the client kept.
  • Authentication
    publishable key

    A session:

    JSON
    { "access_token": "eyJ…", "token_type": "bearer", "expires_in": 3600, "expires_at": 1795000000,
      "refresh_token": "syp_rt_…", "user": { "id": "7c0e…", "email": "ana@example.com", "email_confirmed_at": "…", "user_metadata": {} } }
    EndpointDoes
    POST /auth/v1/otp { email, create_user?, data?, redirect_to?, captcha_token? }e-mails a sign-in link and code; create_user (default true) creates the user when the e-mail is new
    POST /auth/v1/magiclinkthe same as /auth/v1/otp
    POST /auth/v1/verify { type, token_hash } or { type, email, token }checks a link or code; returns a session. type: signup, magiclink, recovery, invite, email_change, email
    GET /auth/v1/verify?token_hash=…&type=…&redirect_to=…the same from an e-mail link; 303 to redirect_to#access_token=…
    POST /auth/v1/recover { email, redirect_to?, captcha_token? }e-mails a recovery link; always 200
    POST /auth/v1/reauthenticatee-mails a code for a sensitive change, valid 10 minutes; pass it as nonce

    The flows that send an e-mail answer {"status": "sent"}, or 202 with {"status": "email_queued_retry"} when the provider failed and the e-mail is being retried. Without a provider they answer 409 email_provider_required.

    The signed-in user

    EndpointDoes
    GET /auth/v1/userthe user, fresh
    PUT /auth/v1/user { password?, email?, data?, nonce? }changes; password needs a recent sign-in or nonce
    POST /auth/v1/logout?scope=local|others|globalends sessions
    GET /auth/v1/sessions, DELETE /auth/v1/sessions/{id}the person’s devices
    GET /auth/v1/tokens, POST /auth/v1/tokens { name, scopes, resource?, expires_at? }, DELETE /auth/v1/tokens/{id}personal access tokens; the token comes back once; expires_at: null never expires

    Changing the account (password, e-mail, PATs, sessions, linked identities) needs the person’s own session: a PAT or an app acting for them gets 403 person_required.

    Providers

    EndpointDoes
    GET /auth/v1/authorize?provider=google|github&redirect_to=…&code_challenge=…&code_challenge_method=S256starts a provider sign-in
    GET /auth/v1/user/identities/authorize?provider=…&redirect_to=…&code_challenge=…signed in: links another provider; answers { url } to open; the return gives ?code= for grant_type=pkce
    DELETE /auth/v1/user/identities/{provider}signed in: unlinks a provider; 422 last_identity when it is the last way to sign in
    GET /auth/v1/callbackwhere the provider returns; redirects to your app with ?code=
    GET /auth/v1/settingspublic: providers (email, google, github), signup_open, require_email_confirmation, password_min_length, password_requirements, captcha, project_name, email_ready

    Admin (secret key)

    EndpointDoes
    GET /auth/v1/admin/users?search=&page=&per_page=list and search: { users, total }; per_page 50 by default, up to 1 000
    POST /auth/v1/admin/userscreate (email_confirm, password, user_metadata, app_metadata)
    POST /auth/v1/admin/invite { email, data?, redirect_to? }creates the user and e-mails an invitation
    GET/PUT/DELETE /auth/v1/admin/users/{id}read, change (email, password, email_confirm, user_metadata, app_metadata, ban_duration such as 24h, 7d or none), delete
    POST /auth/v1/admin/users/{id}/logoutend every session of the user
    POST /auth/v1/admin/generate_link { type, email, redirect_to? }a link without sending it, for signup, invite, magiclink or recovery: action_link, email_otp, hashed_token, verification_type
    GET/PATCH /auth/v1/admin/settingsthe project’s settings (all of them); GET adds template_defaults, template_variables, mail_state and mail_providers
    GET/POST/PATCH/DELETE /auth/v1/admin/oauth/clients[/{id}]OAuth clients (client credentials); a secret is shown once
    POST /auth/v1/admin/oauth/registration-tokens { name, scopes?, expires_at? }an initial access token syp_iat_… for a confidential dynamic registration, shown once
    GET/POST/DELETE /auth/v1/admin/api-keys[/{id}]API keys; POST takes kind (publishable or secret), name and protected; DELETE of a protected key answers 409 protected_key; revoking the key you are calling with answers 400 not_allowed
    POST /auth/v1/admin/api-keys/{id}/rotate-protectedreplaces a protected key: the new key (shown once) and the old one revoked, in one transaction
    POST /auth/v1/admin/keys/rotatepublishes a new signing key: { next_kid }; it signs 24 hours later (signing keys)

    Every admin endpoint needs a secret key (or a service_role token); anything else gets 403 secret_key_required. All error codes: Errors and limits.

    1. Sign-up and sign-in
    2. Links, codes and recovery
    3. The signed-in user
    4. Providers
    5. Admin (secret key)

      Search pages, sections and terms