Create an embedded session
Creates a 60-minute browser session for one authenticated Employer user. Calling this operation confirms that the Partner currently allows the user to access payroll for the Employer.
Provide:
- A stable
partnerUserIdfor the signed-in user. - The user's current
displayName. - The exact browser
originwhere you will mount PayrollKit. It must be registered during Partner setup and use HTTPS in production; a loopback HTTP origin may be registered for local development.
The session gives the user access to every supported payroll view for this Employer. It does not contain view-level permissions or choose the first view. Choose an optional initialView when mounting the component. See the Embedded component reference for mounting, navigation and replacement behaviour.
Each browser tab and full page load must receive its own session. One token supports one mounted component at a time, so each component mounted simultaneously needs a separate session. React rerenders do not require another session.
Use the response as follows:
- Pass
sessionTokendirectly to the page that mounts PayrollKit and keep it only in memory. Never put it in a URL, browser storage, analytics or logs. - Retain
idon your server until the session expires or its revocation is confirmed. - Use
expiresAtto replace the session before it expires when the component must remain mounted.
To keep a mounted component active, create a replacement for the same Employer, user and origin with a new Idempotency-Key, then pass its token to replaceSession(). PayrollKit switches sessions without remounting and revokes the previous token. Create a separate session when switching Employer.
An idempotent retry returns the original session response even if its token has since expired or been revoked. Use a new key to create another session.
- embedded:write
Path Parameters
- Type: stringemployer
Id min length:1max length:200requiredPayrollKit Employer ID.
Headers
- Type: stringIdempotency
- Key min length:16max length:200requiredIdentifies one write for safe retries. Reuse it only for the same method, URL, content type and body and, when present, the same
If-Matchvalue and acting-user headers. PayrollKit retains the result for 30 days, then treats a request using the same key as new. - Type: stringFormat: uuidX
- Request - Id Client-generated UUID for tracing. This does not make retries safe.
Body
- Type: stringdisplay
Name min length:1max length:200requiredCurrent user name recorded with actions performed through this session. A later session may supply a new name for the same
partnerUserId; earlier action records keep the name recorded at the time. - Type: stringoriginmax length:2048Format: urirequired
Exact browser origin where the Partner will mount the component, containing only scheme, host and optional port. It must match an origin registered for the Partner. Production origins use HTTPS; a loopback HTTP origin may be registered for local development.
- Type: stringpartner
User Id min length:1max length:200requiredStable, case-sensitive ID for the signed-in user in the Partner product. Use the same value for that user across every Employer they can access. It must identify only one user within the Partner account and cannot be changed.
Responses
- application/json
- application/problem+json
- application/problem+json
- application/problem+json
- application/problem+json
- application/problem+json
- application/problem+json
- application/problem+json
- application/problem+json
{
"id": "embedded_session_6a42f1d8",
"sessionToken": "embed_session_demo_4f82b6d1c7e93a65",
"expiresAt": "2026-08-27T17:00:00Z"
}