Stytch B2B TOTP API

The B2B TOTP API from Stytch — 3 operation(s) for b2b totp.

Operations 3

POST /v1/b2b/totp Create #
POST /v1/b2b/totp/authenticate Authenticate #
POST /v1/b2b/totp/migrate Migrate #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/stytch-b2b-totp-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

stytch-b2b-totp-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Stytch B2B Authentication B2B TOTP 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 TOTP
paths:
  /v1/b2b/totp:
    post:
      summary: Create
      operationId: api_b2b_totp_v1_Create
      tags:
      - B2B TOTP
      description: "Create a new TOTP instance for a Member. The Member can use the authenticator application of their choice to scan the QR code or enter the secret. \n\nIf the Member already has an active MFA factor, then passing an intermediate session token, session token, or session JWT with the existing MFA factor on it is required to prevent bypassing MFA.  \n\nOtherwise, passing an intermediate session token, session token, or session JWT is not required, but if passed must match the `member_id` passed."
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/api_b2b_totp_v1_CreateRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_b2b_totp_v1_CreateResponse'
        '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/totp\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  member_id: \"${memberId}\",\n};\n\nclient.TOTPs.Create(params)\n  .then(resp => { console.log(resp) })\n  .catch(err => { console.log(err) });"
      - lang: go
        label: Go
        source: "// POST /v1/b2b/totp\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/totps\"\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 := &totps.CreateParams{\n\t\tOrganizationID: \"${organizationId}\",\n\t\tMemberID:       \"${memberId}\",\n\t}\n\n\tresp, err := client.TOTPs.Create(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/totp\npackage com.example;\n\nimport com.stytch.java.b2b.models.totps.CreateRequest;\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        CreateRequest params = new CreateRequest();\n        params.setOrganizationId(\"${organizationId}\");\n        params.setMemberId(\"${memberId}\");\n\n        Object result = StytchB2BClient.getTOTPs().create(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/totp\npackage com.example\n\nimport com.stytch.java.b2b.StytchB2BClient\nimport com.stytch.java.b2b.models.totps.CreateRequest\n\nfun main() {\n    StytchB2BClient.configure(\n        projectId = \"${projectId}\",\n        secret = \"${secret}\",\n    )\n\n    when (\n        val result =\n            StytchB2BClient.totps.create(\n                CreateRequest(\n                    organizationId = \"${organizationId}\",\n                    memberId = \"${memberId}\",\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/totp\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  member_id: \"${memberId}\",\n};\n\nclient.totps.create(params)\n  .then(resp => { console.log(resp) })\n  .catch(err => { console.log(err) });"
      - lang: php
        label: PHP
        source: "$response = $client->totps->create([\n    'organization_id' => '${organizationId}',\n    'member_id' => '${memberId}',\n]);"
      - lang: python
        label: Python
        source: "# POST /v1/b2b/totp\nfrom stytch import B2BClient\n\nclient = B2BClient(\n    project_id=\"${projectId}\",\n    secret=\"${secret}\",\n)\n\nresp = client.totps.create(\n    organization_id=\"${organizationId}\",\n    member_id=\"${memberId}\",\n)\n\nprint(resp)\n"
      - lang: ruby
        label: Ruby
        source: "# POST /v1/b2b/totp\nrequire 'stytch'\n\nclient = StytchB2B::Client.new(\n  project_id: \"${projectId}\",\n  secret: \"${secret}\"\n)\n\nresp = client.totps.create(\n  organization_id: \"${organizationId}\",\n  member_id: \"${memberId}\"\n  \n)\n\nputs resp"
      - lang: rust
        label: Rust
        source: "// POST /v1/b2b/totp\nuse stytch::b2b::client::Client;\nuse stytch::b2b::totps::CreateRequest;\n\nfn main() {\n    let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n    let resp = client.totps.create(\n        CreateRequest{\n            organization_id: \"${organizationId}\",\n            member_id: \"${memberId}\",\n            ..Default::default()\n        }\n    ).await;\n    println!(\"The response is {:?}\", resp);\n}"
      - lang: bash
        label: cURL
        source: "# POST /v1/b2b/totp\ncurl --request POST \\\n  --url https://test.stytch.com/v1/b2b/totp \\\n  -u '${projectId}:${secret}' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"organization_id\": \"${organizationId}\",\n    \"member_id\": \"${memberId}\"\n  }'"
  /v1/b2b/totp/authenticate:
    post:
      summary: Authenticate
      operationId: api_b2b_totp_v1_Authenticate
      tags:
      - B2B TOTP
      description: Authenticate a Member provided TOTP.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/api_b2b_totp_v1_AuthenticateRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_b2b_totp_v1_AuthenticateResponse'
        '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/totp/authenticate\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  member_id: \"${memberId}\",\n  code: \"${exampleCode}\",\n  intermediate_session_token: \"${token}\",\n};\n\nclient.TOTPs.Authenticate(params)\n  .then(resp => { console.log(resp) })\n  .catch(err => { console.log(err) });"
      - lang: go
        label: Go
        source: "// POST /v1/b2b/totp/authenticate\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/totps\"\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 := &totps.AuthenticateParams{\n\t\tOrganizationID:           \"${organizationId}\",\n\t\tMemberID:                 \"${memberId}\",\n\t\tCode:                     \"${exampleCode}\",\n\t\tIntermediateSessionToken: \"${token}\",\n\t}\n\n\tresp, err := client.TOTPs.Authenticate(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/totp/authenticate\npackage com.example;\n\nimport com.stytch.java.b2b.models.totps.AuthenticateRequest;\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        AuthenticateRequest params = new AuthenticateRequest();\n        params.setOrganizationId(\"${organizationId}\");\n        params.setMemberId(\"${memberId}\");\n        params.setCode(\"${exampleCode}\");\n        params.setIntermediateSessionToken(\"${token}\");\n\n        Object result = StytchB2BClient.getTOTPs().authenticate(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/totp/authenticate\npackage com.example\n\nimport com.stytch.java.b2b.StytchB2BClient\nimport com.stytch.java.b2b.models.totps.AuthenticateRequest\n\nfun main() {\n    StytchB2BClient.configure(\n        projectId = \"${projectId}\",\n        secret = \"${secret}\",\n    )\n\n    when (\n        val result =\n            StytchB2BClient.totps.authenticate(\n                AuthenticateRequest(\n                    organizationId = \"${organizationId}\",\n                    memberId = \"${memberId}\",\n                    code = \"${exampleCode}\",\n                    intermediateSessionToken = \"${token}\",\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/totp/authenticate\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  member_id: \"${memberId}\",\n  code: \"${exampleCode}\",\n  intermediate_session_token: \"${token}\",\n};\n\nclient.totps.authenticate(params)\n  .then(resp => { console.log(resp) })\n  .catch(err => { console.log(err) });"
      - lang: php
        label: PHP
        source: "$response = $client->totps->authenticate([\n    'organization_id' => '${organizationId}',\n    'member_id' => '${memberId}',\n    'code' => '${exampleCode}',\n    'intermediate_session_token' => '${token}',\n]);"
      - lang: python
        label: Python
        source: "# POST /v1/b2b/totp/authenticate\nfrom stytch import B2BClient\n\nclient = B2BClient(\n    project_id=\"${projectId}\",\n    secret=\"${secret}\",\n)\n\nresp = client.totps.authenticate(\n    organization_id=\"${organizationId}\",\n    member_id=\"${memberId}\",\n    code=\"${exampleCode}\",\n    intermediate_session_token=\"${token}\",\n)\n\nprint(resp)\n"
      - lang: ruby
        label: Ruby
        source: "# POST /v1/b2b/totp/authenticate\nrequire 'stytch'\n\nclient = StytchB2B::Client.new(\n  project_id: \"${projectId}\",\n  secret: \"${secret}\"\n)\n\nresp = client.totps.authenticate(\n  organization_id: \"${organizationId}\",\n  member_id: \"${memberId}\",\n  code: \"${exampleCode}\",\n  intermediate_session_token: \"${token}\"\n  \n)\n\nputs resp"
      - lang: rust
        label: Rust
        source: "// POST /v1/b2b/totp/authenticate\nuse stytch::b2b::client::Client;\nuse stytch::b2b::totps::AuthenticateRequest;\n\nfn main() {\n    let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n    let resp = client.totps.authenticate(\n        AuthenticateRequest{\n            organization_id: \"${organizationId}\",\n            member_id: \"${memberId}\",\n            code: \"${exampleCode}\",\n            intermediate_session_token: Some(String::from(\"${token}\")),\n            ..Default::default()\n        }\n    ).await;\n    println!(\"The response is {:?}\", resp);\n}"
      - lang: bash
        label: cURL
        source: "# POST /v1/b2b/totp/authenticate\ncurl --request POST \\\n  --url https://test.stytch.com/v1/b2b/totp/authenticate \\\n  -u '${projectId}:${secret}' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"organization_id\": \"${organizationId}\",\n    \"member_id\": \"${memberId}\",\n    \"code\": \"${exampleCode}\",\n    \"intermediate_session_token\": \"${token}\"\n  }'"
  /v1/b2b/totp/migrate:
    post:
      summary: Migrate
      operationId: api_b2b_totp_v1_Migrate
      tags:
      - B2B TOTP
      description: Migrate an existing TOTP instance for a Member. Recovery codes are not required and will be minted for the Member if not provided.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/api_b2b_totp_v1_MigrateRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_b2b_totp_v1_MigrateResponse'
        '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/totp/migrate\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  member_id: \"${memberId}\",\n  secret: \"${secret}\",\n  recovery_codes: [\"ckss-2skx-ebow\", \"spbc-424h-usy0\", \"hi08-n5tk-lns5\"],\n};\n\nclient.TOTPs.Migrate(params)\n  .then(resp => { console.log(resp) })\n  .catch(err => { console.log(err) });"
      - lang: go
        label: Go
        source: "// POST /v1/b2b/totp/migrate\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/totps\"\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 := &totps.MigrateParams{\n\t\tOrganizationID: \"${organizationId}\",\n\t\tMemberID:       \"${memberId}\",\n\t\tSecret:         \"${secret}\",\n\t\tRecoveryCodes:  []string{\"ckss-2skx-ebow\", \"spbc-424h-usy0\", \"hi08-n5tk-lns5\"},\n\t}\n\n\tresp, err := client.TOTPs.Migrate(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/totp/migrate\npackage com.example;\n\nimport com.stytch.java.b2b.models.totps.MigrateRequest;\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        MigrateRequest params = new MigrateRequest();\n        params.setOrganizationId(\"${organizationId}\");\n        params.setMemberId(\"${memberId}\");\n        params.setSecret(\"${secret}\");\n        params.setRecoveryCodes(new String(\"ckss-2skx-ebow\", \"spbc-424h-usy0\", \"hi08-n5tk-lns5\"));\n\n        Object result = StytchB2BClient.getTOTPs().migrate(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/totp/migrate\npackage com.example\n\nimport com.stytch.java.b2b.StytchB2BClient\nimport com.stytch.java.b2b.models.totps.MigrateRequest\n\nfun main() {\n    StytchB2BClient.configure(\n        projectId = \"${projectId}\",\n        secret = \"${secret}\",\n    )\n\n    when (\n        val result =\n            StytchB2BClient.totps.migrate(\n                MigrateRequest(\n                    organizationId = \"${organizationId}\",\n                    memberId = \"${memberId}\",\n                    secret = \"${secret}\",\n                    recoveryCodes = arrayOf(\"ckss-2skx-ebow\", \"spbc-424h-usy0\", \"hi08-n5tk-lns5\"),\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/totp/migrate\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  member_id: \"${memberId}\",\n  secret: \"${secret}\",\n  recovery_codes: [\"ckss-2skx-ebow\", \"spbc-424h-usy0\", \"hi08-n5tk-lns5\"],\n};\n\nclient.totps.migrate(params)\n  .then(resp => { console.log(resp) })\n  .catch(err => { console.log(err) });"
      - lang: php
        label: PHP
        source: "$response = $client->totps->migrate([\n    'organization_id' => '${organizationId}',\n    'member_id' => '${memberId}',\n    'secret' => '${secret}',\n    'recovery_codes' => ['ckss-2skx-ebow', 'spbc-424h-usy0', 'hi08-n5tk-lns5'],\n]);"
      - lang: python
        label: Python
        source: "# POST /v1/b2b/totp/migrate\nfrom stytch import B2BClient\n\nclient = B2BClient(\n    project_id=\"${projectId}\",\n    secret=\"${secret}\",\n)\n\nresp = client.totps.migrate(\n    organization_id=\"${organizationId}\",\n    member_id=\"${memberId}\",\n    secret=\"${secret}\",\n    recovery_codes=[\"ckss-2skx-ebow\", \"spbc-424h-usy0\", \"hi08-n5tk-lns5\"],\n)\n\nprint(resp)\n"
      - lang: ruby
        label: Ruby
        source: "# POST /v1/b2b/totp/migrate\nrequire 'stytch'\n\nclient = StytchB2B::Client.new(\n  project_id: \"${projectId}\",\n  secret: \"${secret}\"\n)\n\nresp = client.totps.migrate(\n  organization_id: \"${organizationId}\",\n  member_id: \"${memberId}\",\n  secret: \"${secret}\",\n  recovery_codes: ['ckss-2skx-ebow', 'spbc-424h-usy0', 'hi08-n5tk-lns5']\n  \n)\n\nputs resp"
      - lang: rust
        label: Rust
        source: "// POST /v1/b2b/totp/migrate\nuse stytch::b2b::client::Client;\nuse stytch::b2b::totps::MigrateRequest;\n\nfn main() {\n    let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n    let resp = client.totps.migrate(\n        MigrateRequest{\n            organization_id: \"${organizationId}\",\n            member_id: \"${memberId}\",\n            secret: \"${secret}\",\n            recovery_codes: vec![\"ckss-2skx-ebow\", \"spbc-424h-usy0\", \"hi08-n5tk-lns5\"],\n            ..Default::default()\n        }\n    ).await;\n    println!(\"The response is {:?}\", resp);\n}"
      - lang: bash
        label: cURL
        source: "# POST /v1/b2b/totp/migrate\ncurl --request POST \\\n  --url https://test.stytch.com/v1/b2b/totp/migrate \\\n  -u '${projectId}:${secret}' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"organization_id\": \"${organizationId}\",\n    \"member_id\": \"${memberId}\",\n    \"secret\": \"${secret}\",\n    \"recovery_codes\": [\"ckss-2skx-ebow\", \"spbc-424h-usy0\", \"hi08-n5tk-lns5\"]\n  }'"
