Stytch B2B Passwords API

The B2B Passwords API from Stytch — 6 operation(s) for b2b passwords.

OpenAPI Specification

stytch-b2b-passwords-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Stytch B2B Authentication Application B2B 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: B2B Passwords
paths:
  /v1/b2b/passwords/email/reset/start:
    post:
      summary: Resetstart
      operationId: api_b2b_password_v1_b2b_passwords_email_ResetStart
      tags:
      - B2B 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.


        This endpoint adapts to your Project''s password strength configuration.

        If you''re using [zxcvbn](https://stytch.com/docs/guides/passwords/strength-policy), the default, your passwords are considered valid

        if the strength score is >= 3. If you''re using [LUDS](https://stytch.com/docs/guides/passwords/strength-policy), your passwords are

        considered valid if they meet the requirements that you''ve set with Stytch.

        You may update your password strength configuration on the [Passwords Policy page](https://stytch.com/dashboard/password-strength-config) in the Stytch Dashboard.'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/api_b2b_password_v1_b2b_passwords_email_ResetStartRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_b2b_password_v1_b2b_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/b2b/passwords/email/reset/start\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n  project_id: '${projectId}',\n  secret: '${secret}',\n});\n\nconst params = {\n  organization_id: \"${organizationId}\",\n  email_address: \"${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/b2b/passwords/email/reset/start\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/stytchauth/stytch-go/v17/stytch/b2b/b2bstytchapi\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/b2b/passwords/email\"\n)\n\nfunc main() {\n\tclient, err := b2bstytchapi.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\tOrganizationID: \"${organizationId}\",\n\t\tEmailAddress:   \"${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/b2b/passwords/email/reset/start\npackage com.example;\n\nimport com.stytch.java.b2b.models.passwordsemail.ResetStartRequest;\nimport com.stytch.java.b2b.StytchB2BClient;\nimport com.stytch.java.common.StytchResult;\n\npublic class Main {\n    public static void main(String[] args) {\n        StytchB2BClient.configure(\"${projectId}\", \"${secret}\");\n\n        ResetStartRequest params = new ResetStartRequest();\n        params.setOrganizationId(\"${organizationId}\");\n        params.setEmailAddress(\"${email}\");\n\n        Object result = StytchB2BClient.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/b2b/passwords/email/reset/start\npackage com.example\n\nimport com.stytch.java.b2b.StytchB2BClient\nimport com.stytch.java.b2b.models.passwordsemail.ResetStartRequest\n\nfun main() {\n    StytchB2BClient.configure(\n        projectId = \"${projectId}\",\n        secret = \"${secret}\",\n    )\n\n    when (\n        val result =\n            StytchB2BClient.passwords.email.resetStart(\n                ResetStartRequest(\n                    organizationId = \"${organizationId}\",\n                    emailAddress = \"${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/b2b/passwords/email/reset/start\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n  project_id: '${projectId}',\n  secret: '${secret}',\n});\n\nconst params = {\n  organization_id: \"${organizationId}\",\n  email_address: \"${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    'organization_id' => '${organizationId}',\n    'email_address' => '${email}',\n]);"
      - lang: python
        label: Python
        source: "# POST /v1/b2b/passwords/email/reset/start\nfrom stytch import B2BClient\n\nclient = B2BClient(\n    project_id=\"${projectId}\",\n    secret=\"${secret}\",\n)\n\nresp = client.passwords.email.reset_start(\n    organization_id=\"${organizationId}\",\n    email_address=\"${email}\",\n)\n\nprint(resp)\n"
      - lang: ruby
        label: Ruby
        source: "# POST /v1/b2b/passwords/email/reset/start\nrequire 'stytch'\n\nclient = StytchB2B::Client.new(\n  project_id: \"${projectId}\",\n  secret: \"${secret}\"\n)\n\nresp = client.passwords.email.reset_start(\n  organization_id: \"${organizationId}\",\n  email_address: \"${email}\"\n  \n)\n\nputs resp"
      - lang: rust
        label: Rust
        source: "// POST /v1/b2b/passwords/email/reset/start\nuse stytch::b2b::client::Client;\nuse stytch::b2b::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            organization_id: \"${organizationId}\",\n            email_address: \"${email}\",\n            ..Default::default()\n        }\n    ).await;\n    println!(\"The response is {:?}\", resp);\n}"
      - lang: bash
        label: cURL
        source: "# POST /v1/b2b/passwords/email/reset/start\ncurl --request POST \\\n  --url https://test.stytch.com/v1/b2b/passwords/email/reset/start \\\n  -u '${projectId}:${secret}' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"organization_id\": \"${organizationId}\",\n    \"email_address\": \"${email}\"\n  }'"
  /v1/b2b/passwords/email/reset:
    post:
      summary: Reset
      operationId: api_b2b_password_v1_b2b_passwords_email_Reset
      tags:
      - B2B Passwords
      description: 'Reset the Member''s password and authenticate them. This endpoint checks that the password reset token is valid, hasn’t expired, or already been used.


        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.


        If the Member is required to complete MFA to log in to the Organization, the returned value of `member_authenticated` will be `false`, and an `intermediate_session_token` will be returned.

        The `intermediate_session_token` can be passed into the [OTP SMS Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-otp-sms) to complete the MFA step and acquire a full member session.

        The `session_duration_minutes` and `session_custom_claims` parameters will be ignored.


        If a valid `session_token` or `session_jwt` is passed in, the Member will not be required to complete an MFA step.


        Note that a successful password reset by email will revoke all active sessions for the `member_id`.'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/api_b2b_password_v1_b2b_passwords_email_ResetRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_b2b_password_v1_b2b_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/b2b/passwords/email/reset\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n  project_id: '${projectId}',\n  secret: '${secret}',\n});\n\nconst params = {\n  password_reset_token: \"${token}\",\n  password: \"${examplePassword}\",\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/b2b/passwords/email/reset\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/stytchauth/stytch-go/v17/stytch/b2b/b2bstytchapi\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/b2b/passwords/email\"\n)\n\nfunc main() {\n\tclient, err := b2bstytchapi.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\tPasswordResetToken: \"${token}\",\n\t\tPassword:           \"${examplePassword}\",\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/b2b/passwords/email/reset\npackage com.example;\n\nimport com.stytch.java.b2b.models.passwordsemail.ResetRequest;\nimport com.stytch.java.b2b.StytchB2BClient;\nimport com.stytch.java.common.StytchResult;\n\npublic class Main {\n    public static void main(String[] args) {\n        StytchB2BClient.configure(\"${projectId}\", \"${secret}\");\n\n        ResetRequest params = new ResetRequest();\n        params.setPasswordResetToken(\"${token}\");\n        params.setPassword(\"${examplePassword}\");\n\n        Object result = StytchB2BClient.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/b2b/passwords/email/reset\npackage com.example\n\nimport com.stytch.java.b2b.StytchB2BClient\nimport com.stytch.java.b2b.models.passwordsemail.ResetRequest\n\nfun main() {\n    StytchB2BClient.configure(\n        projectId = \"${projectId}\",\n        secret = \"${secret}\",\n    )\n\n    when (\n        val result =\n            StytchB2BClient.passwords.email.reset(\n                ResetRequest(\n                    passwordResetToken = \"${token}\",\n                    password = \"${examplePassword}\",\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/b2b/passwords/email/reset\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n  project_id: '${projectId}',\n  secret: '${secret}',\n});\n\nconst params = {\n  password_reset_token: \"${token}\",\n  password: \"${examplePassword}\",\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    'password_reset_token' => '${token}',\n    'password' => '${examplePassword}',\n]);"
      - lang: python
        label: Python
        source: "# POST /v1/b2b/passwords/email/reset\nfrom stytch import B2BClient\n\nclient = B2BClient(\n    project_id=\"${projectId}\",\n    secret=\"${secret}\",\n)\n\nresp = client.passwords.email.reset(\n    password_reset_token=\"${token}\",\n    password=\"${examplePassword}\",\n)\n\nprint(resp)\n"
      - lang: ruby
        label: Ruby
        source: "# POST /v1/b2b/passwords/email/reset\nrequire 'stytch'\n\nclient = StytchB2B::Client.new(\n  project_id: \"${projectId}\",\n  secret: \"${secret}\"\n)\n\nresp = client.passwords.email.reset(\n  password_reset_token: \"${token}\",\n  password: \"${examplePassword}\"\n  \n)\n\nputs resp"
      - lang: rust
        label: Rust
        source: "// POST /v1/b2b/passwords/email/reset\nuse stytch::b2b::client::Client;\nuse stytch::b2b::passwords_email::ResetRequest;\n\nfn main() {\n    let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n    let resp = client.passwords.email.reset(\n        ResetRequest{\n            password_reset_token: \"${token}\",\n            password: \"${examplePassword}\",\n            ..Default::default()\n        }\n    ).await;\n    println!(\"The response is {:?}\", resp);\n}"
      - lang: bash
        label: cURL
        source: "# POST /v1/b2b/passwords/email/reset\ncurl --request POST \\\n  --url https://test.stytch.com/v1/b2b/passwords/email/reset \\\n  -u '${projectId}:${secret}' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"password_reset_token\": \"${token}\",\n    \"password\": \"${examplePassword}\"\n  }'"
  /v1/b2b/passwords/email/require_reset:
    post:
      summary: Requirereset
      operationId: api_b2b_password_v1_b2b_passwords_email_RequireReset
      tags:
      - B2B Passwords
      description: 'Require a password be reset by the associated email address. This endpoint is only functional for cross-org password use cases.


        If there are is only one active Member using the associated email address in the Project, the password will be deleted.'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/api_b2b_password_v1_b2b_passwords_email_RequireResetRequest'
      parameters:
      - name: X-Stytch-Member-Session
        in: header
        required: false
        description: A Stytch session that can be used to run the request with the given member's permissions.
        schema:
          type: string
      - name: X-Stytch-Member-SessionJWT
        in: header
        required: false
        description: A Stytch Session JSON Web Token (JWT) that can be used to run the request with the given member's permissions.
        schema:
          type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_b2b_password_v1_b2b_passwords_email_RequireResetResponse'
        '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/b2b/passwords/email/require_reset\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n  project_id: '${projectId}',\n  secret: '${secret}',\n});\n\nconst params = {\n  email_address: \"${email}\",\n};\n\nconst options = {\n  authorization: {\n    session_token: '${sessionToken}',\n  },\n};\n\nclient.Passwords.Email.RequireReset(params, options)\n  .then(resp => { console.log(resp) })\n  .catch(err => { console.log(err) });"
      - lang: go
        label: Go
        source: "// POST /v1/b2b/passwords/email/require_reset\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/stytchauth/stytch-go/v17/stytch/b2b/b2bstytchapi\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/b2b/passwords/email\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/methodoptions\"\n)\n\nfunc main() {\n\tclient, err := b2bstytchapi.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.RequireResetParams{\n\t\tEmailAddress: \"${email}\",\n\t}\n\n\toptions := &email.RequireResetParamsOptions{\n\t\tAuthorization: methodoptions.Authorization{\n\t\t\tSessionToken: \"${sessionToken}\",\n\t\t},\n\t}\n\n\tresp, err := client.Passwords.Email.RequireReset(context.Background(), params, options)\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/b2b/passwords/email/require_reset\npackage com.example;\n\nimport com.stytch.java.b2b.models.passwordsemail.RequireResetRequest;\nimport com.stytch.java.b2b.models.passwordsemail.RequireResetRequestOptions;\nimport com.stytch.java.b2b.StytchB2BClient;\nimport com.stytch.java.common.methodoptions.Authorization;\nimport com.stytch.java.common.StytchResult;\n\npublic class Main {\n    public static void main(String[] args) {\n        StytchB2BClient.configure(\"${projectId}\", \"${secret}\");\n\n        RequireResetRequest params = new RequireResetRequest();\n        params.setEmailAddress(\"${email}\");\n\n        RequireResetRequestOptions options = new RequireResetRequestOptions();\n        Authorization authorization = new Authorization();\n        authorization.setSessionToken(\"${sessionToken}\");\n        options.setAuthorization(authorization);\n\n        Object result = StytchB2BClient.getPasswords().getEmail().requireReset(params, options);\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/b2b/passwords/email/require_reset\npackage com.example\n\nimport com.stytch.java.b2b.StytchB2BClient\nimport com.stytch.java.b2b.models.passwordsemail.RequireResetRequest\nimport com.stytch.java.b2b.models.passwordsemail.RequireResetRequestOptions\nimport com.stytch.java.common.methodoptions.Authorization\n\nfun main() {\n    StytchB2BClient.configure(\n        projectId = \"${projectId}\",\n        secret = \"${secret}\",\n    )\n\n    when (\n        val result =\n            StytchB2BClient.passwords.email.requireReset(\n                RequireResetRequest(\n                    emailAddress = \"${email}\",\n                ),\n                RequireResetRequestOptions(\n                    Authorization(\n                        sessionToken = \"${sessionToken}\",\n                    ),\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/b2b/passwords/email/require_reset\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n  project_id: '${projectId}',\n  secret: '${secret}',\n});\n\nconst params = {\n  email_address: \"${email}\",\n};\n\nconst options = {\n  authorization: {\n    session_token: '${sessionToken}',\n  },\n};\n\nclient.passwords.email.requireReset(params, options)\n  .then(resp => { console.log(resp) })\n  .catch(err => { console.log(err) });"
      - lang: php
        label: PHP
        source: "$response = $client->passwords->email->require_reset([\n    'email_address' => '${email}',\n], [\n        'authorization' => ['session_token' => '${sessionToken}'],\n\n]);"
      - lang: python
        label: Python
        source: "# POST /v1/b2b/passwords/email/require_reset\nfrom stytch import B2BClient\nfrom stytch.b2b.models.passwords_email import RequireResetRequestOptions\nfrom stytch.shared.method_options import Authorization\n\nclient = B2BClient(\n    project_id=\"${projectId}\",\n    secret=\"${secret}\",\n)\n\nresp = client.passwords.email.require_reset(\n    email_address=\"${email}\",\n    method_options=RequireResetRequestOptions(\n        authorization=Authorization(\n            session_token=\"${sessionToken}\",\n        ),\n    ),\n)\n\nprint(resp)\n"
      - lang: ruby
        label: Ruby
        source: "# POST /v1/b2b/passwords/email/require_reset\nrequire 'stytch'\n\nclient = StytchB2B::Client.new(\n  project_id: \"${projectId}\",\n  secret: \"${secret}\"\n)\n\nresp = client.passwords.email.require_reset(\n  email_address: \"${email}\",\n  method_options: StytchB2B::Passwords::Email::RequireResetRequestOptions.new(\n    authorization: Stytch::MethodOptions::Authorization.new(session_token: '${sessionToken}')\n  )\n)\n\nputs resp"
      - lang: rust
        label: Rust
        source: "// POST /v1/b2b/passwords/email/require_reset\nuse stytch::b2b::client::Client;\nuse stytch::b2b::passwords_email::RequireResetRequest;\n\nfn main() {\n    let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n    let resp = client.passwords.email.require_reset(\n        RequireResetRequest{\n            email_address: \"${email}\",\n            ..Default::default()\n        }\n    ).await;\n    println!(\"The response is {:?}\", resp);\n}"
      - lang: bash
        label: cURL
        source: "# POST /v1/b2b/passwords/email/require_reset\ncurl --request POST \\\n  --url https://test.stytch.com/v1/b2b/passwords/email/require_reset \\\n  -u '${projectId}:${secret}' \\\n  -H 'Content-Type: application/json' \\\n  -H \"X-Stytch-Member-Session: ${sessionToken}\" \\\n  -d '{\n    \"email_address\": \"${email}\"\n  }'"
  /v1/b2b/passwords/session/reset:
    post:
      summary: Reset
      operationId: api_b2b_password_v1_b2b_passwords_session_Reset
      tags:
      - B2B Passwords
      description: 'Reset the Member''s password using their existing session. The endpoint will error if the session does not contain an authentication factor that has been issued within the last 5 minutes. Either `session_token` or `session_jwt` should be provided.


        Note that a successful password reset via an existing session will revoke all active sessions for the `member_id`, except for the one used during the reset flow.'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/api_b2b_password_v1_b2b_passwords_session_ResetRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_b2b_password_v1_b2b_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/b2b/passwords/session/reset\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n  project_id: '${projectId}',\n  secret: '${secret}',\n});\n\nconst params = {\n  organization_id: \"${organizationId}\",\n  password: \"${examplePassword}\",\n  session_token: \"${sessionToken}\",\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/b2b/passwords/session/reset\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/stytchauth/stytch-go/v17/stytch/b2b/b2bstytchapi\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/b2b/passwords/session\"\n)\n\nfunc main() {\n\tclient, err := b2bstytchapi.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\tOrganizationID: \"${organizationId}\",\n\t\tPassword:       \"${examplePassword}\",\n\t\tSessionToken:   \"${sessionToken}\",\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/b2b/passwords/session/reset\npackage com.example;\n\nimport com.stytch.java.b2b.models.passwordssession.ResetRequest;\nimport com.stytch.java.b2b.StytchB2BClient;\nimport com.stytch.java.common.StytchResult;\n\npublic class Main {\n    public static void main(String[] args) {\n        StytchB2BClient.configure(\"${projectId}\", \"${secret}\");\n\n        ResetRequest params = new ResetRequest();\n        params.setOrganizationId(\"${organizationId}\");\n        params.setPassword(\"${examplePassword}\");\n        params.setSessionToken(\"${sessionToken}\");\n\n        Object result = StytchB2BClient.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/b2b/passwords/session/reset\npackage com.example\n\nimport com.stytch.java.b2b.StytchB2BClient\nimport com.stytch.java.b2b.models.passwordssession.ResetRequest\n\nfun main() {\n    StytchB2BClient.configure(\n        projectId = \"${projectId}\",\n        secret = \"${secret}\",\n    )\n\n    when (\n        val result =\n            StytchB2BClient.passwords.sessions.reset(\n                ResetRequest(\n                    organizationId = \"${organizationId}\",\n                    password = \"${examplePassword}\",\n                    sessionToken = \"${sessionToken}\",\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/b2b/passwords/session/reset\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n  project_id: '${projectId}',\n  secret: '${secret}',\n});\n\nconst params = {\n  organization_id: \"${organizationId}\",\n  password: \"${examplePassword}\",\n  session_token: \"${sessionToken}\",\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    'organization_id' => '${o

# --- truncated at 32 KB (149 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/stytch/refs/heads/main/openapi/stytch-b2b-passwords-api-openapi.yml