C#
// GET /v1/b2b/rbac/policy
const stytch = require('stytch');
const client = new stytch.B2BClient({
project_id: '${projectId}',
secret: '${secret}',
});
const params = {
};
client.RBAC.Policy(params)
.then(resp => { console.log(resp) })
.catch(err => { console.log(err) });// GET /v1/b2b/rbac/policy
package main
import (
"context"
"log"
"github.com/stytchauth/stytch-go/v18/stytch/b2b/b2bstytchapi"
"github.com/stytchauth/stytch-go/v18/stytch/b2b/rbac"
)
func main() {
client, err := b2bstytchapi.NewClient(
"${projectId}",
"${secret}",
)
if err != nil {
log.Fatalf("error instantiating client: %v", err)
}
params := &rbac.PolicyParams{}
resp, err := client.RBAC.Policy(context.Background(), params)
if err != nil {
log.Fatalf("error in method call: %v", err)
}
log.Println(resp)
}
// GET /v1/b2b/rbac/policy
package com.example;
import com.stytch.java.b2b.models.rbac.PolicyRequest;
import com.stytch.java.b2b.StytchB2BClient;
import com.stytch.java.common.StytchResult;
public class Main {
public static void main(String[] args) {
StytchB2BClient.configure("${projectId}", "${secret}");
PolicyRequest params = new PolicyRequest();
Object result = StytchB2BClient.getRBAC().policy(params);
if (result instanceof StytchResult.Success) {
System.out.println(((StytchResult.Success) result).getValue());
} else {
System.out.println(((StytchResult.Error) result).getException());
}
}
}// GET /v1/b2b/rbac/policy
package com.example
import com.stytch.java.b2b.StytchB2BClient
import com.stytch.java.b2b.models.rbac.PolicyRequest
fun main() {
StytchB2BClient.configure(
projectId = "${projectId}",
secret = "${secret}",
)
when (
val result =
StytchB2BClient.rbac.policy(
PolicyRequest(),
)
) {
is StytchResult.Success -> println(result.value)
is StytchResult.Error -> println(result.exception)
}
}
// GET /v1/b2b/rbac/policy
const stytch = require('stytch');
const client = new stytch.B2BClient({
project_id: '${projectId}',
secret: '${secret}',
});
const params = {
};
client.rbac.policy(params)
.then(resp => { console.log(resp) })
.catch(err => { console.log(err) });$response = $client->rbac->policy([
]);# GET /v1/b2b/rbac/policy
from stytch import B2BClient
client = B2BClient(
project_id="${projectId}",
secret="${secret}",
)
resp = client.rbac.policy()
print(resp)
# frozen_string_literal: true
# GET /v1/b2b/rbac/policy
require 'stytch'
client = StytchB2B::Client.new(
project_id: "${projectId}",
secret: "${secret}"
)
resp = client.rbac.policy(
)
puts resp// GET /v1/b2b/rbac/policy
use stytch::b2b::client::Client;
use stytch::b2b::rbac::PolicyRequest;
fn main() {
let client = Client::new("${projectId}", "${secret}").unwrap();
let resp = client.rbac.policy(
PolicyRequest{
..Default::default()
}
).await;
println!("The response is {:?}", resp);
}# GET /v1/b2b/rbac/policy
curl --request GET \
--url https://test.stytch.com/v1/b2b/rbac/policy \
-u '${projectId}:${secret}' \
-H 'Content-Type: application/json'{
"request_id": "<string>",
"status_code": 123,
"policy": {
"roles": [
{
"role_id": "<string>",
"description": "<string>",
"permissions": [
{
"resource_id": "<string>",
"actions": [
"<string>"
]
}
]
}
],
"resources": [
{
"resource_id": "<string>",
"description": "<string>",
"actions": [
"<string>"
]
}
],
"scopes": [
{
"scope": "<string>",
"description": "<string>",
"permissions": [
{
"resource_id": "<string>",
"actions": [
"<string>"
]
}
]
}
]
}
}{
"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"
}{
"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"
}{
"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"
}RBAC
Get Policy
Get the active RBAC Policy for the current Stytch Project.
GET
/
v1
/
b2b
/
rbac
/
policy
C#
// GET /v1/b2b/rbac/policy
const stytch = require('stytch');
const client = new stytch.B2BClient({
project_id: '${projectId}',
secret: '${secret}',
});
const params = {
};
client.RBAC.Policy(params)
.then(resp => { console.log(resp) })
.catch(err => { console.log(err) });// GET /v1/b2b/rbac/policy
package main
import (
"context"
"log"
"github.com/stytchauth/stytch-go/v18/stytch/b2b/b2bstytchapi"
"github.com/stytchauth/stytch-go/v18/stytch/b2b/rbac"
)
func main() {
client, err := b2bstytchapi.NewClient(
"${projectId}",
"${secret}",
)
if err != nil {
log.Fatalf("error instantiating client: %v", err)
}
params := &rbac.PolicyParams{}
resp, err := client.RBAC.Policy(context.Background(), params)
if err != nil {
log.Fatalf("error in method call: %v", err)
}
log.Println(resp)
}
// GET /v1/b2b/rbac/policy
package com.example;
import com.stytch.java.b2b.models.rbac.PolicyRequest;
import com.stytch.java.b2b.StytchB2BClient;
import com.stytch.java.common.StytchResult;
public class Main {
public static void main(String[] args) {
StytchB2BClient.configure("${projectId}", "${secret}");
PolicyRequest params = new PolicyRequest();
Object result = StytchB2BClient.getRBAC().policy(params);
if (result instanceof StytchResult.Success) {
System.out.println(((StytchResult.Success) result).getValue());
} else {
System.out.println(((StytchResult.Error) result).getException());
}
}
}// GET /v1/b2b/rbac/policy
package com.example
import com.stytch.java.b2b.StytchB2BClient
import com.stytch.java.b2b.models.rbac.PolicyRequest
fun main() {
StytchB2BClient.configure(
projectId = "${projectId}",
secret = "${secret}",
)
when (
val result =
StytchB2BClient.rbac.policy(
PolicyRequest(),
)
) {
is StytchResult.Success -> println(result.value)
is StytchResult.Error -> println(result.exception)
}
}
// GET /v1/b2b/rbac/policy
const stytch = require('stytch');
const client = new stytch.B2BClient({
project_id: '${projectId}',
secret: '${secret}',
});
const params = {
};
client.rbac.policy(params)
.then(resp => { console.log(resp) })
.catch(err => { console.log(err) });$response = $client->rbac->policy([
]);# GET /v1/b2b/rbac/policy
from stytch import B2BClient
client = B2BClient(
project_id="${projectId}",
secret="${secret}",
)
resp = client.rbac.policy()
print(resp)
# frozen_string_literal: true
# GET /v1/b2b/rbac/policy
require 'stytch'
client = StytchB2B::Client.new(
project_id: "${projectId}",
secret: "${secret}"
)
resp = client.rbac.policy(
)
puts resp// GET /v1/b2b/rbac/policy
use stytch::b2b::client::Client;
use stytch::b2b::rbac::PolicyRequest;
fn main() {
let client = Client::new("${projectId}", "${secret}").unwrap();
let resp = client.rbac.policy(
PolicyRequest{
..Default::default()
}
).await;
println!("The response is {:?}", resp);
}# GET /v1/b2b/rbac/policy
curl --request GET \
--url https://test.stytch.com/v1/b2b/rbac/policy \
-u '${projectId}:${secret}' \
-H 'Content-Type: application/json'{
"request_id": "<string>",
"status_code": 123,
"policy": {
"roles": [
{
"role_id": "<string>",
"description": "<string>",
"permissions": [
{
"resource_id": "<string>",
"actions": [
"<string>"
]
}
]
}
],
"resources": [
{
"resource_id": "<string>",
"description": "<string>",
"actions": [
"<string>"
]
}
],
"scopes": [
{
"scope": "<string>",
"description": "<string>",
"permissions": [
{
"resource_id": "<string>",
"actions": [
"<string>"
]
}
]
}
]
}
}{
"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"
}{
"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"
}{
"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"
}An RBAC Policy is the canonical document that stores all defined Resources, Roles, and Scopes. This represents 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, Roles, and Scopes can be created and managed in the Stytch Dashboard.
Learn more about checking and enforcing permissions in the RBAC guide.
Authorizations
Response
Successful response
The RBAC Policy document that contains all defined Roles and Resources – which are managed in the Dashboard. Read more about these entities and how they work in our RBAC overview.
Show child attributes
Show child attributes