err:unkey:data:portal_not_foundExample
What Happened?
This error occurs when you callPOST /v2/portal.createSession with a portal value that does not match a portal in your workspace.
The portal field accepts either the portal’s id (pc_...) or its slug, so this error means neither matched.
Common causes include:
- Typo in the
portalvalue sent from your backend. - The portal belongs to a different workspace than the root key you authenticated with.
- The portal has not yet been provisioned for your workspace. The Customer Portal is in early access, and during that period portals are created by the Unkey team on request.
How To Fix
- Verify the identifier: Double-check that
portalmatches your portal’s id or slug. Slugs are 3–64 characters, lowercase alphanumeric and hyphens, with no leading or trailing hyphen. - Check the workspace: Make sure the root key you are using belongs to the same workspace as the portal.
- Request a portal: If you have not yet been onboarded to the Customer Portal, contact the Unkey team to provision one for your workspace.
Common Mistakes
- Wrong root key: Using a root key from a different workspace returns this error rather than a 401, because the lookup is workspace-scoped.
- Malformed looks the same as missing: The lookup does not distinguish a mistyped identifier from one that was never provisioned, so
My-Portal,my--portal, and-portalall return this error rather than a validation error. Check the spelling ofportalbefore assuming the portal does not exist. Only values the request schema rejects outright return a 400: shorter than 3 characters, longer than 255, or containing anything other than letters, digits, hyphens, and underscores. - Underscores are only ever ids: Portal slugs never contain an underscore, so a value like
my_portalcan only match a portal id. It returns this error unless a portal carries exactly that id.
Related Errors
- err:unkey:authentication:portal_token_missing - When a portal session token is required but not provided
- err:unkey:authentication:portal_session_not_found - When a portal session is invalid, expired, or already used
- err:unkey:data:workspace_not_found - When the workspace itself cannot be resolved