Partner organisations only. A Payroll organisation calling this
endpoint receives 405 Method Not Allowed. An employer-scoped access
token receives 403 Forbidden.
Registers a person as a workplace admin of a managed organisation. Penfold creates their Workplace Platform account and emails them an invitation to set a password.
Body
Required
-
The admin’s email address. Penfold sends the invitation to set a password here.
-
Your platform’s unique identifier for this admin. Penfold stores it to link the admin back to your platform, for example when the admin signs in to Penfold through your platform. Required for Partner organisations that use single sign-on with Penfold; omit it otherwise. Must not be blank. Maximum 255 characters.
Maximum length is
255.
Responses
-
Workplace admin registered and invitation sent
-
Bad request, the request is malformed or contains invalid data.
-
Unauthorized
-
Forbidden, the access token is scoped to an employer.
-
Organisation not found, or not managed by your Partner organisation.
-
Method not allowed
-
The admin cannot be registered. Nothing is created and no invitation is sent. Use
code, noterror, to tell the cases apart.erroris a human-readable message and its wording may change. -
Internal server error. Nothing is created and no invitation is sent, so you can retry.
curl \
--request POST 'https://payroll-api.getpenfold.dev/v4/organisations/{organisation_id}/workplace_admins' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"email": "jane.smith@example.com",
"first_name": "Jane",
"last_name": "Smith",
"external_id": "usr_01HXYZ"
}'
{
"email": "jane.smith@example.com",
"first_name": "Jane",
"last_name": "Smith",
"external_id": "usr_01HXYZ"
}
{
"id": "cm1wxyz2e0000abc123456789",
"email": "jane.smith@example.com",
"first_name": "Jane",
"last_name": "Smith",
"external_id": "usr_01HXYZ"
}
{
"error": "Bad request: invalid data provided.",
"validation_errors": [
{
"field": "email",
"message": "Email address is invalid."
}
]
}
{
"error": "Bad request: invalid data provided."
}
{
"error": "Bad request: invalid data provided."
}
{
"error": "Bad request: invalid data provided."
}
{
"error": "Bad request: invalid data provided."
}
{
"code": "OrganisationHasNoEmployer",
"error": "organisation has no employer"
}
{
"code": "ExternalIdAlreadyMapped",
"error": "external_id already mapped"
}
{
"code": "EmailAlreadyInUse",
"error": "email already in use"
}
{
"error": "Bad request: invalid data provided."
}