A portal link is a temporary endpoint to initiate an Admin Portal session. It expires five minutes after issuance.
https://setup.workos.com?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Generate a Portal Link scoped to an Organization.
curl --request POST \ --url "https://api.workos.com/portal/generate_link" \ --header "Authorization: Bearer sk_example_123456789" \ --header "Content-Type: application/json" \ -d @- <<'BODY' { "organization": "org_01EHZNVPK3SFK441A1RGBFSHRT", "intent": "sso" } BODY
{ "link": "https://setup.workos.com?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." }
| curl --request POST \ | |
| --url "https://api.workos.com/portal/generate_link" \ | |
| --header "Authorization: Bearer sk_example_123456789" \ | |
| --header "Content-Type: application/json" \ | |
| -d @- <<'BODY' | |
| { | |
| "organization": "org_01EHZNVPK3SFK441A1RGBFSHRT", | |
| "intent": "sso" | |
| } | |
| BODY |
| import { WorkOS } from '@workos-inc/node'; | |
| const workos = new WorkOS('sk_example_123456789'); | |
| const { link } = await workos.portal.generateLink({ | |
| organization: 'org_01EHZNVPK3SFK441A1RGBFSHRT', | |
| intent: 'sso', | |
| }); |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.key = "sk_example_123456789" | |
| end | |
| link = WorkOS::Portal.generate_link( | |
| organization: "org_01EHZNVPK3SFK441A1RGBFSHRT", | |
| intent: "sso" | |
| ) |
| from workos import WorkOSClient | |
| workos_client = WorkOSClient( | |
| api_key="sk_example_123456789", client_id="client_123456789" | |
| ) | |
| link = workos_client.portal.generate_link( | |
| organization_id="org_01EHZNVPK3SFK441A1RGBFSHRT", intent="sso" | |
| ) |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v3/pkg/portal" | |
| ) | |
| func main() { | |
| portal.SetAPIKey("sk_example_123456789") | |
| link, err := portal.GenerateLink( | |
| context.Background(), | |
| portal.GenerateLinkOpts{ | |
| Organization: "org_01EHZNVPK3SFK441A1RGBFSHRT", | |
| Intent: portal.SSO, | |
| }, | |
| ) | |
| } |
| <?php | |
| WorkOS\WorkOS::setApiKey("sk_example_123456789"); | |
| $portal = new WorkOS\Portal(); | |
| $link = $portal->generateLink( | |
| organization: "org_01EHZNVPK3SFK441A1RGBFSHRT", | |
| intent: "sso" | |
| ); |
| import com.workos.WorkOS; | |
| import com.workos.portal.PortalApi.GeneratePortalLinkOptions; | |
| import com.workos.portal.models.Intent; | |
| import com.workos.portal.models.Link; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| String organizationId = "org_01EHZNVPK3SFK441A1RGBFSHRT"; | |
| GeneratePortalLinkOptions options = GeneratePortalLinkOptions.builder() | |
| .organization(organizationId) | |
| .intent(Intent.Sso) | |
| .build(); | |
| Link response = workos.portal.generateLink(options); | |
| String link = response.link; |
| WorkOS.SetApiKey("sk_example_123456789"); | |
| var portalService = new PortalService(); | |
| var options = new GenerateLinkOptions { | |
| Intent = Intent.SSO, | |
| Organization = "org_01EHZNVPK3SFK441A1RGBFSHRT", | |
| }; | |
| var link = await portalService.GenerateLink(options); |
| { | |
| "link": "https://setup.workos.com?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." | |
| } |
POST/portal /generate_linkReturns