Skip to content
ApiqDevelopers
API v1.64.0Open console
API referenceidentity

Set first password

POST/v1/auth/password/set
Accepts bearer

Set the first password of an account that has none; every OTHER session of the user is revoked

Console session only (an access token): an API key is 403 PERMISSION_DENIED details.reason ACCESS_TOKEN_REQUIRED.Show moreConsole session only (an access token): an API key is 403 PERMISSION_DENIED details.reason ACCESS_TOKEN_REQUIRED. The credential is checked before the body is parsed. An account that already has a password is 403 PERMISSION_DENIED details.reason PASSWORD_ALREADY_SET; it uses POST /v1/auth/password/change. Proof: when the user has an MFA factor enrolled, exactly one of stepUpCode and stepUpAssertion is required; neither, both or a wrong one is 403 PERMISSION_DENIED details.reason STEP_UP_FAILED, and a user locked out of step-up is STEP_UP_LOCKED. With no factor enrolled the session must be recent: signed in no more than 15 minutes ago (the session's sign-in time; a refresh does not renew it), otherwise 403 PERMISSION_DENIED details.reason STEP_UP_REQUIRED, whose message tells the person to use forgot and reset (POST /v1/auth/password/forgot). newPassword follows the password policy (12 to 1024 characters). On success every other session family of the user is revoked (reason PASSWORD_SET; their refresh is 401 SESSION_REVOKED) and the caller's own session stays; POST /v1/auth/login and /v1/auth/sign-in then accept the password. Rate-limited 60 per client IP and 10 per user, as change is. No Idempotency-Key. Plain JSON, not an envelope. No new error code: PASSWORD_ALREADY_SET and STEP_UP_REQUIRED are new details.reason values of PERMISSION_DENIED.

Request body

  • newPasswordstringRequired
  • stepUpCodestringOptional
    A current code from the caller's MFA factor; required when one is enrolled
  • stepUpAssertionWebAuthnAssertionOptional
    A WebAuthn assertion (the JSON of a PublicKeyCredential from navigator.credentials.get), every binary value base64url.Show moreA WebAuthn assertion (the JSON of a PublicKeyCredential from navigator.credentials.get), every binary value base64url. The stepUpAssertion of every step-up-guarded body. Obtain the challenge from POST /ops/v1/auth/mfa/step-up/webauthn-options.
    5 child attributes
    • idstringRequired
      The credential id, base64url
    • rawIdstringRequired
      The credential id, base64url
    • typestringRequired
      • public-key
    • responseobjectRequired
      4 child attributes
      • clientDataJSONstringRequired
        base64url
      • authenticatorDatastringRequired
        base64url
      • signaturestringRequired
        base64url
      • userHandlestringOptional
        base64url, or null when the authenticator returns none
    • clientExtensionResultsobjectOptional

Responses

  • 204Set; other sessions revoked
  • 400VALIDATION — the policy (details.field newPassword, minLength) or a malformed bodyApiErrorResponse
  • 401
    UNAUTHENTICATED — missing or expired token.Show moreUNAUTHENTICATED — missing or expired token. Declared on every operation because `security` is declared globally at the document root: every route is authenticated, so every route can answer 401.
    ApiErrorResponse
  • 403PERMISSION_DENIED — ACCESS_TOKEN_REQUIRED for an API key, PASSWORD_ALREADY_SET, STEP_UP_REQUIRED (no factor and a session older than 15 minutes), STEP_UP_FAILED or STEP_UP_LOCKEDApiErrorResponse
  • 405
    VALIDATION — the public edge serves GET, POST, PUT, PATCH and DELETE only; any other method is refused before the platform sees it (details.reason METHOD_NOT_ALLOWED, details.source edge).Show moreVALIDATION — the public edge serves GET, POST, PUT, PATCH and DELETE only; any other method is refused before the platform sees it (details.reason METHOD_NOT_ALLOWED, details.source edge). Not retryable as sent.
    ApiErrorResponse
  • 413
    VALIDATION — the request body is larger than the surface's limit.Show moreVALIDATION — the request body is larger than the surface's limit. Not retryable as sent: shrink the body. Declared on every operation that takes a request body. details carries exactly one key, maxBodyBytes (integer): the limit that applies to this surface, in bytes.
    ApiErrorResponse
  • 414
    VALIDATION — the request URI (path and query string) is longer than 8 KiB; the public edge refuses it before the platform sees it (details.reason URI_TOO_LONG, details.source edge).Show moreVALIDATION — the request URI (path and query string) is longer than 8 KiB; the public edge refuses it before the platform sees it (details.reason URI_TOO_LONG, details.source edge). Not retryable as sent: send long input in the body of a POST.
    ApiErrorResponse
  • 415
    VALIDATION — a request body that is not JSON (application/json or application/*+json; a form body only on the OAuth token routes).Show moreVALIDATION — a request body that is not JSON (application/json or application/*+json; a form body only on the OAuth token routes). The public edge refuses it before the platform sees it (details.reason UNSUPPORTED_MEDIA_TYPE, details.source edge). Not retryable as sent: send Content-Type application/json. Declared on every operation that takes a JSON request body.
    ApiErrorResponse
  • 429
    Counted in fixed windows (default 15 min).Show moreCounted in fixed windows (default 15 min). The signup, login, password and invite routes count every attempt per client address AND per subject (the email, the username + site, or the invite token). POST /v1/oauth/token is counted three ways, none of them on client_id alone, so knowing a client_id (which is not secret) never lets anyone spend its holder's budget: oauth-token counts every attempt per client address only; oauth-token-failure counts FAILED client authentications per client address and per (client address, client_id) pair; oauth-token-issued counts tokens issued per client_id only, and only a request whose secret, grant_type and scope all passed can spend it. details.reason says which limit tripped (CLIENT_RATE_LIMITED | SUBJECT_RATE_LIMITED) and details.action which count (signup | signup-verify | login | password-forgot | password-reset | invite-accept | oauth-token | oauth-token-failure | oauth-token-issued). Retry-After is whole seconds to the end of the window, and details.retryAfterMs mirrors it. The answer is the same whether or not the account or key exists, so the limit cannot be used to enumerate accounts, and nothing the caller sent is echoed. adds three counts per client address for the MCP grant routes: oauth-authorize (GET /v1/oauth/authorize, which may fetch a Client ID Metadata Document), oauth-register (POST /v1/oauth/register) and oauth-device (POST /v1/oauth/device_authorization), and one count per MCP grant, oauth-exchange-grant (the token exchange of POST /v1/oauth/token, counted per grant after the exchange client and the subject token verified, default 120 a minute), whose details.reason is EXCHANGE_RATE_LIMITED.
    ApiErrorResponse
  • 500INTERNAL — a bug, and traceId is the support handle.ApiErrorResponse

Errors you should handle

Branch on code and honour retryable — never on the HTTP status alone.

400VALIDATION
newPassword must be 12 to 1024 characters long.
not retryable
401UNAUTHENTICATED
The bearer token is expired. Re-authenticate and retry.
not retryable
403PERMISSION_DENIED
This operation needs a console session (an access token), not an API key.
not retryable
405VALIDATION
This method is not served.
not retryable
413VALIDATION
The request body is larger than this API accepts (262144 bytes).
not retryable
414VALIDATION
The request URI is longer than 8 KiB.
not retryable
415VALIDATION
Send application/json.
not retryable
429RATE_LIMITED
Too many requests of this kind for this address or account. Wait for the Retry-After interval before trying again.
retryable
500INTERNAL
An unexpected error occurred. Quote the traceId to support.
retryable