Stytch Organization API

The Organization API from Stytch — 7 operation(s) for organization.

OpenAPI Specification

stytch-organization-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Stytch B2B Authentication Application Organization 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: Organization
paths:
  /v1/b2b/organizations:
    post:
      summary: Create
      operationId: api_organization_v1_Create
      tags:
      - Organization
      description: 'Creates an Organization. An `organization_name` and a unique `organization_slug` are required.


        If no Organization authentication setting parameters are passed in, `email_invites` will default to `ALL_ALLOWED` so that the Organization has a way to add Members. Otherwise, `email_invites` will default to `NOT_ALLOWED`.


        *See the [Organization authentication settings](https://stytch.com/docs/b2b/api/org-auth-settings) resource to learn more about fields like `email_jit_provisioning`, `email_invites`, `sso_jit_provisioning`, etc., and their behaviors.'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/api_organization_v1_CreateRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_organization_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/organizations\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n  project_id: '${projectId}',\n  secret: '${secret}',\n});\n\nconst params = {\n  organization_name: \"${organizationName}\",\n  organization_slug: \"${organizationSlug}\",\n  organization_external_id: \"my-external-id\",\n};\n\nclient.Organizations.Create(params)\n  .then(resp => { console.log(resp) })\n  .catch(err => { console.log(err) });"
      - lang: go
        label: Go
        source: "// POST /v1/b2b/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/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\tOrganizationName:       \"${organizationName}\",\n\t\tOrganizationSlug:       \"${organizationSlug}\",\n\t\tOrganizationExternalID: \"my-external-id\",\n\t}\n\n\tresp, err := client.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/organizations\npackage com.example;\n\nimport com.stytch.java.b2b.models.organizations.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.setOrganizationName(\"${organizationName}\");\n        params.setOrganizationSlug(\"${organizationSlug}\");\n        params.setOrganizationExternalId(\"my-external-id\");\n\n        Object result = StytchB2BClient.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/organizations\npackage com.example\n\nimport com.stytch.java.b2b.StytchB2BClient\nimport com.stytch.java.b2b.models.organizations.CreateRequest\n\nfun main() {\n    StytchB2BClient.configure(\n        projectId = \"${projectId}\",\n        secret = \"${secret}\",\n    )\n\n    when (\n        val result =\n            StytchB2BClient.organizations.create(\n                CreateRequest(\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/organizations\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n  project_id: '${projectId}',\n  secret: '${secret}',\n});\n\nconst params = {\n  organization_name: \"${organizationName}\",\n  organization_slug: \"${organizationSlug}\",\n  organization_external_id: \"my-external-id\",\n};\n\nclient.organizations.create(params)\n  .then(resp => { console.log(resp) })\n  .catch(err => { console.log(err) });"
      - lang: php
        label: PHP
        source: "$response = $client->organizations->create([\n    'organization_name' => '${organizationName}',\n    'organization_slug' => '${organizationSlug}',\n    'organization_external_id' => 'my-external-id',\n]);"
      - lang: python
        label: Python
        source: "# POST /v1/b2b/organizations\nfrom stytch import B2BClient\n\nclient = B2BClient(\n    project_id=\"${projectId}\",\n    secret=\"${secret}\",\n)\n\nresp = client.organizations.create(\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/organizations\nrequire 'stytch'\n\nclient = StytchB2B::Client.new(\n  project_id: \"${projectId}\",\n  secret: \"${secret}\"\n)\n\nresp = client.organizations.create(\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/organizations\nuse stytch::b2b::client::Client;\nuse stytch::b2b::organizations::CreateRequest;\n\nfn main() {\n    let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n    let resp = client.organizations.create(\n        CreateRequest{\n            organization_name: \"${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/organizations\ncurl --request POST \\\n  --url https://test.stytch.com/v1/b2b/organizations \\\n  -u '${projectId}:${secret}' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"organization_name\": \"${organizationName}\",\n    \"organization_slug\": \"${organizationSlug}\",\n    \"organization_external_id\": \"my-external-id\"\n  }'"
  /v1/b2b/organizations/{organization_id}:
    get:
      summary: Get
      operationId: api_organization_v1_Get
      tags:
      - Organization
      description: Returns an Organization specified by `organization_id`.
      parameters:
      - name: organization_id
        in: path
        required: true
        schema:
          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.
        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.
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_organization_v1_GetResponse'
        '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: "// GET /v1/b2b/organizations/{organization_id}\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};\n\nclient.Organizations.Get(params)\n  .then(resp => { console.log(resp) })\n  .catch(err => { console.log(err) });"
      - lang: go
        label: Go
        source: "// GET /v1/b2b/organizations/{organization_id}\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/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.GetParams{\n\t\tOrganizationID: \"${organizationId}\",\n\t}\n\n\tresp, err := client.Organizations.Get(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: "// GET /v1/b2b/organizations/{organization_id}\npackage com.example;\n\nimport com.stytch.java.b2b.models.organizations.GetRequest;\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        GetRequest params = new GetRequest();\n        params.setOrganizationId(\"${organizationId}\");\n\n        Object result = StytchB2BClient.getOrganizations().get(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: "// GET /v1/b2b/organizations/{organization_id}\npackage com.example\n\nimport com.stytch.java.b2b.StytchB2BClient\nimport com.stytch.java.b2b.models.organizations.GetRequest\n\nfun main() {\n    StytchB2BClient.configure(\n        projectId = \"${projectId}\",\n        secret = \"${secret}\",\n    )\n\n    when (\n        val result =\n            StytchB2BClient.organizations.get(\n                GetRequest(\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: "// GET /v1/b2b/organizations/{organization_id}\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};\n\nclient.organizations.get(params)\n  .then(resp => { console.log(resp) })\n  .catch(err => { console.log(err) });"
      - lang: php
        label: PHP
        source: "$response = $client->organizations->get([\n    'organization_id' => '${organizationId}',\n]);"
      - lang: python
        label: Python
        source: "# GET /v1/b2b/organizations/{organization_id}\nfrom stytch import B2BClient\n\nclient = B2BClient(\n    project_id=\"${projectId}\",\n    secret=\"${secret}\",\n)\n\nresp = client.organizations.get(\n    organization_id=\"${organizationId}\",\n)\n\nprint(resp)\n"
      - lang: ruby
        label: Ruby
        source: "# GET /v1/b2b/organizations/{organization_id}\nrequire 'stytch'\n\nclient = StytchB2B::Client.new(\n  project_id: \"${projectId}\",\n  secret: \"${secret}\"\n)\n\nresp = client.organizations.get(\n  organization_id: \"${organizationId}\"\n  \n)\n\nputs resp"
      - lang: rust
        label: Rust
        source: "// GET /v1/b2b/organizations/{organization_id}\nuse stytch::b2b::client::Client;\nuse stytch::b2b::organizations::GetRequest;\n\nfn main() {\n    let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n    let resp = client.organizations.get(\n        GetRequest{\n            organization_id: \"${organizationId}\",\n            ..Default::default()\n        }\n    ).await;\n    println!(\"The response is {:?}\", resp);\n}"
      - lang: bash
        label: cURL
        source: "# GET /v1/b2b/organizations/{organization_id}\ncurl --request GET \\\n  --url https://test.stytch.com/v1/b2b/organizations/${organizationId} \\\n  -u '${projectId}:${secret}' \\\n  -H 'Content-Type: application/json'"
    put:
      summary: Update
      operationId: api_organization_v1_Update
      tags:
      - Organization
      description: 'Updates an Organization specified by `organization_id`. An Organization must always have at least one auth setting set to either `RESTRICTED` or `ALL_ALLOWED` in order to provision new Members.


        *See the [Organization authentication settings](https://stytch.com/docs/b2b/api/org-auth-settings) resource to learn more about fields like `email_jit_provisioning`, `email_invites`, `sso_jit_provisioning`, etc., and their behaviors.'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/api_organization_v1_UpdateRequest'
      parameters:
      - name: organization_id
        in: path
        required: true
        schema:
          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.
        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.
      - name: X-Stytch-Member-Session
        in: header
        required: false
        description: A Stytch session that can be used to run the request with the given member's permissions.
        schema:
          type: string
      - name: X-Stytch-Member-SessionJWT
        in: header
        required: false
        description: A Stytch Session JSON Web Token (JWT) that can be used to run the request with the given member's permissions.
        schema:
          type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_organization_v1_UpdateResponse'
        '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: "// PUT /v1/b2b/organizations/{organization_id}\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  organization_name: \"${organizationName}\",\n  organization_external_id: \"my-new-external-id\",\n  email_jit_provisioning: \"ALL_ALLOWED\",\n};\n\nconst options = {\n  authorization: {\n    session_token: '${sessionToken}',\n  },\n};\n\nclient.Organizations.Update(params, options)\n  .then(resp => { console.log(resp) })\n  .catch(err => { console.log(err) });"
      - lang: go
        label: Go
        source: "// PUT /v1/b2b/organizations/{organization_id}\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/organizations\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/methodoptions\"\n)\n\nfunc main() {\n\tclient, err := b2bstytchapi.NewClient(\n\t\t\"${projectId}\",\n\t\t\"${secret}\",\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"error instantiating client: %v\", err)\n\t}\n\n\tparams := &organizations.UpdateParams{\n\t\tOrganizationID:         \"${organizationId}\",\n\t\tOrganizationName:       \"${organizationName}\",\n\t\tOrganizationExternalID: \"my-new-external-id\",\n\t\tEmailJITProvisioning:   \"ALL_ALLOWED\",\n\t}\n\n\toptions := &organizations.UpdateParamsOptions{\n\t\tAuthorization: methodoptions.Authorization{\n\t\t\tSessionToken: \"${sessionToken}\",\n\t\t},\n\t}\n\n\tresp, err := client.Organizations.Update(context.Background(), params, options)\n\tif err != nil {\n\t\tlog.Fatalf(\"error in method call: %v\", err)\n\t}\n\n\tlog.Println(resp)\n}\n"
      - lang: java
        label: Java
        source: "// PUT /v1/b2b/organizations/{organization_id}\npackage com.example;\n\nimport com.stytch.java.b2b.models.organizations.UpdateRequest;\nimport com.stytch.java.b2b.models.organizations.UpdateRequestOptions;\nimport com.stytch.java.b2b.StytchB2BClient;\nimport com.stytch.java.common.methodoptions.Authorization;\nimport com.stytch.java.common.StytchResult;\n\npublic class Main {\n    public static void main(String[] args) {\n        StytchB2BClient.configure(\"${projectId}\", \"${secret}\");\n\n        UpdateRequest params = new UpdateRequest();\n        params.setOrganizationId(\"${organizationId}\");\n        params.setOrganizationName(\"${organizationName}\");\n        params.setOrganizationExternalId(\"my-new-external-id\");\n        params.setEmailJITProvisioning(\"ALL_ALLOWED\");\n\n        UpdateRequestOptions options = new UpdateRequestOptions();\n        Authorization authorization = new Authorization();\n        authorization.setSessionToken(\"${sessionToken}\");\n        options.setAuthorization(authorization);\n\n        Object result = StytchB2BClient.getOrganizations().update(params, options);\n        if (result instanceof StytchResult.Success) {\n          System.out.println(((StytchResult.Success) result).getValue());\n        } else {\n          System.out.println(((StytchResult.Error) result).getException());\n        }\n    }\n}"
      - lang: kotlin
        label: Kotlin
        source: "// PUT /v1/b2b/organizations/{organization_id}\npackage com.example\n\nimport com.stytch.java.b2b.StytchB2BClient\nimport com.stytch.java.b2b.models.organizations.UpdateRequest\nimport com.stytch.java.b2b.models.organizations.UpdateRequestOptions\nimport com.stytch.java.common.methodoptions.Authorization\n\nfun main() {\n    StytchB2BClient.configure(\n        projectId = \"${projectId}\",\n        secret = \"${secret}\",\n    )\n\n    when (\n        val result =\n            StytchB2BClient.organizations.update(\n                UpdateRequest(\n                    organizationId = \"${organizationId}\",\n                    organizationName = \"${organizationName}\",\n                    organizationExternalId = \"my-new-external-id\",\n                    emailJITProvisioning = \"ALL_ALLOWED\",\n                ),\n                UpdateRequestOptions(\n                    Authorization(\n                        sessionToken = \"${sessionToken}\",\n                    ),\n                ),\n            )\n    ) {\n        is StytchResult.Success -> println(result.value)\n        is StytchResult.Error -> println(result.exception)\n    }\n}\n"
      - lang: javascript
        label: Node.js
        source: "// PUT /v1/b2b/organizations/{organization_id}\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  organization_name: \"${organizationName}\",\n  organization_external_id: \"my-new-external-id\",\n  email_jit_provisioning: \"ALL_ALLOWED\",\n};\n\nconst options = {\n  authorization: {\n    session_token: '${sessionToken}',\n  },\n};\n\nclient.organizations.update(params, options)\n  .then(resp => { console.log(resp) })\n  .catch(err => { console.log(err) });"
      - lang: php
        label: PHP
        source: "$response = $client->organizations->update([\n    'organization_id' => '${organizationId}',\n    'organization_name' => '${organizationName}',\n    'organization_external_id' => 'my-new-external-id',\n    'email_jit_provisioning' => 'ALL_ALLOWED',\n], [\n        'authorization' => ['session_token' => '${sessionToken}'],\n\n]);"
      - lang: python
        label: Python
        source: "# PUT /v1/b2b/organizations/{organization_id}\nfrom stytch import B2BClient\nfrom stytch.b2b.models.organizations import UpdateRequestOptions\nfrom stytch.shared.method_options import Authorization\n\nclient = B2BClient(\n    project_id=\"${projectId}\",\n    secret=\"${secret}\",\n)\n\nresp = client.organizations.update(\n    organization_id=\"${organizationId}\",\n    organization_name=\"${organizationName}\",\n    organization_external_id=\"my-new-external-id\",\n    email_jit_provisioning=\"ALL_ALLOWED\",\n    method_options=UpdateRequestOptions(\n        authorization=Authorization(\n            session_token=\"${sessionToken}\",\n        ),\n    ),\n)\n\nprint(resp)\n"
      - lang: ruby
        label: Ruby
        source: "# PUT /v1/b2b/organizations/{organization_id}\nrequire 'stytch'\n\nclient = StytchB2B::Client.new(\n  project_id: \"${projectId}\",\n  secret: \"${secret}\"\n)\n\nresp = client.organizations.update(\n  organization_id: \"${organizationId}\",\n  organization_name: \"${organizationName}\",\n  organization_external_id: \"my-new-external-id\",\n  email_jit_provisioning: \"ALL_ALLOWED\",\n  method_options: StytchB2B::Organizations::UpdateRequestOptions.new(\n    authorization: Stytch::MethodOptions::Authorization.new(session_token: '${sessionToken}')\n  )\n)\n\nputs resp"
      - lang: rust
        label: Rust
        source: "// PUT /v1/b2b/organizations/{organization_id}\nuse stytch::b2b::client::Client;\nuse stytch::b2b::organizations::UpdateRequest;\n\nfn main() {\n    let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n    let resp = client.organizations.update(\n        UpdateRequest{\n            organization_id: \"${organizationId}\",\n            organization_name: Some(String::from(\"${organizationName}\")),\n            organization_external_id: Some(String::from(\"my-new-external-id\")),\n            email_jit_provisioning: Some(String::from(\"ALL_ALLOWED\")),\n            ..Default::default()\n        }\n    ).await;\n    println!(\"The response is {:?}\", resp);\n}"
      - lang: bash
        label: cURL
        source: "# PUT /v1/b2b/organizations/{organization_id}\ncurl --request PUT \\\n  --url https://test.stytch.com/v1/b2b/organizations/${organizationId} \\\n  -u '${projectId}:${secret}' \\\n  -H 'Content-Type: application/json' \\\n  -H \"X-Stytch-Member-Session: ${sessionToken}\" \\\n  -d '{\n    \"organization_name\": \"${organizationName}\",\n    \"organization_external_id\": \"my-new-external-id\",\n    \"email_jit_provisioning\": \"ALL_ALLOWED\"\n  }'"
    delete:
      summary: Delete
      operationId: api_organization_v1_Delete
      tags:
      - Organization
      description: Deletes an Organization specified by `organization_id`. All Members of the Organization will also be deleted.
      parameters:
      - name: organization_id
        in: path
        required: true
        schema:
          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.
        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.
      - name: X-Stytch-Member-Session
        in: header
        required: false
        description: A Stytch session that can be used to run the request with the given member's permissions.
        schema:
          type: string
      - name: X-Stytch-Member-SessionJWT
        in: header
        required: false
        description: A Stytch Session JSON Web Token (JWT) that can be used to run the request with the given member's permissions.
        schema:
          type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_organization_v1_DeleteResponse'
        '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: "// DELETE /v1/b2b/organizations/{organization_id}\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};\n\nconst options = {\n  authorization: {\n    session_token: '${sessionToken}',\n  },\n};\n\nclient.Organizations.Delete(params, options)\n  .then(resp => { console.log(resp) })\n  .catch(err => { console.log(err) });"
      - lang: go
        label: Go
        source: "// DELETE /v1/b2b/organizations/{organization_id}\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/organizations\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/methodoptions\"\n)\n\nfunc main() {\n\tclient, err := b2bstytchapi.NewClient(\n\t\t\"${projectId}\",\n\t\t\"${secret}\",\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"error instantiating client: %v\", err)\n\t}\n\n\tparams := &organizations.DeleteParams{\n\t\tOrganizationID: \"${organizationId}\",\n\t}\n\n\toptions := &organizations.DeleteParamsOptions{\n\t\tAuthorization: methodoptions.Authorization{\n\t\t\tSessionToken: \"${sessionToken}\",\n\t\t},\n\t}\n\n\tresp, err := client.Organizations.Delete(context.Background(), params, options)\n\tif err != nil {\n\t\tlog.Fatalf(\"error in method call: %v\", err)\n\t}\n\n\tlog.Println(resp)\n}\n"
      - lang: java
        label: Java
        source: "// DELETE /v1/b2b/organizations/{organization_id}\npackage com.example;\n\nimport com.stytch.java.b2b.models.organizations.DeleteRequest;\nimport com.stytch.java.b2b.models.organizations.DeleteRequestOp

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