Stytch B2B TOTP API

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

OpenAPI Specification

stytch-b2b-totp-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Stytch B2B Authentication Application 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_session_v1_SlackOAuthFactor:
      type: object
      properties:
        id:
          type: string
          description: The unique ID of an OAuth registration.
        provider_subject:
          type: string
          description: The unique identifier for the User within a given OAuth provider. Also commonly called the `sub` or "Subject field" in OAuth protocols.
        email_id:
          type: string
          description: The globally unique UUID of the Member's email.
      required:
      - id
      - provider_subject
    api_session_v1_HubspotOAuthFactor:
      type: object
      properties:
        id:
          type: string
          description: The unique ID of an OAuth registration.
        provider_subject:
          type: string
          description: The unique identifier for the User within a given OAuth provider. Also commonly called the `sub` or "Subject field" in OAuth protocols.
        email_id:
          type: string
          description: The globally unique UUID of the Member's email.
      required:
      - id
      - provider_subject
    api_b2b_totp_v1_MigrateResponse:
      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.
        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).
        totp_registration_id:
          type: string
          description: The unique ID for a TOTP instance.
        recovery_codes:
          type: array
          items:
            type: string
          description: An array of recovery codes that can be used to recover a Member's account.
        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
      - member
      - organization
      - totp_registration_id
      - recovery_codes
      - status_code
    api_b2b_totp_v1_CreateRequest:
      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.
        expiration_minutes:
          type: integer
          format: int32
          description: The expiration for the TOTP registration. If the newly created TOTP registration is not authenticated within this time frame the member will have to restart the registration flow. Defaults to 60 (1 hour) with a minimum of 5 and a maximum of 1440.
        intermediate_session_token:
          type: string
          description: The Intermediate Session Token. This token does not necessarily belong to a specific instance of a Member, but represents a bag of factors that may be converted to a member session. The token can be used with the [OTP SMS Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-otp-sms), [TOTP Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-totp), or [Recovery Codes Recover endpoint](https://stytch.com/docs/b2b/api/recovery-codes-recover) to complete an MFA flow and log in to the Organization. The token has a default expiry of 10 minutes. It can also be used with the [Exchange Intermediate Session endpoint](https://stytch.com/docs/b2b/api/exchange-intermediate-session) to join a specific Organization that allows the factors represented by the intermediate session token; or the [Create Organization via Discovery endpoint](https://stytch.com/docs/b2b/api/create-organization-via-discovery) to create a new Organization and Member. Intermediate Session Tokens have a default expiry of 10 minutes.
        session_token:
          type: string
          description: A secret token for a given Stytch Session.
        session_jwt:
          type: string
          description: The JSON Web Token (JWT) for a given Stytch Session.
      description: Request type
      required:
      - organization_id
      - member_id
    api_session_v1_DiscordOAuthFactor:
      type: object
      properties:
        id:
          type: string
        provider_subject:
          type: string
        email_id:
          type: string
      required:
      - id
      - provider_subject
    api_session_v1_SalesforceOAuthFactor:
      type: object
      properties:
        id:
          type: string
        provider_subject:
          type: string
        email_id:
          type: string
      required:
      - id
      - provider_subject
    api_session_v1_SAMLSSOFactor:
      type: object
      properties:
        id:
          type: string
          description: The unique ID of an SSO Registration.
        provider_id:
          type: string
          description: Globally unique UUID that identifies a specific SAML Connection.
        external_id:
          type: string
          description: The ID of the member given by the identity provider.
      required:
      - id
      - provider_id
      - external_id
    api_organization_v1_CustomRole:
      type: object
      properties:
        role_id:
          type: string
        description:
          type: string
        permissions:
          type: array
          items:
            $ref: '#/components/schemas/api_organization_v1_CustomRolePermission'
      required:
      - role_id
      - description
      - permissions
    api_session_v1_ImpersonatedFactor:
      type: object
      properties:
        impersonator_id:
          type: string
          description: For impersonated sessions initiated via the Stytch Dashboard, the `impersonator_id` will be the impersonator's Stytch Dashboard `member_id`.
        impersonator_email_address:
          type: string
          description: The email address of the impersonator.
      required:
      - impersonator_id
      - impersonator_email_address
    api_session_v1_TikTokOAuthFactor:
      type: object
      properties:
        id:
          type: string
        provider_subject:
          type: string
        email_id:
          type: string
      required:
      - id
      - provider_subject
    api_session_v1_CoinbaseOAuthFactor:
      type: object
      properties:
        id:
          type: string
        provider_subject:
          type: string
        email_id:
          type: string
      required:
      - id
      - provider_subject
    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_organization_v1_RetiredEmail:
      type: object
      properties:
        email_id:
          type: string
          description: The globally unique UUID of a Member's email.
        email_address:
          type: string
          description: The email address of the Member.
      required:
      - email_id
      - email_address
    api_organization_v1_MemberRole:
      type: object
      properties:


# --- 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