A Protected Resource is an MCP server or API in an environment that agents and clients are granted access to. Its slug is derived from its name when it is created, is unique within the environment, and does not change when the resource is renamed.
A Protected Resource cannot be deleted while resource indicators or templates are bound to it.
protected_resource
Lists the Protected Resources in the environment.
| curl "https://api.workos.com/protected_resources" \ | |
| --header "Authorization: Bearer sk_example_123456789" |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.protected_resources.list_protected_resources |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.protected_resources.list_protected_resources() |
| package main | |
| import ( | |
| "context" | |
| "fmt" | |
| "github.com/workos/workos-go/v10" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| iter := client.ProtectedResources().List(context.Background(), &workos.ProtectedResourcesListParams{}) | |
| for iter.Next() { | |
| fmt.Println(iter.Current()) | |
| } | |
| if err := iter.Err(); err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos->protectedResources()->listProtectedResources(); |
| import com.workos.WorkOS; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| workos.getProtectedResources().list(); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.ProtectedResources.ListAsync(); |
| use workos::Client; | |
| use workos::protected_resources::ListProtectedResourcesParams; | |
| #[tokio::main] | |
| async fn main() -> Result<(), workos::Error> { | |
| let client = Client::new("sk_example_123456789"); | |
| let _result = client | |
| .protected_resources() | |
| .list_protected_resources(ListProtectedResourcesParams::default()) | |
| .await?; | |
| Ok(()) | |
| } |
| { | |
| "object": "list", | |
| "data": [ | |
| { | |
| "object": "protected_resource", | |
| "id": "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| "kind": "mcp", | |
| "name": "Acme MCP Server", | |
| "slug": "acme-mcp-server", | |
| "created_at": "2026-01-15T12:00:00.000Z", | |
| "updated_at": "2026-01-15T12:00:00.000Z" | |
| } | |
| ], | |
| "list_metadata": { | |
| "before": "protected_resource_01HXYZ123456789ABCDEFGHIJ", | |
| "after": "protected_resource_01HXYZ987654321KJIHGFEDCBA" | |
| } | |
| } |
GET/protected_resources
Parameters
Returns object
Creates a Protected Resource in the environment. Its slug is derived from the name. Permissions listed in permissions are linked to it; if any cannot be, the Protected Resource is not created.
| curl --request POST \ | |
| --url "https://api.workos.com/protected_resources" \ | |
| --header "Authorization: Bearer sk_example_123456789" \ | |
| --header "Content-Type: application/json" \ | |
| -d @- <<'BODY' | |
| { | |
| "name": "Acme MCP Server", | |
| "kind": "mcp" | |
| } | |
| BODY |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.protected_resources.create_protected_resource( | |
| name: "Acme MCP Server", | |
| kind: "mcp" | |
| ) |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.protected_resources.create_protected_resource(name="Acme MCP Server", kind="mcp") |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v10" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| _, err := client.ProtectedResources().Create(context.Background(), &workos.ProtectedResourcesCreateParams{ | |
| Name: "Acme MCP Server", | |
| Kind: workos.ProtectedResourcesCreateRequestKind("mcp"), | |
| }) | |
| if err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos | |
| ->protectedResources() | |
| ->createProtectedResource(name: "Acme MCP Server", kind: "mcp"); |
| import com.workos.WorkOS; | |
| import com.workos.types.ProtectedResourceKind; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| workos.getProtectedResources().create("Acme MCP Server", ProtectedResourceKind.Mcp); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.ProtectedResources.CreateAsync(new ProtectedResourcesCreateOptions { | |
| Name = "Acme MCP Server", | |
| Kind = ProtectedResourceKind.Mcp, | |
| }); |
| use workos::Client; | |
| use workos::{ProtectedResourcesCreateRequest, ProtectedResourcesCreateRequestKind}; | |
| use workos::protected_resources::CreateProtectedResourceParams; | |
| #[tokio::main] | |
| async fn main() -> Result<(), workos::Error> { | |
| let client = Client::new("sk_example_123456789"); | |
| let _result = client | |
| .protected_resources() | |
| .create_protected_resource(CreateProtectedResourceParams::new(ProtectedResourcesCreateRequest { | |
| name: "Acme MCP Server".to_string(), | |
| kind: ProtectedResourcesCreateRequestKind::Mcp, | |
| permissions: None, | |
| })) | |
| .await?; | |
| Ok(()) | |
| } |
| { | |
| "object": "protected_resource", | |
| "id": "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| "kind": "mcp", | |
| "name": "Acme MCP Server", | |
| "slug": "acme-mcp-server", | |
| "created_at": "2026-01-15T12:00:00.000Z", | |
| "updated_at": "2026-01-15T12:00:00.000Z" | |
| } |
POST/protected_resources
Returns
Gets a Protected Resource by its ID.
| curl "https://api.workos.com/protected_resources/protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A" \ | |
| --header "Authorization: Bearer sk_example_123456789" |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.protected_resources.get_protected_resource(id: "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A") |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.protected_resources.get_protected_resource( | |
| id="protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A" | |
| ) |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v10" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| _, err := client.ProtectedResources().Get(context.Background(), "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A") | |
| if err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos | |
| ->protectedResources() | |
| ->getProtectedResource(id: "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A"); |
| import com.workos.WorkOS; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| workos.getProtectedResources().get("protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A"); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.ProtectedResources.GetAsync("protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A"); |
| use workos::Client; | |
| #[tokio::main] | |
| async fn main() -> Result<(), workos::Error> { | |
| let client = Client::new("sk_example_123456789"); | |
| let _result = client | |
| .protected_resources() | |
| .get_protected_resource("protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A") | |
| .await?; | |
| Ok(()) | |
| } |
| { | |
| "object": "protected_resource", | |
| "id": "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| "kind": "mcp", | |
| "name": "Acme MCP Server", | |
| "slug": "acme-mcp-server", | |
| "created_at": "2026-01-15T12:00:00.000Z", | |
| "updated_at": "2026-01-15T12:00:00.000Z" | |
| } |
GET/protected_resources /:id
Parameters
Returns
Renames a Protected Resource. The slug and kind do not change.
| curl --request PATCH \ | |
| --url "https://api.workos.com/protected_resources/protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A" \ | |
| --header "Authorization: Bearer sk_example_123456789" \ | |
| --header "Content-Type: application/json" \ | |
| -d @- <<'BODY' | |
| { | |
| "name": "Acme MCP Server" | |
| } | |
| BODY |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.protected_resources.update_protected_resource( | |
| id: "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| name: "Acme MCP Server" | |
| ) |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.protected_resources.update_protected_resource( | |
| id="protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", name="Acme MCP Server" | |
| ) |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v10" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| _, err := client.ProtectedResources().Update(context.Background(), "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", &workos.ProtectedResourcesUpdateParams{ | |
| Name: "Acme MCP Server", | |
| }) | |
| if err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos | |
| ->protectedResources() | |
| ->updateProtectedResource( | |
| id: "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| name: "Acme MCP Server", | |
| ); |
| import com.workos.WorkOS; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| workos.getProtectedResources().update( | |
| "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", "Acme MCP Server"); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.ProtectedResources.UpdateAsync("protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| new ProtectedResourcesUpdateOptions { | |
| Name = "Acme MCP Server", | |
| }); |
| use workos::Client; | |
| use workos::ProtectedResourcesUpdateRequest; | |
| use workos::protected_resources::UpdateProtectedResourceParams; | |
| #[tokio::main] | |
| async fn main() -> Result<(), workos::Error> { | |
| let client = Client::new("sk_example_123456789"); | |
| let _result = client | |
| .protected_resources() | |
| .update_protected_resource( | |
| "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| UpdateProtectedResourceParams::new(ProtectedResourcesUpdateRequest { | |
| name: "Acme MCP Server".to_string(), | |
| }), | |
| ) | |
| .await?; | |
| Ok(()) | |
| } |
| { | |
| "object": "protected_resource", | |
| "id": "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| "kind": "mcp", | |
| "name": "Acme MCP Server", | |
| "slug": "acme-mcp-server", | |
| "created_at": "2026-01-15T12:00:00.000Z", | |
| "updated_at": "2026-01-15T12:00:00.000Z" | |
| } |
PATCH/protected_resources /:id
Parameters
Returns
Deletes a Protected Resource. A Protected Resource that resource indicators or templates are still bound to cannot be deleted.
| curl --request DELETE \ | |
| --url "https://api.workos.com/protected_resources/protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A" \ | |
| --header "Authorization: Bearer sk_example_123456789" |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.protected_resources.delete_protected_resource(id: "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A") |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.protected_resources.delete_protected_resource( | |
| id="protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A" | |
| ) |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v10" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| err := client.ProtectedResources().Delete(context.Background(), "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A") | |
| if err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos | |
| ->protectedResources() | |
| ->deleteProtectedResource( | |
| id: "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| ); |
| import com.workos.WorkOS; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| workos.getProtectedResources().delete("protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A"); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.ProtectedResources.DeleteAsync("protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A"); |
| use workos::Client; | |
| #[tokio::main] | |
| async fn main() -> Result<(), workos::Error> { | |
| let client = Client::new("sk_example_123456789"); | |
| client | |
| .protected_resources() | |
| .delete_protected_resource("protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A") | |
| .await?; | |
| Ok(()) | |
| } |
DELETE/protected_resources /:id
Parameters
Returns
Lists the MCP resource indicators and templates attached to a Protected Resource. A template is listed as its wildcard registration, as /user_management/authkit_oauth_resources lists it.
| curl "https://api.workos.com/protected_resources/protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A/indicators" \ | |
| --header "Authorization: Bearer sk_example_123456789" |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.protected_resources.list_protected_resource_indicators(id: "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A") |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.protected_resources.list_protected_resource_indicators( | |
| id="protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A" | |
| ) |
| package main | |
| import ( | |
| "context" | |
| "fmt" | |
| "github.com/workos/workos-go/v10" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| iter := client.ProtectedResources().ListIndicators(context.Background(), "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", &workos.ProtectedResourcesListIndicatorsParams{}) | |
| for iter.Next() { | |
| fmt.Println(iter.Current()) | |
| } | |
| if err := iter.Err(); err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos | |
| ->protectedResources() | |
| ->listProtectedResourceIndicators( | |
| id: "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| ); |
| import com.workos.WorkOS; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| workos.getProtectedResources().listIndicators( | |
| "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A"); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.ProtectedResources.ListIndicatorsAsync("protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A"); |
| use workos::Client; | |
| use workos::protected_resources::ListProtectedResourceIndicatorsParams; | |
| #[tokio::main] | |
| async fn main() -> Result<(), workos::Error> { | |
| let client = Client::new("sk_example_123456789"); | |
| let _result = client | |
| .protected_resources() | |
| .list_protected_resource_indicators( | |
| "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| ListProtectedResourceIndicatorsParams::default(), | |
| ) | |
| .await?; | |
| Ok(()) | |
| } |
| { | |
| "object": "list", | |
| "data": [ | |
| { | |
| "object": "authkit_oauth_resource", | |
| "id": "authkit_oauth_resource_01EHZNVPK3SFK441A1RGBFSHRT", | |
| "uri": "https://api.example.com", | |
| "default": false, | |
| "created_at": "2026-01-15T12:00:00.000Z", | |
| "updated_at": "2026-01-15T12:00:00.000Z" | |
| } | |
| ], | |
| "list_metadata": { | |
| "before": "authkit_oauth_resource_01HXYZ123456789ABCDEFGHIJ", | |
| "after": "authkit_oauth_resource_01HXYZ987654321KJIHGFEDCBA" | |
| } | |
| } |
GET/protected_resources /:id /indicators
Parameters
Returns object
Attaches an MCP resource indicator or template to a Protected Resource. A template takes the indicators created from it along. Attaching one that is already attached to this Protected Resource changes nothing.
| curl --request PUT \ | |
| --url "https://api.workos.com/protected_resources/protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A/indicators/authkit_oauth_resource_01EHZNVPK3SFK441A1RGBFSHRT" \ | |
| --header "Authorization: Bearer sk_example_123456789" |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.protected_resources.update_protected_resource_indicator( | |
| id: "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| indicator_id: "authkit_oauth_resource_01EHZNVPK3SFK441A1RGBFSHRT" | |
| ) |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.protected_resources.update_protected_resource_indicator( | |
| id="protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| indicator_id="authkit_oauth_resource_01EHZNVPK3SFK441A1RGBFSHRT", | |
| ) |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v10" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| err := client.ProtectedResources().UpdateIndicator(context.Background(), "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", "authkit_oauth_resource_01EHZNVPK3SFK441A1RGBFSHRT") | |
| if err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos | |
| ->protectedResources() | |
| ->updateProtectedResourceIndicator( | |
| id: "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| indicatorId: "authkit_oauth_resource_01EHZNVPK3SFK441A1RGBFSHRT", | |
| ); |
| import com.workos.WorkOS; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| workos.getProtectedResources().updateIndicator( | |
| "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| "authkit_oauth_resource_01EHZNVPK3SFK441A1RGBFSHRT"); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.ProtectedResources.UpdateIndicatorAsync("protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| "authkit_oauth_resource_01EHZNVPK3SFK441A1RGBFSHRT"); |
| use workos::Client; | |
| #[tokio::main] | |
| async fn main() -> Result<(), workos::Error> { | |
| let client = Client::new("sk_example_123456789"); | |
| client | |
| .protected_resources() | |
| .update_protected_resource_indicator( | |
| "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| "authkit_oauth_resource_01EHZNVPK3SFK441A1RGBFSHRT", | |
| ) | |
| .await?; | |
| Ok(()) | |
| } |
PUT/protected_resources /:id /indicators /:indicator_id
Parameters
Returns
Detaches an MCP resource indicator or template from a Protected Resource. A template takes the indicators created from it along.
| curl --request DELETE \ | |
| --url "https://api.workos.com/protected_resources/protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A/indicators/authkit_oauth_resource_01EHZNVPK3SFK441A1RGBFSHRT" \ | |
| --header "Authorization: Bearer sk_example_123456789" |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.protected_resources.delete_protected_resource_indicator( | |
| id: "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| indicator_id: "authkit_oauth_resource_01EHZNVPK3SFK441A1RGBFSHRT" | |
| ) |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.protected_resources.delete_protected_resource_indicator( | |
| id="protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| indicator_id="authkit_oauth_resource_01EHZNVPK3SFK441A1RGBFSHRT", | |
| ) |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v10" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| err := client.ProtectedResources().DeleteIndicator(context.Background(), "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", "authkit_oauth_resource_01EHZNVPK3SFK441A1RGBFSHRT") | |
| if err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos | |
| ->protectedResources() | |
| ->deleteProtectedResourceIndicator( | |
| id: "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| indicatorId: "authkit_oauth_resource_01EHZNVPK3SFK441A1RGBFSHRT", | |
| ); |
| import com.workos.WorkOS; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| workos.getProtectedResources().deleteIndicator( | |
| "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| "authkit_oauth_resource_01EHZNVPK3SFK441A1RGBFSHRT"); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.ProtectedResources.DeleteIndicatorAsync("protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| "authkit_oauth_resource_01EHZNVPK3SFK441A1RGBFSHRT"); |
| use workos::Client; | |
| #[tokio::main] | |
| async fn main() -> Result<(), workos::Error> { | |
| let client = Client::new("sk_example_123456789"); | |
| client | |
| .protected_resources() | |
| .delete_protected_resource_indicator( | |
| "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| "authkit_oauth_resource_01EHZNVPK3SFK441A1RGBFSHRT", | |
| ) | |
| .await?; | |
| Ok(()) | |
| } |
DELETE/protected_resources /:id /indicators /:indicator_id
Parameters
Returns
Lists the Permissions linked to a Protected Resource, ordered by Permission ID. before and after take a Permission ID.
| curl "https://api.workos.com/protected_resources/protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A/permissions" \ | |
| --header "Authorization: Bearer sk_example_123456789" |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.protected_resources.list_protected_resource_permissions(id: "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A") |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.protected_resources.list_protected_resource_permissions( | |
| id="protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A" | |
| ) |
| package main | |
| import ( | |
| "context" | |
| "fmt" | |
| "github.com/workos/workos-go/v10" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| iter := client.ProtectedResources().ListPermissions(context.Background(), "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", &workos.ProtectedResourcesListPermissionsParams{}) | |
| for iter.Next() { | |
| fmt.Println(iter.Current()) | |
| } | |
| if err := iter.Err(); err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos | |
| ->protectedResources() | |
| ->listProtectedResourcePermissions( | |
| id: "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| ); |
| import com.workos.WorkOS; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| workos.getProtectedResources().listPermissions( | |
| "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A"); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.ProtectedResources.ListPermissionsAsync("protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A"); |
| use workos::Client; | |
| use workos::protected_resources::ListProtectedResourcePermissionsParams; | |
| #[tokio::main] | |
| async fn main() -> Result<(), workos::Error> { | |
| let client = Client::new("sk_example_123456789"); | |
| let _result = client | |
| .protected_resources() | |
| .list_protected_resource_permissions( | |
| "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| ListProtectedResourcePermissionsParams::default(), | |
| ) | |
| .await?; | |
| Ok(()) | |
| } |
| { | |
| "object": "list", | |
| "data": [ | |
| { | |
| "object": "protected_resource_permission", | |
| "permission_id": "permission_01HXYZ123456789ABCDEFGHIJ", | |
| "permission_slug": "documents:read", | |
| "kind": "rbac", | |
| "created_at": "2026-01-15T12:00:00.000Z", | |
| "updated_at": "2026-01-15T12:00:00.000Z" | |
| } | |
| ], | |
| "list_metadata": { | |
| "before": "permission_01HXYZ123456789ABCDEFGHIJ", | |
| "after": "permission_01HXYZ987654321KJIHGFEDCBA" | |
| } | |
| } |
GET/protected_resources /:id /permissions
Parameters
Returns object
Links Permissions to a Protected Resource by slug, or changes the kind of ones already linked. Permissions that are not listed stay linked. Either every Permission is linked or none is.
| curl --request POST \ | |
| --url "https://api.workos.com/protected_resources/protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A/permissions" \ | |
| --header "Authorization: Bearer sk_example_123456789" \ | |
| --header "Content-Type: application/json" \ | |
| -d @- <<'BODY' | |
| { | |
| "permissions": [ | |
| { | |
| "slug": "documents:read", | |
| "kind": "rbac" | |
| } | |
| ] | |
| } | |
| BODY |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.protected_resources.create_protected_resource_permission( | |
| id: "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| permissions: [{ slug: "documents:read", kind: "rbac" }] | |
| ) |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.protected_resources.create_protected_resource_permission( | |
| id="protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| permissions=[{"slug": "documents:read", "kind": "rbac"}], | |
| ) |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v10" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| err := client.ProtectedResources().CreatePermission(context.Background(), "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", &workos.ProtectedResourcesCreatePermissionParams{ | |
| Permissions: []*workos.ProtectedResourcesLinkPermissionsRequestPermission{ | |
| { | |
| Slug: "documents:read", | |
| Kind: workos.ProtectedResourcesLinkPermissionsRequestPermissionKind("rbac"), | |
| }, | |
| }, | |
| }) | |
| if err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos | |
| ->protectedResources() | |
| ->createProtectedResourcePermission( | |
| id: "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| permissions: [["slug" => "documents:read", "kind" => "rbac"]], | |
| ); |
| import com.workos.WorkOS; | |
| import com.workos.models.ProtectedResourcesCreateRequestPermission; | |
| import com.workos.types.ProtectedResourcePermissionKind; | |
| import java.util.List; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| workos.getProtectedResources().createPermission( | |
| "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| List.of(new ProtectedResourcesCreateRequestPermission( | |
| "documents:read", ProtectedResourcePermissionKind.Rbac))); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.ProtectedResources.CreatePermissionAsync("protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| new ProtectedResourcesCreatePermissionOptions { | |
| Permissions = | |
| new List<ProtectedResourcesCreateRequestPermission> { | |
| new ProtectedResourcesCreateRequestPermission { | |
| Slug = "documents:read", | |
| Kind = ProtectedResourcePermissionKind.Rbac, | |
| }, | |
| }, | |
| }); |
| use workos::Client; | |
| use workos::{ProtectedResourcesLinkPermissionsRequest, ProtectedResourcesLinkPermissionsRequestPermission, ProtectedResourcesLinkPermissionsRequestPermissionKind}; | |
| use workos::protected_resources::CreateProtectedResourcePermissionParams; | |
| #[tokio::main] | |
| async fn main() -> Result<(), workos::Error> { | |
| let client = Client::new("sk_example_123456789"); | |
| client | |
| .protected_resources() | |
| .create_protected_resource_permission( | |
| "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| CreateProtectedResourcePermissionParams::new(ProtectedResourcesLinkPermissionsRequest { | |
| permissions: vec![ProtectedResourcesLinkPermissionsRequestPermission { | |
| slug: "documents:read".to_string(), | |
| kind: ProtectedResourcesLinkPermissionsRequestPermissionKind::Rbac, | |
| }], | |
| }), | |
| ) | |
| .await?; | |
| Ok(()) | |
| } |
POST/protected_resources /:id /permissions
Parameters
Returns
Links a Permission to a Protected Resource, or changes its kind if it is already linked. Linking it again with the same kind changes nothing.
| curl --request PUT \ | |
| --url "https://api.workos.com/protected_resources/protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A/permissions/documents:read" \ | |
| --header "Authorization: Bearer sk_example_123456789" \ | |
| --header "Content-Type: application/json" \ | |
| -d @- <<'BODY' | |
| { | |
| "kind": "rbac" | |
| } | |
| BODY |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.protected_resources.update_protected_resource_permission( | |
| id: "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| permission_slug: "documents:read", | |
| kind: "rbac" | |
| ) |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.protected_resources.update_protected_resource_permission( | |
| id="protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| permission_slug="documents:read", | |
| kind="rbac", | |
| ) |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v10" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| err := client.ProtectedResources().UpdatePermission(context.Background(), "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", "documents:read", &workos.ProtectedResourcesUpdatePermissionParams{ | |
| Kind: workos.ProtectedResourcesLinkPermissionRequestKind("rbac"), | |
| }) | |
| if err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos | |
| ->protectedResources() | |
| ->updateProtectedResourcePermission( | |
| id: "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| permissionSlug: "documents:read", | |
| kind: "rbac", | |
| ); |
| import com.workos.WorkOS; | |
| import com.workos.types.ProtectedResourcePermissionKind; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| workos.getProtectedResources().updatePermission( | |
| "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| "documents:read", | |
| ProtectedResourcePermissionKind.Rbac); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.ProtectedResources.UpdatePermissionAsync("protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", "documents:read", | |
| new ProtectedResourcesUpdatePermissionOptions { | |
| Kind = ProtectedResourcePermissionKind.Rbac, | |
| }); |
| use workos::Client; | |
| use workos::{ProtectedResourcesLinkPermissionRequest, ProtectedResourcesLinkPermissionRequestKind}; | |
| use workos::protected_resources::UpdateProtectedResourcePermissionParams; | |
| #[tokio::main] | |
| async fn main() -> Result<(), workos::Error> { | |
| let client = Client::new("sk_example_123456789"); | |
| client | |
| .protected_resources() | |
| .update_protected_resource_permission( | |
| "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| "documents:read", | |
| UpdateProtectedResourcePermissionParams::new(ProtectedResourcesLinkPermissionRequest { | |
| kind: ProtectedResourcesLinkPermissionRequestKind::Rbac, | |
| }), | |
| ) | |
| .await?; | |
| Ok(()) | |
| } |
PUT/protected_resources /:id /permissions /:permission_slug
Parameters
Returns
Unlinks a Permission from a Protected Resource.
| curl --request DELETE \ | |
| --url "https://api.workos.com/protected_resources/protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A/permissions/documents:read" \ | |
| --header "Authorization: Bearer sk_example_123456789" |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.protected_resources.delete_protected_resource_permission( | |
| id: "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| permission_slug: "documents:read" | |
| ) |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.protected_resources.delete_protected_resource_permission( | |
| id="protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", permission_slug="documents:read" | |
| ) |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v10" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| err := client.ProtectedResources().DeletePermission(context.Background(), "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", "documents:read") | |
| if err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos | |
| ->protectedResources() | |
| ->deleteProtectedResourcePermission( | |
| id: "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| permissionSlug: "documents:read", | |
| ); |
| import com.workos.WorkOS; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| workos.getProtectedResources().deletePermission( | |
| "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", "documents:read"); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.ProtectedResources.DeletePermissionAsync("protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| "documents:read"); |
| use workos::Client; | |
| #[tokio::main] | |
| async fn main() -> Result<(), workos::Error> { | |
| let client = Client::new("sk_example_123456789"); | |
| client | |
| .protected_resources() | |
| .delete_protected_resource_permission( | |
| "protected_resource_01JZ8X4N2R7Q9M3K5T6V8W0Y1A", | |
| "documents:read", | |
| ) | |
| .await?; | |
| Ok(()) | |
| } |
DELETE