Stytch B2B RBAC API

The B2B RBAC API from Stytch — 2 operation(s) for b2b rbac.

OpenAPI Specification

stytch-b2b-rbac-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Stytch B2B Authentication Application B2B RBAC 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 RBAC
paths:
  /v1/b2b/rbac/policy:
    get:
      summary: Policy
      operationId: api_b2b_rbac_v1_Policy
      tags:
      - B2B RBAC
      description: 'Get the active RBAC Policy for your current Stytch Project. An RBAC Policy is the canonical document that stores all defined Resources and Roles within your RBAC permissioning model.


        When using the backend SDKs, the RBAC Policy will be cached to allow for local evaluations, eliminating the need for an extra request to Stytch. The policy will be refreshed if an authorization check is requested and the RBAC policy was last updated more than 5 minutes ago.


        Resources and Roles can be created and managed within the [RBAC page](https://stytch.com/dashboard/rbac) in the Dashboard.

        Additionally, [Role assignment](https://stytch.com/docs/b2b/guides/rbac/role-assignment) can be programmatically managed through certain Stytch API endpoints.


        Check out the [RBAC overview](https://stytch.com/docs/b2b/guides/rbac/overview) to learn more about Stytch''s RBAC permissioning model.'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_b2b_rbac_v1_PolicyResponse'
        '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/rbac/policy\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n  project_id: '${projectId}',\n  secret: '${secret}',\n});\n\nconst params = {\n};\n\nclient.RBAC.Policy(params)\n  .then(resp => { console.log(resp) })\n  .catch(err => { console.log(err) });"
      - lang: go
        label: Go
        source: "// GET /v1/b2b/rbac/policy\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/rbac\"\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 := &rbac.PolicyParams{}\n\n\tresp, err := client.RBAC.Policy(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/rbac/policy\npackage com.example;\n\nimport com.stytch.java.b2b.models.rbac.PolicyRequest;\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        PolicyRequest params = new PolicyRequest();\n\n        Object result = StytchB2BClient.getRBAC().policy(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/rbac/policy\npackage com.example\n\nimport com.stytch.java.b2b.StytchB2BClient\nimport com.stytch.java.b2b.models.rbac.PolicyRequest\n\nfun main() {\n    StytchB2BClient.configure(\n        projectId = \"${projectId}\",\n        secret = \"${secret}\",\n    )\n\n    when (\n        val result =\n            StytchB2BClient.rbac.policy(\n                PolicyRequest(),\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/rbac/policy\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n  project_id: '${projectId}',\n  secret: '${secret}',\n});\n\nconst params = {\n};\n\nclient.rbac.policy(params)\n  .then(resp => { console.log(resp) })\n  .catch(err => { console.log(err) });"
      - lang: php
        label: PHP
        source: '$response = $client->rbac->policy([

          ]);'
      - lang: python
        label: Python
        source: "# GET /v1/b2b/rbac/policy\nfrom stytch import B2BClient\n\nclient = B2BClient(\n    project_id=\"${projectId}\",\n    secret=\"${secret}\",\n)\n\nresp = client.rbac.policy()\n\nprint(resp)\n"
      - lang: ruby
        label: Ruby
        source: "# GET /v1/b2b/rbac/policy\nrequire 'stytch'\n\nclient = StytchB2B::Client.new(\n  project_id: \"${projectId}\",\n  secret: \"${secret}\"\n)\n\nresp = client.rbac.policy(\n  \n)\n\nputs resp"
      - lang: rust
        label: Rust
        source: "// GET /v1/b2b/rbac/policy\nuse stytch::b2b::client::Client;\nuse stytch::b2b::rbac::PolicyRequest;\n\nfn main() {\n    let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n    let resp = client.rbac.policy(\n        PolicyRequest{\n            ..Default::default()\n        }\n    ).await;\n    println!(\"The response is {:?}\", resp);\n}"
      - lang: bash
        label: cURL
        source: "# GET /v1/b2b/rbac/policy\ncurl --request GET \\\n  --url https://test.stytch.com/v1/b2b/rbac/policy \\\n  -u '${projectId}:${secret}' \\\n  -H 'Content-Type: application/json'"
  /v1/b2b/rbac/organizations/{organization_id}:
    get:
      summary: Getorgpolicy
      operationId: api_b2b_rbac_v1_b2b_rbac_organizations_GetOrgPolicy
      tags:
      - B2B RBAC
      description: '

        The organization RBAC policy feature is currently in private beta and must be enabled for your Workspace. Please contact Stytch support at support@stytch.com to request access.


        Get the active RBAC Policy for a specific Organization within your Stytch Project. An Organization RBAC Policy contains the roles that have been defined specifically for that organization, allowing for organization-specific permissioning models.


        This endpoint returns the organization-scoped roles that supplement the project-level RBAC policy. Organization policies allow you to define custom roles that are specific to individual organizations within your project.


        When using the backend SDKs, the RBAC Policy will be cached to allow for local evaluations, eliminating the need for an extra request to Stytch. The policy will be refreshed if an authorization check is requested and the RBAC policy was last updated more than 5 minutes ago.


        Organization-specific roles can be created and managed through this API endpoint, providing fine-grained control over permissions at the organization level.


        Check out the [RBAC overview](https://stytch.com/docs/b2b/guides/rbac/overview) to learn more about Stytch''s RBAC permissioning model and organization-scoped policies.'
      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_b2b_rbac_v1_b2b_rbac_organizations_GetOrgPolicyResponse'
        '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/rbac/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.RBAC.Organizations.GetOrgPolicy(params)\n  .then(resp => { console.log(resp) })\n  .catch(err => { console.log(err) });"
      - lang: go
        label: Go
        source: "// GET /v1/b2b/rbac/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/rbac/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.GetOrgPolicyParams{\n\t\tOrganizationID: \"${organizationId}\",\n\t}\n\n\tresp, err := client.RBAC.Organizations.GetOrgPolicy(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/rbac/organizations/{organization_id}\npackage com.example;\n\nimport com.stytch.java.b2b.models.rbacorganizations.GetOrgPolicyRequest;\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        GetOrgPolicyRequest params = new GetOrgPolicyRequest();\n        params.setOrganizationId(\"${organizationId}\");\n\n        Object result = StytchB2BClient.getRBAC().getOrganizations().getOrgPolicy(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/rbac/organizations/{organization_id}\npackage com.example\n\nimport com.stytch.java.b2b.StytchB2BClient\nimport com.stytch.java.b2b.models.rbacorganizations.GetOrgPolicyRequest\n\nfun main() {\n    StytchB2BClient.configure(\n        projectId = \"${projectId}\",\n        secret = \"${secret}\",\n    )\n\n    when (\n        val result =\n            StytchB2BClient.rbac.organizations.getOrgPolicy(\n                GetOrgPolicyRequest(\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/rbac/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.rbac.organizations.getOrgPolicy(params)\n  .then(resp => { console.log(resp) })\n  .catch(err => { console.log(err) });"
      - lang: php
        label: PHP
        source: "$response = $client->rbac->organizations->get_org_policy([\n    'organization_id' => '${organizationId}',\n]);"
      - lang: python
        label: Python
        source: "# GET /v1/b2b/rbac/organizations/{organization_id}\nfrom stytch import B2BClient\n\nclient = B2BClient(\n    project_id=\"${projectId}\",\n    secret=\"${secret}\",\n)\n\nresp = client.rbac.organizations.get_org_policy(\n    organization_id=\"${organizationId}\",\n)\n\nprint(resp)\n"
      - lang: ruby
        label: Ruby
        source: "# GET /v1/b2b/rbac/organizations/{organization_id}\nrequire 'stytch'\n\nclient = StytchB2B::Client.new(\n  project_id: \"${projectId}\",\n  secret: \"${secret}\"\n)\n\nresp = client.rbac.organizations.get_org_policy(\n  organization_id: \"${organizationId}\"\n  \n)\n\nputs resp"
      - lang: rust
        label: Rust
        source: "// GET /v1/b2b/rbac/organizations/{organization_id}\nuse stytch::b2b::client::Client;\nuse stytch::b2b::rbac_organizations::GetOrgPolicyRequest;\n\nfn main() {\n    let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n    let resp = client.rbac.organizations.get_org_policy(\n        GetOrgPolicyRequest{\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/rbac/organizations/{organization_id}\ncurl --request GET \\\n  --url https://test.stytch.com/v1/b2b/rbac/organizations/${organizationId} \\\n  -u '${projectId}:${secret}' \\\n  -H 'Content-Type: application/json'"
    put:
      summary: Setorgpolicy
      operationId: api_b2b_rbac_v1_b2b_rbac_organizations_SetOrgPolicy
      tags:
      - B2B RBAC
      description: '

        The organization RBAC policy feature is currently in private beta and must be enabled for your Workspace. Please contact Stytch support at support@stytch.com to request access.


        Set the RBAC Policy for a specific Organization within your Stytch Project. An Organization RBAC Policy allows you to define roles that are specific to that organization, providing fine-grained control over permissions at the organization level.


        This endpoint allows you to create, update, or replace the organization-scoped roles for a given organization. Organization policies supplement the project-level RBAC policy with additional roles that are only applicable within the context of that specific organization.


        The organization policy consists of roles, where each role defines:

        - A unique `role_id` to identify the role

        - A human-readable `description` of the role''s purpose

        - A set of `permissions` that specify which actions can be performed on which resources


        When you set an organization policy, it will replace any existing organization-specific roles for that organization. The project-level RBAC policy remains unchanged.


        Organization-specific roles are useful for scenarios where different organizations within your project require different permission structures, such as:

        - Multi-tenant applications with varying access levels per tenant

        - Organizations with custom approval workflows

        - Different organizational hierarchies requiring unique role definitions


        Check out the [RBAC overview](https://stytch.com/docs/b2b/guides/rbac/overview) to learn more about Stytch''s RBAC permissioning model and organization-scoped policies.'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/api_b2b_rbac_v1_b2b_rbac_organizations_SetOrgPolicyRequest'
      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_b2b_rbac_v1_b2b_rbac_organizations_SetOrgPolicyResponse'
        '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/rbac/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  org_policy: TODO_MISSING_EXAMPLE_VALUE,\n};\n\nclient.RBAC.Organizations.SetOrgPolicy(params)\n  .then(resp => { console.log(resp) })\n  .catch(err => { console.log(err) });"
      - lang: go
        label: Go
        source: "// PUT /v1/b2b/rbac/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/rbac/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.SetOrgPolicyParams{\n\t\tOrganizationID: \"${organizationId}\",\n\t\tOrgPolicy:      TODO_MISSING_EXAMPLE_VALUE,\n\t}\n\n\tresp, err := client.RBAC.Organizations.SetOrgPolicy(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: "// PUT /v1/b2b/rbac/organizations/{organization_id}\npackage com.example;\n\nimport com.stytch.java.b2b.models.rbacorganizations.SetOrgPolicyRequest;\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        SetOrgPolicyRequest params = new SetOrgPolicyRequest();\n        params.setOrganizationId(\"${organizationId}\");\n        params.setOrgPolicy(TODO_MISSING_EXAMPLE_VALUE);\n\n        Object result = StytchB2BClient.getRBAC().getOrganizations().setOrgPolicy(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: "// PUT /v1/b2b/rbac/organizations/{organization_id}\npackage com.example\n\nimport com.stytch.java.b2b.StytchB2BClient\nimport com.stytch.java.b2b.models.rbacorganizations.SetOrgPolicyRequest\n\nfun main() {\n    StytchB2BClient.configure(\n        projectId = \"${projectId}\",\n        secret = \"${secret}\",\n    )\n\n    when (\n        val result =\n            StytchB2BClient.rbac.organizations.setOrgPolicy(\n                SetOrgPolicyRequest(\n                    organizationId = \"${organizationId}\",\n                    orgPolicy = TODO_MISSING_EXAMPLE_VALUE,\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/rbac/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  org_policy: TODO_MISSING_EXAMPLE_VALUE,\n};\n\nclient.rbac.organizations.setOrgPolicy(params)\n  .then(resp => { console.log(resp) })\n  .catch(err => { console.log(err) });"
      - lang: php
        label: PHP
        source: "$response = $client->rbac->organizations->set_org_policy([\n    'organization_id' => '${organizationId}',\n    'org_policy' => TODO_MISSING_EXAMPLE_VALUE,\n]);"
      - lang: python
        label: Python
        source: "# PUT /v1/b2b/rbac/organizations/{organization_id}\nfrom stytch import B2BClient\n\nclient = B2BClient(\n    project_id=\"${projectId}\",\n    secret=\"${secret}\",\n)\n\nresp = client.rbac.organizations.set_org_policy(\n    organization_id=\"${organizationId}\",\n    org_policy=TODO_MISSING_EXAMPLE_VALUE,\n)\n\nprint(resp)\n"
      - lang: ruby
        label: Ruby
        source: "# PUT /v1/b2b/rbac/organizations/{organization_id}\nrequire 'stytch'\n\nclient = StytchB2B::Client.new(\n  project_id: \"${projectId}\",\n  secret: \"${secret}\"\n)\n\nresp = client.rbac.organizations.set_org_policy(\n  organization_id: \"${organizationId}\",\n  org_policy: TODO_MISSING_EXAMPLE_VALUE\n  \n)\n\nputs resp"
      - lang: rust
        label: Rust
        source: "// PUT /v1/b2b/rbac/organizations/{organization_id}\nuse stytch::b2b::client::Client;\nuse stytch::b2b::rbac_organizations::SetOrgPolicyRequest;\n\nfn main() {\n    let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n    let resp = client.rbac.organizations.set_org_policy(\n        SetOrgPolicyRequest{\n            organization_id: \"${organizationId}\",\n            org_policy: TODO_MISSING_EXAMPLE_VALUE,\n            ..Default::default()\n        }\n    ).await;\n    println!(\"The response is {:?}\", resp);\n}"
      - lang: bash
        label: cURL
        source: "# PUT /v1/b2b/rbac/organizations/{organization_id}\ncurl --request PUT \\\n  --url https://test.stytch.com/v1/b2b/rbac/organizations/${organizationId} \\\n  -u '${projectId}:${secret}' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"org_policy\": TODO_MISSING_EXAMPLE_VALUE\n  }'"
components:
  schemas:
    api_b2b_rbac_v1_PolicyScope:
      type: object
      properties:
        scope:
          type: string
          description: The unique identifier of the RBAC Scope, provided by the developer and intended to be human-readable.
        description:
          type: string
          description: The description of the RBAC Scope.
        permissions:
          type: array
          items:
            $ref: '#/components/schemas/api_b2b_rbac_v1_PolicyScopePermission'
          description: A list of permissions that link a [Resource](https://stytch.com/docs/b2b/api/rbac-resource-object) to a list of actions.
      required:
      - scope
      - description
      - permissions
    api_b2b_rbac_v1_OrgPolicy:
      type: object
      properties:
        roles:
          type: array
          items:
            $ref: '#/components/schemas/api_b2b_rbac_v1_PolicyRole'
          description: An array of [Role objects](https://stytch.com/docs/b2b/api/rbac-role-object).
      required:
      - roles
    api_b2b_rbac_v1_PolicyResource:
      type: object
      properties:
        resource_id:
          type: string
          description: "A unique identifier of the RBAC Resource, provided by the developer and intended to be human-readable.\n\n  A `resource_id` is not allowed to start with `stytch`, which is a special prefix used for Stytch default Resources with reserved `resource_id`s. These include:\n\n  * `stytch.organization`\n  * `stytch.member`\n  * `stytch.sso`\n  * `stytch.self`\n\n  Check out the [guide on Stytch default Resources](https://stytch.com/docs/b2b/guides/rbac/stytch-default) for a more detailed explanation.\n\n  "
        description:
          type: string
          description: The description of the RBAC Resource.
        actions:
          type: array
          items:
            type: string
          description: "A list of all possible actions for a provided Resource.\n\n  Reserved `actions` that are predefined by Stytch include:\n\n  * `*`\n  * For the `stytch.organization` Resource:\n    * `update.info.name`\n    * `update.info.slug`\n    * `update.info.untrusted_metadata`\n    * `update.info.email_jit_provisioning`\n    * `update.info.logo_url`\n    * `update.info.email_invites`\n    * `update.info.allowed_domains`\n    * `update.info.default_sso_connection`\n    * `update.info.sso_jit_provisioning`\n    * `update.info.mfa_policy`\n    * `update.info.implicit_roles`\n    * `delete`\n  * For the `stytch.member` Resource:\n    * `create`\n    * `update.info.name`\n    * `update.info.untrusted_metadata`\n    * `update.info.mfa-phone`\n    * `update.info.delete.mfa-phone`\n    * `update.settings.is-breakglass`\n    * `update.settings.mfa_enrolled`\n    * `update.settings.roles`\n    * `search`\n    * `delete`\n  * For the `stytch.sso` Resource:\n    * `create`\n    * `update`\n    * `delete`\n  * For the `stytch.self` Resource:\n    * `update.info.name`\n    * `update.info.untrusted_metadata`\n    * `update.info.mfa-phone`\n    * `update.info.delete.mfa-phone`\n    * `update.info.delete.password`\n    * `update.settings.mfa_enrolled`\n    * `delete`\n  "
      required:
      - resource_id
      - description
      - actions
    api_b2b_rbac_v1_PolicyRolePermission:
      type: object
      properties:
        resource_id:
          type: string
          description: "A unique identifier of the RBAC Resource, provided by the developer and intended to be human-readable.\n\n  A `resource_id` is not allowed to start with `stytch`, which is a special prefix used for Stytch default Resources with reserved `resource_id`s. These include:\n\n  * `stytch.organization`\n  * `stytch.member`\n  * `stytch.sso`\n  * `stytch.self`\n\n  Check out the [guide on Stytch default Resources](https://stytch.com/docs/b2b/guides/rbac/stytch-default) for a more detailed explanation.\n\n  "
        actions:
          type: array
          items:
            type: string
          description: 'A list of permitted actions the Scope is required to take with the provided Resource. You can use `*` as a wildcard to require a Scope permission to use all possible actions related to the Resource. '
      required:
      - resource_id
      - actions
    api_b2b_rbac_v1_PolicyResponse:
      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.
        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.
        policy:
          $ref: '#/components/schemas/api_b2b_rbac_v1_Policy'
          description: The RBAC Policy document that contains all defined Roles and Resources – which are managed in the [Dashboard](https://stytch.com/dashboard/rbac). Read more about these entities and how they work in our [RBAC overview](https://stytch.com/docs/b2b/guides/rbac/overview).
      required:
      - request_id
      - status_code
    api_b2b_rbac_v1_b2b_rbac_organizations_SetOrgPolicyResponse:
      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.
        org_policy:
          $ref: '#/components/schemas/api_b2b_rbac_v1_OrgPolicy'
          description: The organization-specific RBAC Policy that contains roles defined for this organization. Organization policies supplement the project-level RBAC policy with additional roles that are specific to the organization.
        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
      - org_policy
      - status_code
    api_b2b_rbac_v1_Policy:
      type: object
      properties:
        roles:
          type: array
          items:
            $ref: '#/components/schemas/api_b2b_rbac_v1_PolicyRole'
          description: An array of [Role objects](https://stytch.com/docs/b2b/api/rbac-role-o

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