components:
  schemas:
    api_organization_v1_ActiveSSOConnection:
      type: object
      properties:
        connection_id:
          type: string
          description: Globally unique UUID that identifies a specific SSO `connection_id` for a Member.
        display_name:
          type: string
          description: A human-readable display name for the connection.
        identity_provider:
          type: string
      required:
      - connection_id
      - display_name
      - identity_provider
    api_b2b_totp_v1_MigrateRequest:
      type: object
      properties:
        organization_id:
          type: string
          description: Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value. You may also use the organization_slug or organization_external_id here as a convenience.
        member_id:
          type: string
          description: Globally unique UUID that identifies a specific Member. The `member_id` is critical to perform operations on a Member, so be sure to preserve this value. You may use an external_id here if one is set for the member.
        secret:
          type: string
          description: The TOTP secret key shared between the authenticator app and the server used to generate TOTP codes.
        recovery_codes:
          type: array
          items:
            type: string
          description: An existing set of recovery codes to be imported into Stytch to be used to authenticate in place of the secondary MFA method.
      description: Request type
      required:
      - organization_id
      - member_id
      - secret
      - recovery_codes
    api_b2b_session_v1_MemberSession:
      type: object
      properties:
        member_session_id:
          type: string
          description: Globally unique UUID that identifies a specific Session.
        member_id:
          type: string
          description: Globally unique UUID that identifies a specific Member.
        started_at:
          type: string
          description: The timestamp when the Session was created. Values conform to the RFC 3339 standard and are expressed in UTC, e.g. `2021-12-29T12:33:09Z`.
        last_accessed_at:
          type: string
          description: The timestamp when the Session was last accessed. Values conform to the RFC 3339 standard and are expressed in UTC, e.g. `2021-12-29T12:33:09Z`.
        expires_at:
          type: string
          description: The timestamp when the Session expires. Values conform to the RFC 3339 standard and are expressed in UTC, e.g. `2021-12-29T12:33:09Z`.
        authentication_factors:
          type: array
          items:
            $ref: '#/components/schemas/api_session_v1_AuthenticationFactor'
          description: An array of different authentication factors that comprise a Session.
        organization_id:
          type: string
          description: Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value.
        roles:
          type: array
          items:
            type: string
        organization_slug:
          type: string
          description: 'The unique URL slug of the Organization. The slug only accepts alphanumeric characters and the following reserved characters: `-` `.` `_` `~`. Must be between 2 and 128 characters in length. Wherever an organization_id is expected in a path or request parameter, you may also use the organization_slug as a convenience.'
        custom_claims:
          type: object
          additionalProperties: true
          description: The custom claims map for a Session. Claims can be added to a session during a Sessions authenticate call.
      required:
      - member_session_id
      - member_id
      - started_at
      - last_accessed_at
      - expires_at
      - authentication_factors
      - organization_id
      - roles
      - organization_slug
    api_organization_v1_SSORegistration:
      type: object
      properties:
        connection_id:
          type: string
          description: Globally unique UUID that identifies a specific SSO `connection_id` for a Member.
        external_id:
          type: string
          description: The ID of the member given by the identity provider.
        registration_id:
          type: string
          description: The unique ID of an SSO Registration.
        sso_attributes:
          type: object
          additionalProperties: true
          description: An object for storing SSO attributes brought over from the identity provider.
      required:
      - connection_id
      - external_id
      - registration_id
    api_session_v1_LinkedInOAuthFactor:
      type: object
      properties:
        id:
          type: string
        provider_subject:
          type: string
        email_id:
          type: string
      required:
      - id
      - provider_subject
    api_b2b_scim_v1_Entitlement:
      type: object
      properties:
        value:
          type: string
        type:
          type: string
        primary:
          type: boolean
      required:
      - value
      - type
      - primary
    api_session_v1_AppleOAuthFactor:
      type: object
      properties:
        id:
          type: string
        provider_subject:
          type: string
        email_id:
          type: string
      required:
      - id
      - provider_subject
    api_b2b_totp_v1_CreateResponse:
      type: object
      properties:
        request_id:
          type: string
          description: Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
        member_id:
          type: string
          description: Globally unique UUID that identifies a specific Member.
        totp_registration_id:
          type: string
          description: The unique ID for a TOTP instance.
        secret:
          type: string
          description: The TOTP secret key shared between the authenticator app and the server used to generate TOTP codes.
        qr_code:
          type: string
          description: The QR code image encoded in base64.
        recovery_codes:
          type: array
          items:
            type: string
          description: An array of recovery codes that can be used to recover a Member's account.
        member:
          $ref: '#/components/schemas/api_organization_v1_Member'
          description: The [Member object](https://stytch.com/docs/b2b/api/member-object)
        organization:
          $ref: '#/components/schemas/api_organization_v1_Organization'
          description: The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
        status_code:
          type: integer
          format: int32
          description: The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
      required:
      - request_id
      - member_id
      - totp_registration_id
      - secret
      - qr_code
      - recovery_codes
      - member
      - organization
      - status_code
    api_b2b_scim_v1_SCIMAttributes:
      type: object
      properties:
        user_name:
          type: string
        id:
          type: string
        external_id:
          type: string
        active:
          type: boolean
        groups:
          type: array
          items:
            $ref: '#/components/schemas/api_b2b_scim_v1_Group'
        display_name:
          type: string
        nick_name:
          type: string
        profile_url:
          type: string
        user_type:
          type: string
        title:
          type: string
        preferred_language:
          type: string
        locale:
          type: string
        timezone:
          type: string
        emails:
          type: array
          items:
            $ref: '#/components/schemas/api_b2b_scim_v1_Email'
        phone_numbers:
          type: array
          items:
            $ref: '#/components/schemas/api_b2b_scim_v1_PhoneNumber'
        addresses:
          type: array
          items:
            $ref: '#/components/schemas/api_b2b_scim_v1_Address'
        ims:
          type: array
          items:
            $ref: '#/components/schemas/api_b2b_scim_v1_IMs'
        photos:
          type: array
          items:
            $ref: '#/componen

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