Validate an agent credential – an API key or access token – against the environment of the API key used to authenticate the request. This is a read-only check: it never consumes or mutates the credential.
cURL
| curl --request POST \ | |
| --url "https://api.workos.com/agents/credentials/validate" \ | |
| --header "Authorization: Bearer sk_example_123456789" \ | |
| --header "Content-Type: application/json" \ | |
| -d @- <<'BODY' | |
| { | |
| "type": "access_token", | |
| "credential": "sk_agent_example_1234567890" | |
| } | |
| BODY |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.agents.create_validate( | |
| type: "access_token", | |
| credential: "sk_agent_example_1234567890" | |
| ) |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.agents.create_validate( | |
| type="access_token", credential="sk_agent_example_1234567890" | |
| ) |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v9" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| _, err := client.Agents().CreateValidate(context.Background(), &workos.AgentsCreateValidateParams{ | |
| Type: "access_token", | |
| Credential: "sk_agent_example_1234567890", | |
| }) | |
| if err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos | |
| ->agents() | |
| ->createValidate( | |
| type: "access_token", | |
| credential: "sk_agent_example_1234567890", | |
| ); |
| import com.workos.WorkOS; | |
| import com.workos.agents.AgentsApi.CreateValidateOptions; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| CreateValidateOptions options = CreateValidateOptions.builder() | |
| .type("access_token") | |
| .credential("sk_agent_example_1234567890") | |
| .build(); | |
| workos.agents.createValidate(options); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.Agents.CreateValidateAsync(new AgentsCreateValidateOptions { | |
| Type = "access_token", | |
| Credential = "sk_agent_example_1234567890", | |
| }); |
| use workos::Client; | |
| use workos::agents::CreateValidateParams; | |
| #[tokio::main] | |
| async fn main() -> Result<(), workos::Error> { | |
| let client = Client::builder() | |
| .api_key("sk_example_123456789") | |
| .client_id("client_123456789") | |
| .build(); | |
| let _result = client | |
| .agents() | |
| .create_validate( | |
| CreateValidateParams { | |
| type_: "access_token".into(), | |
| credential: "sk_agent_example_1234567890".into(), | |
| ..Default::default() | |
| } | |
| ) | |
| .await?; | |
| Ok(()) | |
| } |
| { | |
| "valid": true, | |
| "registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY", | |
| "expires_at": "2026-01-15T12:00:00.000Z" | |
| } |
Feature flagged
POST/agents /credentials /validate
Returns
Retrieve the details of an agent registration by ID. The registration is scoped to the environment of the API key used to authenticate the request.
cURL
| curl "https://api.workos.com/agents/registrations/agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY" \ | |
| --header "Authorization: Bearer sk_example_123456789" |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.agents.get_registration(id: "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY") |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.agents.get_registration(id_="agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY") |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v9" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| _, err := client.Agents().GetRegistration(context.Background(), "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY") | |
| if err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos->agents()->getRegistration(id: "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"); |
| import com.workos.WorkOS; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| workos.agents.getRegistration("agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.Agents.GetRegistrationAsync("agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"); |
| use workos::Client; | |
| #[tokio::main] | |
| async fn main() -> Result<(), workos::Error> { | |
| let client = Client::builder() | |
| .api_key("sk_example_123456789") | |
| .client_id("client_123456789") | |
| .build(); | |
| let _result = client | |
| .agents() | |
| .get_registration("agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY") | |
| .await?; | |
| Ok(()) | |
| } |
| { | |
| "id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY", | |
| "agent_identity": { | |
| "id": "agent_identity_01EHWNCE74X7JSDV0X3SZ3KJNY", | |
| "userland_user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", | |
| "created_at": "2026-01-15T12:00:00.000Z", | |
| "updated_at": "2026-01-15T12:00:00.000Z" | |
| }, | |
| "organization_id": "org_01EHQMYV6MBK39QC5PZXHY59C3", | |
| "status": "verified", | |
| "kind": "service_auth", | |
| "claim": { | |
| "id": "agent_reg_claim_01EHWNCE74X7JSDV0X3SZ3KJNY", | |
| "claim_completion": { | |
| "id": "agent_reg_claim_completion_01EHWNCE74X7JSDV0X3SZ3KJNY", | |
| "created_at": "2026-01-15T12:00:00.000Z", | |
| "updated_at": "2026-01-15T12:00:00.000Z", | |
| "expires_at": "2026-01-15T12:00:00.000Z", | |
| "claimed_at": "2026-01-15T12:00:00.000Z" | |
| }, | |
| "created_at": "2026-01-15T12:00:00.000Z", | |
| "updated_at": "2026-01-15T12:00:00.000Z", | |
| "expires_at": "2026-01-15T12:00:00.000Z" | |
| }, | |
| "created_at": "2026-01-15T12:00:00.000Z", | |
| "updated_at": "2026-01-15T12:00:00.000Z" | |
| } |
Feature flagged
GET/agents /registrations /:id
Parameters
Returns
Magic Link Continue to the next section
Up next