openapi: 3.0.3
info:
title: Stytch B2B Authentication Application Discovery 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: Discovery
paths:
/v1/b2b/discovery/intermediate_sessions/exchange:
post:
summary: Exchange
operationId: api_discovery_v1_discovery_intermediate_sessions_Exchange
tags:
- Discovery
description: 'Exchange an Intermediate Session for a fully realized [Member Session](https://stytch.com/docs/b2b/api/session-object) for the [Organization](https://stytch.com/docs/b2b/api/organization-object) that the user wishes to log into.
This endpoint can be used to accept invites and JIT Provision into a new Organization on the basis of the user''s email domain or OAuth tenant.
If the user **has** already satisfied the authentication requirements of the Organization they are trying to exchange into and logged in with a method that verifies their email address, this API will return `member_authenticated: true` and a `session_token` and `session_jwt`.
If the user **has not** satisfied the primary or secondary authentication requirements of the Organization they are attempting to exchange into or is JIT Provisioning but did not log in via a method that provides email verification, this API will return `member_authenticated: false` and an `intermediate_session_token`.
If `primary_required` is returned, prompt the user to fulfill the Organization''s auth requirements using the options returned in `primary_required.allowed_auth_methods`.
If `primary_required` is null and `mfa_required` is set, check `mfa_required.member_options` to determine if the Member has SMS OTP or TOTP set up for MFA and prompt accordingly. If the Member has SMS OTP, check `mfa_required.secondary_auth_initiated` to see if the OTP has already been sent.
Include the `intermediate_session_token` returned above when calling the `authenticate()` method that the user needed to perform. Once the user has completed the authentication requirements they were missing, they will be granted a full `session_token` and `session_jwt` to indicate they have successfully logged into the Organization.
The `intermediate_session_token` can also be used with the [Create Organization via Discovery endpoint](https://stytch.com/docs/b2b/api/create-organization-via-discovery) to create a new Organization instead of joining an existing one.'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/api_discovery_v1_discovery_intermediate_sessions_ExchangeRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/api_discovery_v1_discovery_intermediate_sessions_ExchangeResponse'
'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/discovery/intermediate_sessions/exchange\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n intermediate_session_token: \"${token}\",\n organization_id: \"${organizationId}\",\n};\n\nclient.Discovery.IntermediateSessions.Exchange(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: go
label: Go
source: "// POST /v1/b2b/discovery/intermediate_sessions/exchange\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/discovery/intermediatesessions\"\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 := &intermediatesessions.ExchangeParams{\n\t\tIntermediateSessionToken: \"${token}\",\n\t\tOrganizationID: \"${organizationId}\",\n\t}\n\n\tresp, err := client.Discovery.IntermediateSessions.Exchange(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/discovery/intermediate_sessions/exchange\npackage com.example;\n\nimport com.stytch.java.b2b.models.discoveryintermediatesessions.ExchangeRequest;\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 ExchangeRequest params = new ExchangeRequest();\n params.setIntermediateSessionToken(\"${token}\");\n params.setOrganizationId(\"${organizationId}\");\n\n Object result = StytchB2BClient.getDiscovery().getIntermediateSessions().exchange(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/discovery/intermediate_sessions/exchange\npackage com.example\n\nimport com.stytch.java.b2b.StytchB2BClient\nimport com.stytch.java.b2b.models.discoveryintermediatesessions.ExchangeRequest\n\nfun main() {\n StytchB2BClient.configure(\n projectId = \"${projectId}\",\n secret = \"${secret}\",\n )\n\n when (\n val result =\n StytchB2BClient.discovery.intermediateSessions.exchange(\n ExchangeRequest(\n intermediateSessionToken = \"${token}\",\n organizationId = \"${organizationId}\",\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/discovery/intermediate_sessions/exchange\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n intermediate_session_token: \"${token}\",\n organization_id: \"${organizationId}\",\n};\n\nclient.discovery.intermediateSessions.exchange(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: php
label: PHP
source: "$response = $client->discovery->intermediate_sessions->exchange([\n 'intermediate_session_token' => '${token}',\n 'organization_id' => '${organizationId}',\n]);"
- lang: python
label: Python
source: "# POST /v1/b2b/discovery/intermediate_sessions/exchange\nfrom stytch import B2BClient\n\nclient = B2BClient(\n project_id=\"${projectId}\",\n secret=\"${secret}\",\n)\n\nresp = client.discovery.intermediate_sessions.exchange(\n intermediate_session_token=\"${token}\",\n organization_id=\"${organizationId}\",\n)\n\nprint(resp)\n"
- lang: ruby
label: Ruby
source: "# POST /v1/b2b/discovery/intermediate_sessions/exchange\nrequire 'stytch'\n\nclient = StytchB2B::Client.new(\n project_id: \"${projectId}\",\n secret: \"${secret}\"\n)\n\nresp = client.discovery.intermediate_sessions.exchange(\n intermediate_session_token: \"${token}\",\n organization_id: \"${organizationId}\"\n \n)\n\nputs resp"
- lang: rust
label: Rust
source: "// POST /v1/b2b/discovery/intermediate_sessions/exchange\nuse stytch::b2b::client::Client;\nuse stytch::b2b::discovery_intermediate_sessions::ExchangeRequest;\n\nfn main() {\n let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n let resp = client.discovery.intermediate_sessions.exchange(\n ExchangeRequest{\n intermediate_session_token: \"${token}\",\n organization_id: \"${organizationId}\",\n ..Default::default()\n }\n ).await;\n println!(\"The response is {:?}\", resp);\n}"
- lang: bash
label: cURL
source: "# POST /v1/b2b/discovery/intermediate_sessions/exchange\ncurl --request POST \\\n --url https://test.stytch.com/v1/b2b/discovery/intermediate_sessions/exchange \\\n -u '${projectId}:${secret}' \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"intermediate_session_token\": \"${token}\",\n \"organization_id\": \"${organizationId}\"\n }'"
/v1/b2b/discovery/organizations/create:
post:
summary: Create
operationId: api_discovery_v1_discovery_organizations_Create
tags:
- Discovery
description: "This endpoint allows you to exchange the `intermediate_session_token` returned when the user successfully completes a Discovery authentication flow to create a new\n[Organization](https://stytch.com/docs/b2b/api/organization-object) and [Member](https://stytch.com/docs/b2b/api/member-object) and log the user in. If the user wants to log into an existing Organization, use the [Exchange Intermediate Session endpoint](https://stytch.com/docs/b2b/api/exchange-intermediate-session) instead.\n\nStytch **requires that users verify their email address** prior to creating a new Organization in order to prevent Account Takeover (ATO) attacks and phishing.\n\nIf the user authenticated using a method that **does not** provide real-time email verification (returning password auth, Github/Slack/Hubspot OAuth) this API will return `member_authenticated: false` and an `intermediate_session_token` to indicate that the user must perform additional authentication via one of the options listed in `primary_required.allowed_auth_methods` to finish logging in.\n\nIf you specified an `mfa_policy: REQUIRED_FOR_ALL` in the request, this API will return `member_authenticated: false`, an `intermediate_session_token`, and `mfa_required` in order to indicate that you must prompt the user to enroll in MFA.\n\nInclude the `intermediate_session_token` when calling the `authenticate()` method that the user needed to perform to verify their email or enroll in MFA. Once the user has completed the authentication requirements they were missing, they will be granted a full `session_token` and `session_jwt` and be successfully logged in.\n\nIf the user logged in with a method that **does** provide real-time email verification (Email Magic Links, Email OTP, Google/Microsoft OAuth, initial email verification when creating a new password) this API will return `member_authenticated: true` and a `session_jwt` and `session_token` to indicate that the user has successfully logged in.\n\nThe Member created by this endpoint will automatically be granted the `stytch_admin` Role. See the \n[RBAC guide](https://stytch.com/docs/b2b/guides/rbac/stytch-default) for more details on this Role."
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/api_discovery_v1_discovery_organizations_CreateRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/api_discovery_v1_discovery_organizations_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/discovery/organizations/create\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n intermediate_session_token: \"${token}\",\n organization_name: \"${organizationName}\",\n organization_slug: \"${organizationSlug}\",\n organization_external_id: \"my-external-id\",\n};\n\nclient.Discovery.Organizations.Create(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: go
label: Go
source: "// POST /v1/b2b/discovery/organizations/create\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/discovery/organizations\"\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 := &organizations.CreateParams{\n\t\tIntermediateSessionToken: \"${token}\",\n\t\tOrganizationName: \"${organizationName}\",\n\t\tOrganizationSlug: \"${organizationSlug}\",\n\t\tOrganizationExternalID: \"my-external-id\",\n\t}\n\n\tresp, err := client.Discovery.Organizations.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/discovery/organizations/create\npackage com.example;\n\nimport com.stytch.java.b2b.models.discoveryorganizations.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.setIntermediateSessionToken(\"${token}\");\n params.setOrganizationName(\"${organizationName}\");\n params.setOrganizationSlug(\"${organizationSlug}\");\n params.setOrganizationExternalId(\"my-external-id\");\n\n Object result = StytchB2BClient.getDiscovery().getOrganizations().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/discovery/organizations/create\npackage com.example\n\nimport com.stytch.java.b2b.StytchB2BClient\nimport com.stytch.java.b2b.models.discoveryorganizations.CreateRequest\n\nfun main() {\n StytchB2BClient.configure(\n projectId = \"${projectId}\",\n secret = \"${secret}\",\n )\n\n when (\n val result =\n StytchB2BClient.discovery.organizations.create(\n CreateRequest(\n intermediateSessionToken = \"${token}\",\n organizationName = \"${organizationName}\",\n organizationSlug = \"${organizationSlug}\",\n organizationExternalId = \"my-external-id\",\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/discovery/organizations/create\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n intermediate_session_token: \"${token}\",\n organization_name: \"${organizationName}\",\n organization_slug: \"${organizationSlug}\",\n organization_external_id: \"my-external-id\",\n};\n\nclient.discovery.organizations.create(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: php
label: PHP
source: "$response = $client->discovery->organizations->create([\n 'intermediate_session_token' => '${token}',\n 'organization_name' => '${organizationName}',\n 'organization_slug' => '${organizationSlug}',\n 'organization_external_id' => 'my-external-id',\n]);"
- lang: python
label: Python
source: "# POST /v1/b2b/discovery/organizations/create\nfrom stytch import B2BClient\n\nclient = B2BClient(\n project_id=\"${projectId}\",\n secret=\"${secret}\",\n)\n\nresp = client.discovery.organizations.create(\n intermediate_session_token=\"${token}\",\n organization_name=\"${organizationName}\",\n organization_slug=\"${organizationSlug}\",\n organization_external_id=\"my-external-id\",\n)\n\nprint(resp)\n"
- lang: ruby
label: Ruby
source: "# POST /v1/b2b/discovery/organizations/create\nrequire 'stytch'\n\nclient = StytchB2B::Client.new(\n project_id: \"${projectId}\",\n secret: \"${secret}\"\n)\n\nresp = client.discovery.organizations.create(\n intermediate_session_token: \"${token}\",\n organization_name: \"${organizationName}\",\n organization_slug: \"${organizationSlug}\",\n organization_external_id: \"my-external-id\"\n \n)\n\nputs resp"
- lang: rust
label: Rust
source: "// POST /v1/b2b/discovery/organizations/create\nuse stytch::b2b::client::Client;\nuse stytch::b2b::discovery_organizations::CreateRequest;\n\nfn main() {\n let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n let resp = client.discovery.organizations.create(\n CreateRequest{\n intermediate_session_token: \"${token}\",\n organization_name: Some(String::from(\"${organizationName}\")),\n organization_slug: Some(String::from(\"${organizationSlug}\")),\n organization_external_id: Some(String::from(\"my-external-id\")),\n ..Default::default()\n }\n ).await;\n println!(\"The response is {:?}\", resp);\n}"
- lang: bash
label: cURL
source: "# POST /v1/b2b/discovery/organizations/create\ncurl --request POST \\\n --url https://test.stytch.com/v1/b2b/discovery/organizations/create \\\n -u '${projectId}:${secret}' \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"intermediate_session_token\": \"${token}\",\n \"organization_name\": \"${organizationName}\",\n \"organization_slug\": \"${organizationSlug}\",\n \"organization_external_id\": \"my-external-id\"\n }'"
/v1/b2b/discovery/organizations:
post:
summary: List
operationId: api_discovery_v1_discovery_organizations_List
tags:
- Discovery
description: "List all possible organization relationships connected to a [Member Session](https://stytch.com/docs/b2b/api/session-object) or Intermediate Session.\n\nWhen a Member Session is passed in, relationships with a type of `active_member`, `pending_member`, or `invited_member`\nwill be returned, and any membership can be assumed by calling the [Exchange Session](https://stytch.com/docs/b2b/api/exchange-session) endpoint.\n\nWhen an Intermediate Session is passed in, all relationship types - `active_member`, `pending_member`, `invited_member`, \n`eligible_to_join_by_email_domain`, and `eligible_to_join_by_oauth_tenant` - will be returned, \nand any membership can be assumed by calling the [Exchange Intermediate Session](https://stytch.com/docs/b2b/api/exchange-intermediate-session) endpoint. \n\nThis endpoint requires either an `intermediate_session_token`, `session_jwt` or `session_token` be included in the request.\nIt will return an error if multiple are present.\n\nThis operation does not consume the Intermediate Session or Session Token passed in."
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/api_discovery_v1_discovery_ListRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/api_discovery_v1_discovery_ListResponse'
'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/discovery/organizations\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n intermediate_session_token: \"${token}\",\n};\n\nclient.Discovery.Organizations.List(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: go
label: Go
source: "// POST /v1/b2b/discovery/organizations\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/discovery/organizations\"\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 := &organizations.ListParams{\n\t\tIntermediateSessionToken: \"${token}\",\n\t}\n\n\tresp, err := client.Discovery.Organizations.List(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/discovery/organizations\npackage com.example;\n\nimport com.stytch.java.b2b.models.discoveryorganizations.ListRequest;\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 ListRequest params = new ListRequest();\n params.setIntermediateSessionToken(\"${token}\");\n\n Object result = StytchB2BClient.getDiscovery().getOrganizations().list(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/discovery/organizations\npackage com.example\n\nimport com.stytch.java.b2b.StytchB2BClient\nimport com.stytch.java.b2b.models.discoveryorganizations.ListRequest\n\nfun main() {\n StytchB2BClient.configure(\n projectId = \"${projectId}\",\n secret = \"${secret}\",\n )\n\n when (\n val result =\n StytchB2BClient.discovery.organizations.list(\n ListRequest(\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/discovery/organizations\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n intermediate_session_token: \"${token}\",\n};\n\nclient.discovery.organizations.list(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: php
label: PHP
source: "$response = $client->discovery->organizations->list([\n 'intermediate_session_token' => '${token}',\n]);"
- lang: python
label: Python
source: "# POST /v1/b2b/discovery/organizations\nfrom stytch import B2BClient\n\nclient = B2BClient(\n project_id=\"${projectId}\",\n secret=\"${secret}\",\n)\n\nresp = client.discovery.organizations.list(\n intermediate_session_token=\"${token}\",\n)\n\nprint(resp)\n"
- lang: ruby
label: Ruby
source: "# POST /v1/b2b/discovery/organizations\nrequire 'stytch'\n\nclient = StytchB2B::Client.new(\n project_id: \"${projectId}\",\n secret: \"${secret}\"\n)\n\nresp = client.discovery.organizations.list(\n intermediate_session_token: \"${token}\"\n \n)\n\nputs resp"
- lang: rust
label: Rust
source: "// POST /v1/b2b/discovery/organizations\nuse stytch::b2b::client::Client;\nuse stytch::b2b::discovery_organizations::ListRequest;\n\nfn main() {\n let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n let resp = client.discovery.organizations.list(\n ListRequest{\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/discovery/organizations\ncurl --request POST \\\n --url https://test.stytch.com/v1/b2b/discovery/organizations \\\n -u '${projectId}:${secret}' \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"intermediate_session_token\": \"${token}\"\n }'"
/v1/b2b/passwords/discovery/email/reset/start:
post:
summary: Resetstart
operationId: api_b2b_password_v1_b2b_passwords_discovery_email_ResetStart
tags:
- Discovery
description: 'Initiates a password reset for the email address provided, when cross-org passwords are enabled. 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_discovery_email_ResetStartRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/api_b2b_password_v1_b2b_passwords_discovery_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/discovery/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 email_address: \"${email}\",\n};\n\nclient.Passwords.Discovery.Email.ResetStart(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: go
label: Go
# --- truncated at 32 KB (143 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/stytch/refs/heads/main/openapi/stytch-discovery-api-openapi.yml