openapi: 3.0.3
info:
title: Stytch B2B Authentication Application Passwords API
version: 2.0.0
description: Stytch's B2B API for multi-tenant authentication. Supports Organizations, Members, SSO (SAML/OIDC), Magic Links, OTP, OAuth, Discovery, Sessions, B2B RBAC, SCIM, TOTP, Recovery Codes, Passwords, Impersonation, and the B2B IDP.
contact:
name: Stytch
url: https://stytch.com/docs
license:
name: Proprietary
servers:
- url: https://api.stytch.com
description: Production
- url: https://test.stytch.com
description: Test
tags:
- name: Passwords
paths:
/v1/passwords/email/reset/start:
post:
summary: Resetstart
operationId: api_password_v1_passwords_email_ResetStart
tags:
- Passwords
description: Initiates a password reset for the email address provided. This will trigger an email to be sent to the address, containing a magic link that will allow them to set a new password and authenticate.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/api_password_v1_passwords_email_ResetStartRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/api_password_v1_passwords_email_ResetStartResponse'
'400':
description: Bad request
'401':
description: Unauthorized
content:
application/json:
example:
status_code: 401
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: unauthorized_credentials
error_message: Unauthorized credentials.
error_url: https://stytch.com/docs/api/errors/401
'429':
description: Too Many Requests
content:
application/json:
example:
status_code: 429
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: too_many_requests
error_message: Too many requests have been made.
error_url: https://stytch.com/docs/api/errors/429
'500':
description: Internal server error
content:
application/json:
example:
status_code: 500
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: internal_server_error
error_message: Oops, something seems to have gone wrong, please reach out to support@stytch.com to let us know what went wrong.
error_url: https://stytch.com/docs/api/errors/500
x-code-samples:
- lang: csharp
label: C#
source: "// POST /v1/passwords/email/reset/start\nconst stytch = require('stytch');\n\nconst client = new stytch.Client({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n email: \"${email}\",\n};\n\nclient.Passwords.Email.ResetStart(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: go
label: Go
source: "// POST /v1/passwords/email/reset/start\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/stytchauth/stytch-go/v17/stytch/consumer/passwords/email\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/consumer/stytchapi\"\n)\n\nfunc main() {\n\tclient, err := stytchapi.NewClient(\n\t\t\"${projectId}\",\n\t\t\"${secret}\",\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"error instantiating client: %v\", err)\n\t}\n\n\tparams := &email.ResetStartParams{\n\t\tEmail: \"${email}\",\n\t}\n\n\tresp, err := client.Passwords.Email.ResetStart(context.Background(), params)\n\tif err != nil {\n\t\tlog.Fatalf(\"error in method call: %v\", err)\n\t}\n\n\tlog.Println(resp)\n}\n"
- lang: java
label: Java
source: "// POST /v1/passwords/email/reset/start\npackage com.example;\n\nimport com.stytch.java.common.StytchResult;\nimport com.stytch.java.consumer.models.passwordsemail.ResetStartRequest;\nimport com.stytch.java.consumer.StytchClient;\n\npublic class Main {\n public static void main(String[] args) {\n StytchClient.configure(\"${projectId}\", \"${secret}\");\n\n ResetStartRequest params = new ResetStartRequest();\n params.setEmail(\"${email}\");\n\n Object result = StytchClient.getPasswords().getEmail().resetStart(params);\n if (result instanceof StytchResult.Success) {\n System.out.println(((StytchResult.Success) result).getValue());\n } else {\n System.out.println(((StytchResult.Error) result).getException());\n }\n }\n}"
- lang: kotlin
label: Kotlin
source: "// POST /v1/passwords/email/reset/start\npackage com.example\n\nimport com.stytch.java.consumer.StytchClient\nimport com.stytch.java.consumer.models.passwordsemail.ResetStartRequest\n\nfun main() {\n StytchClient.configure(\n projectId = \"${projectId}\",\n secret = \"${secret}\",\n )\n\n when (\n val result =\n StytchClient.passwords.email.resetStart(\n ResetStartRequest(\n email = \"${email}\",\n ),\n )\n ) {\n is StytchResult.Success -> println(result.value)\n is StytchResult.Error -> println(result.exception)\n }\n}\n"
- lang: javascript
label: Node.js
source: "// POST /v1/passwords/email/reset/start\nconst stytch = require('stytch');\n\nconst client = new stytch.Client({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n email: \"${email}\",\n};\n\nclient.passwords.email.resetStart(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: php
label: PHP
source: "$response = $client->passwords->email->reset_start([\n 'email' => '${email}',\n]);"
- lang: python
label: Python
source: "# POST /v1/passwords/email/reset/start\nfrom stytch import Client\n\nclient = Client(\n project_id=\"${projectId}\",\n secret=\"${secret}\",\n)\n\nresp = client.passwords.email.reset_start(\n email=\"${email}\",\n)\n\nprint(resp)\n"
- lang: ruby
label: Ruby
source: "# POST /v1/passwords/email/reset/start\nrequire 'stytch'\n\nclient = Stytch::Client.new(\n project_id: \"${projectId}\",\n secret: \"${secret}\"\n)\n\nresp = client.passwords.email.reset_start(\n email: \"${email}\"\n \n)\n\nputs resp"
- lang: rust
label: Rust
source: "// POST /v1/passwords/email/reset/start\nuse stytch::consumer::client::Client;\nuse stytch::consumer::passwords_email::ResetStartRequest;\n\nfn main() {\n let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n let resp = client.passwords.email.reset_start(\n ResetStartRequest{\n email: \"${email}\",\n ..Default::default()\n }\n ).await;\n println!(\"The response is {:?}\", resp);\n}"
- lang: bash
label: cURL
source: "# POST /v1/passwords/email/reset/start\ncurl --request POST \\\n --url https://test.stytch.com/v1/passwords/email/reset/start \\\n -u '${projectId}:${secret}' \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"email\": \"${email}\"\n }'"
/v1/passwords/email/reset:
post:
summary: Reset
operationId: api_password_v1_passwords_email_Reset
tags:
- Passwords
description: 'Reset the user''s password and authenticate them. This endpoint checks that the magic link `token` is valid, hasn''t expired, or already been used – and can optionally require additional security settings, such as the IP address and user agent matching the initial reset request.
The provided password needs to meet our password strength requirements, which can be checked in advance with the password strength endpoint. If the token and password are accepted, the password is securely stored for future authentication and the user is authenticated.
Note that a successful password reset by email will revoke all active sessions for the `user_id`.'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/api_password_v1_passwords_email_ResetRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/api_password_v1_passwords_email_ResetResponse'
'400':
description: Bad request
'401':
description: Unauthorized
content:
application/json:
example:
status_code: 401
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: unauthorized_credentials
error_message: Unauthorized credentials.
error_url: https://stytch.com/docs/api/errors/401
'429':
description: Too Many Requests
content:
application/json:
example:
status_code: 429
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: too_many_requests
error_message: Too many requests have been made.
error_url: https://stytch.com/docs/api/errors/429
'500':
description: Internal server error
content:
application/json:
example:
status_code: 500
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: internal_server_error
error_message: Oops, something seems to have gone wrong, please reach out to support@stytch.com to let us know what went wrong.
error_url: https://stytch.com/docs/api/errors/500
x-code-samples:
- lang: csharp
label: C#
source: "// POST /v1/passwords/email/reset\nconst stytch = require('stytch');\n\nconst client = new stytch.Client({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n token: \"${token}\",\n password: \"${examplePassword}\",\n session_duration_minutes: 60,\n};\n\nclient.Passwords.Email.Reset(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: go
label: Go
source: "// POST /v1/passwords/email/reset\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/stytchauth/stytch-go/v17/stytch/consumer/passwords/email\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/consumer/stytchapi\"\n)\n\nfunc main() {\n\tclient, err := stytchapi.NewClient(\n\t\t\"${projectId}\",\n\t\t\"${secret}\",\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"error instantiating client: %v\", err)\n\t}\n\n\tparams := &email.ResetParams{\n\t\tToken: \"${token}\",\n\t\tPassword: \"${examplePassword}\",\n\t\tSessionDurationMinutes: 60,\n\t}\n\n\tresp, err := client.Passwords.Email.Reset(context.Background(), params)\n\tif err != nil {\n\t\tlog.Fatalf(\"error in method call: %v\", err)\n\t}\n\n\tlog.Println(resp)\n}\n"
- lang: java
label: Java
source: "// POST /v1/passwords/email/reset\npackage com.example;\n\nimport com.stytch.java.common.StytchResult;\nimport com.stytch.java.consumer.models.passwordsemail.ResetRequest;\nimport com.stytch.java.consumer.StytchClient;\n\npublic class Main {\n public static void main(String[] args) {\n StytchClient.configure(\"${projectId}\", \"${secret}\");\n\n ResetRequest params = new ResetRequest();\n params.setToken(\"${token}\");\n params.setPassword(\"${examplePassword}\");\n params.setSessionDurationMinutes(60);\n\n Object result = StytchClient.getPasswords().getEmail().reset(params);\n if (result instanceof StytchResult.Success) {\n System.out.println(((StytchResult.Success) result).getValue());\n } else {\n System.out.println(((StytchResult.Error) result).getException());\n }\n }\n}"
- lang: kotlin
label: Kotlin
source: "// POST /v1/passwords/email/reset\npackage com.example\n\nimport com.stytch.java.consumer.StytchClient\nimport com.stytch.java.consumer.models.passwordsemail.ResetRequest\n\nfun main() {\n StytchClient.configure(\n projectId = \"${projectId}\",\n secret = \"${secret}\",\n )\n\n when (\n val result =\n StytchClient.passwords.email.reset(\n ResetRequest(\n token = \"${token}\",\n password = \"${examplePassword}\",\n sessionDurationMinutes = 60,\n ),\n )\n ) {\n is StytchResult.Success -> println(result.value)\n is StytchResult.Error -> println(result.exception)\n }\n}\n"
- lang: javascript
label: Node.js
source: "// POST /v1/passwords/email/reset\nconst stytch = require('stytch');\n\nconst client = new stytch.Client({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n token: \"${token}\",\n password: \"${examplePassword}\",\n session_duration_minutes: 60,\n};\n\nclient.passwords.email.reset(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: php
label: PHP
source: "$response = $client->passwords->email->reset([\n 'token' => '${token}',\n 'password' => '${examplePassword}',\n 'session_duration_minutes' => 60,\n]);"
- lang: python
label: Python
source: "# POST /v1/passwords/email/reset\nfrom stytch import Client\n\nclient = Client(\n project_id=\"${projectId}\",\n secret=\"${secret}\",\n)\n\nresp = client.passwords.email.reset(\n token=\"${token}\",\n password=\"${examplePassword}\",\n session_duration_minutes=60,\n)\n\nprint(resp)\n"
- lang: ruby
label: Ruby
source: "# POST /v1/passwords/email/reset\nrequire 'stytch'\n\nclient = Stytch::Client.new(\n project_id: \"${projectId}\",\n secret: \"${secret}\"\n)\n\nresp = client.passwords.email.reset(\n token: \"${token}\",\n password: \"${examplePassword}\",\n session_duration_minutes: 60\n \n)\n\nputs resp"
- lang: rust
label: Rust
source: "// POST /v1/passwords/email/reset\nuse stytch::consumer::client::Client;\nuse stytch::consumer::passwords_email::ResetRequest;\n\nfn main() {\n let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n let resp = client.passwords.email.reset(\n ResetRequest{\n token: \"${token}\",\n password: \"${examplePassword}\",\n session_duration_minutes: 60,\n ..Default::default()\n }\n ).await;\n println!(\"The response is {:?}\", resp);\n}"
- lang: bash
label: cURL
source: "# POST /v1/passwords/email/reset\ncurl --request POST \\\n --url https://test.stytch.com/v1/passwords/email/reset \\\n -u '${projectId}:${secret}' \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"token\": \"${token}\",\n \"password\": \"${examplePassword}\",\n \"session_duration_minutes\": 60\n }'"
/v1/passwords/existing_password/reset:
post:
summary: Reset
operationId: api_password_v1_passwords_existing_password_Reset
tags:
- Passwords
description: 'Reset the User''s password using their existing password.
Note that a successful password reset via an existing password will revoke all active sessions for the `user_id`.'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/api_password_v1_passwords_existing_password_ResetRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/api_password_v1_passwords_existing_password_ResetResponse'
'400':
description: Bad request
'401':
description: Unauthorized
content:
application/json:
example:
status_code: 401
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: unauthorized_credentials
error_message: Unauthorized credentials.
error_url: https://stytch.com/docs/api/errors/401
'429':
description: Too Many Requests
content:
application/json:
example:
status_code: 429
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: too_many_requests
error_message: Too many requests have been made.
error_url: https://stytch.com/docs/api/errors/429
'500':
description: Internal server error
content:
application/json:
example:
status_code: 500
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: internal_server_error
error_message: Oops, something seems to have gone wrong, please reach out to support@stytch.com to let us know what went wrong.
error_url: https://stytch.com/docs/api/errors/500
x-code-samples:
- lang: csharp
label: C#
source: "// POST /v1/passwords/existing_password/reset\nconst stytch = require('stytch');\n\nconst client = new stytch.Client({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n email: \"${email}\",\n existing_password: \"old_password\",\n new_password: \"${examplePassword}\",\n session_duration_minutes: 60,\n};\n\nclient.Passwords.ExistingPassword.Reset(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: go
label: Go
source: "// POST /v1/passwords/existing_password/reset\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/stytchauth/stytch-go/v17/stytch/consumer/passwords/existingpassword\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/consumer/stytchapi\"\n)\n\nfunc main() {\n\tclient, err := stytchapi.NewClient(\n\t\t\"${projectId}\",\n\t\t\"${secret}\",\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"error instantiating client: %v\", err)\n\t}\n\n\tparams := &existingpassword.ResetParams{\n\t\tEmail: \"${email}\",\n\t\tExistingPassword: \"old_password\",\n\t\tNewPassword: \"${examplePassword}\",\n\t\tSessionDurationMinutes: 60,\n\t}\n\n\tresp, err := client.Passwords.ExistingPassword.Reset(context.Background(), params)\n\tif err != nil {\n\t\tlog.Fatalf(\"error in method call: %v\", err)\n\t}\n\n\tlog.Println(resp)\n}\n"
- lang: java
label: Java
source: "// POST /v1/passwords/existing_password/reset\npackage com.example;\n\nimport com.stytch.java.common.StytchResult;\nimport com.stytch.java.consumer.models.passwordsexistingpassword.ResetRequest;\nimport com.stytch.java.consumer.StytchClient;\n\npublic class Main {\n public static void main(String[] args) {\n StytchClient.configure(\"${projectId}\", \"${secret}\");\n\n ResetRequest params = new ResetRequest();\n params.setEmail(\"${email}\");\n params.setExistingPassword(\"old_password\");\n params.setNewPassword(\"${examplePassword}\");\n params.setSessionDurationMinutes(60);\n\n Object result = StytchClient.getPasswords().getExistingPassword().reset(params);\n if (result instanceof StytchResult.Success) {\n System.out.println(((StytchResult.Success) result).getValue());\n } else {\n System.out.println(((StytchResult.Error) result).getException());\n }\n }\n}"
- lang: kotlin
label: Kotlin
source: "// POST /v1/passwords/existing_password/reset\npackage com.example\n\nimport com.stytch.java.consumer.StytchClient\nimport com.stytch.java.consumer.models.passwordsexistingpassword.ResetRequest\n\nfun main() {\n StytchClient.configure(\n projectId = \"${projectId}\",\n secret = \"${secret}\",\n )\n\n when (\n val result =\n StytchClient.passwords.existingPassword.reset(\n ResetRequest(\n email = \"${email}\",\n existingPassword = \"old_password\",\n newPassword = \"${examplePassword}\",\n sessionDurationMinutes = 60,\n ),\n )\n ) {\n is StytchResult.Success -> println(result.value)\n is StytchResult.Error -> println(result.exception)\n }\n}\n"
- lang: javascript
label: Node.js
source: "// POST /v1/passwords/existing_password/reset\nconst stytch = require('stytch');\n\nconst client = new stytch.Client({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n email: \"${email}\",\n existing_password: \"old_password\",\n new_password: \"${examplePassword}\",\n session_duration_minutes: 60,\n};\n\nclient.passwords.existingPassword.reset(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: php
label: PHP
source: "$response = $client->passwords->existing_password->reset([\n 'email' => '${email}',\n 'existing_password' => 'old_password',\n 'new_password' => '${examplePassword}',\n 'session_duration_minutes' => 60,\n]);"
- lang: python
label: Python
source: "# POST /v1/passwords/existing_password/reset\nfrom stytch import Client\n\nclient = Client(\n project_id=\"${projectId}\",\n secret=\"${secret}\",\n)\n\nresp = client.passwords.existing_password.reset(\n email=\"${email}\",\n existing_password=\"old_password\",\n new_password=\"${examplePassword}\",\n session_duration_minutes=60,\n)\n\nprint(resp)\n"
- lang: ruby
label: Ruby
source: "# POST /v1/passwords/existing_password/reset\nrequire 'stytch'\n\nclient = Stytch::Client.new(\n project_id: \"${projectId}\",\n secret: \"${secret}\"\n)\n\nresp = client.passwords.existing_password.reset(\n email: \"${email}\",\n existing_password: \"old_password\",\n new_password: \"${examplePassword}\",\n session_duration_minutes: 60\n \n)\n\nputs resp"
- lang: rust
label: Rust
source: "// POST /v1/passwords/existing_password/reset\nuse stytch::consumer::client::Client;\nuse stytch::consumer::passwords_existing_password::ResetRequest;\n\nfn main() {\n let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n let resp = client.passwords.existing_password.reset(\n ResetRequest{\n email: \"${email}\",\n existing_password: \"old_password\",\n new_password: \"${examplePassword}\",\n session_duration_minutes: 60,\n ..Default::default()\n }\n ).await;\n println!(\"The response is {:?}\", resp);\n}"
- lang: bash
label: cURL
source: "# POST /v1/passwords/existing_password/reset\ncurl --request POST \\\n --url https://test.stytch.com/v1/passwords/existing_password/reset \\\n -u '${projectId}:${secret}' \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"email\": \"${email}\",\n \"existing_password\": \"old_password\",\n \"new_password\": \"${examplePassword}\",\n \"session_duration_minutes\": 60\n }'"
/v1/passwords/session/reset:
post:
summary: Reset
operationId: api_password_v1_passwords_session_Reset
tags:
- Passwords
description: 'Reset the user’s password using their existing session. The endpoint will error if the session does not have a password, email magic link, or email OTP authentication factor that has been issued within the last 5 minutes. This endpoint requires either a `session_jwt` or `session_token` be included in the request.
Note that a successful password reset via an existing session will revoke all active sessions for the `user_id`, except for the one used during the reset flow.'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/api_password_v1_passwords_session_ResetRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/api_password_v1_passwords_session_ResetResponse'
'400':
description: Bad request
'401':
description: Unauthorized
content:
application/json:
example:
status_code: 401
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: unauthorized_credentials
error_message: Unauthorized credentials.
error_url: https://stytch.com/docs/api/errors/401
'429':
description: Too Many Requests
content:
application/json:
example:
status_code: 429
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: too_many_requests
error_message: Too many requests have been made.
error_url: https://stytch.com/docs/api/errors/429
'500':
description: Internal server error
content:
application/json:
example:
status_code: 500
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: internal_server_error
error_message: Oops, something seems to have gone wrong, please reach out to support@stytch.com to let us know what went wrong.
error_url: https://stytch.com/docs/api/errors/500
x-code-samples:
- lang: csharp
label: C#
source: "// POST /v1/passwords/session/reset\nconst stytch = require('stytch');\n\nconst client = new stytch.Client({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n password: \"${examplePassword}\",\n session_token: \"${sessionToken}\",\n session_duration_minutes: 60,\n};\n\nclient.Passwords.Sessions.Reset(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: go
label: Go
source: "// POST /v1/passwords/session/reset\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/stytchauth/stytch-go/v17/stytch/consumer/passwords/session\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/consumer/stytchapi\"\n)\n\nfunc main() {\n\tclient, err := stytchapi.NewClient(\n\t\t\"${projectId}\",\n\t\t\"${secret}\",\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"error instantiating client: %v\", err)\n\t}\n\n\tparams := &session.ResetParams{\n\t\tPassword: \"${examplePassword}\",\n\t\tSessionToken: \"${sessionToken}\",\n\t\tSessionDurationMinutes: 60,\n\t}\n\n\tresp, err := client.Passwords.Sessions.Reset(context.Background(), params)\n\tif err != nil {\n\t\tlog.Fatalf(\"error in method call: %v\", err)\n\t}\n\n\tlog.Println(resp)\n}\n"
- lang: java
label: Java
source: "// POST /v1/passwords/session/reset\npackage com.example;\n\nimport com.stytch.java.common.StytchResult;\nimport com.stytch.java.consumer.models.passwordssession.ResetRequest;\nimport com.stytch.java.consumer.StytchClient;\n\npublic class Main {\n public static void main(String[] args) {\n StytchClient.configure(\"${projectId}\", \"${secret}\");\n\n ResetRequest params = new ResetRequest();\n params.setPassword(\"${examplePassword}\");\n params.setSessionToken(\"${sessionToken}\");\n params.setSessionDurationMinutes(60);\n\n Object result = StytchClient.getPasswords().getSessions().reset(params);\n if (result instanceof StytchResult.Success) {\n System.out.println(((StytchResult.Success) result).getValue());\n } else {\n System.out.println(((StytchResult.Error) result).getException());\n }\n }\n}"
- lang: kotlin
label: Kotlin
source: "// POST /v1/passwords/session/reset\npackage com.example\n\nimport com.stytch.java.consumer.StytchClient\nimport com.stytch.java.consumer.models.passwordssession.ResetRequest\n\nfun main() {\n StytchClient.configure(\n projectId = \"${projectId}\",\n secret = \"${secret}\",\n )\n\n when (\n val result =\n StytchClient.passwords.sessions.reset(\n ResetRequest(\n password = \"${examplePassword}\",\n sessionToken = \"${sessionToken}\",\n sessionDurationMinutes = 60,\n ),\n )\n ) {\n is StytchResult.Success -> println(result.value)\n is StytchResult.Error -> println(result.exception)\n }\n}\n"
- lang: javascript
label: Node.js
source: "// POST /v1/passwords/session/reset\nconst stytch = require('stytch');\n\nconst client = new stytch.Client({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n password: \"${examplePassword}\",\n session_token: \"${sessionToken}\",\n session_duration_minutes: 60,\n};\n\nclient.passwords.sessions.reset(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: php
label: PHP
source: "$response = $client->passwords->sessions->reset([\n 'password' => '${examplePassword}',\n 'session_token' => '${sessionToken}',\n 'session_duration_minutes' => 60,\n]);"
- lang: python
label: Python
source: "# POST /v1/passwords/session/reset\nfrom stytch import Client\n\nclient = Client(\n project_id=\"${projectId}\",\n secret=\"${secret}\",\n)\n\nresp = client.passwords.sessions.reset(\n password=\"${examplePassword}\",\n session_token=\"${sessionToken}\",\n session_duration_minutes=60,\n)\n\nprint(resp)\n"
- lang: ruby
label: Ruby
source: "# POST /v1/passwords/session/reset\nrequire 'stytch'\n\nclient = Stytch::Client.new(\n project_id: \"${projectId}\",\n secret: \"${secret}\"\n)\n\nresp = client.passwords.sessions.reset(\n password: \"${examplePassword}\",\n session_token: \"${sessionToken}\",\n session_duration_minutes: 60\n \n)\n\nputs resp"
- lang: rust
label: Rust
source: "// POST /v1/passwords/session/reset\nuse stytch::consumer::client::Client;\nuse stytch::consumer::passwords_session::ResetRequest;\n\nfn main() {\n let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n let resp = client.passwords.sessions.reset(\n ResetRequest{\n password: \"${examplePassword}\",\n session_token: Some(String::from(\"${sessionToken}\")),\n session_duration_minutes: 60,\n ..Default::default()\n }\n ).await;\n println!(\"The response is {:?}\", resp);\n}"
- lang: bash
label: cURL
source: "# POST /v1/passwords/session/reset\ncurl --request POST \\\n --url https://test.stytch.com/v1/passwords/session/reset \\\n -u '${projectId}:${secret}' \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"password\": \"${examplePassword}\",\n \"session_token\": \"${sessionToken}\",\n \"session_duration_minutes\": 60\n }'"
components:
schemas:
api_password_v1_passwords_email_ResetStartRequest:
type: object
properties:
email:
type: string
description: The email of the User that requested the password reset.
reset_password_redirect_url:
type: string
description: "The URL that the User is redirected to from the reset password magic link. This URL should display your application's reset password page.\n Before rendering the reset page, extract the `token` from the query parameters. On the reset page, collect the new password and complete the flow by calling the corresponding Password Reset by Email endpoint.\n If this parameter is not specified, the default Reset Password redirect URL configured in the Dashboard will
# --- truncated at 32 KB (86 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/stytch/refs/heads/main/openapi/stytch-passwords-api-openapi.yml