Partner organisations only. A Payroll organisation calling this
endpoint receives 405 Method Not Allowed.
Registers a person who can manage this organisation, and every employer in it, on the Penfold Workplace Platform. Penfold emails them an invitation to set a password. The organisation must hold at least one employer first.
If your organisation uses single sign-on with Penfold, the person is matched at
sign-in on external_id. Registering an external_id that belonged to an admin
you removed moves it to the new admin.
Safe to retry after a 500: nothing is left behind, and a retry sends the
invitation again rather than failing.
Body
Required
-
Where Penfold sends the invitation to set a password. Must not already belong to a Penfold Workplace Platform user.
-
Minimum length is
1. -
Minimum length is
1. -
Your identifier for this person: the subject id (
sub) your identity provider puts in its sign-in token. Penfold matches the admin on this at sign-in, never on email. Treated as an opaque string.Required if your organisation uses single sign-on with Penfold, and must be omitted otherwise (
400).Minimum length is
1.
Responses
-
Workplace admin registered and invitation sent
-
Request body failed validation, or
external_idwas sent or missing contrary to your organisation's single sign-on setting. -
Missing or invalid authentication token
-
Organisation not found, or not one you manage.
-
Method not allowed. Partner organisations only.
-
The organisation has no employer yet (
OrganisationHasNoEmployer), theexternal_idalready belongs to an active admin (ExternalIdAlreadyMapped), or the email already belongs to a Penfold Workplace Platform user (EmailAlreadyInUse). Checkcode. Nothing was created and no invitation was sent. -
Internal server error
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": "sam@harbourgroup.example",
"first_name": "Sam",
"last_name": "Taylor",
"external_id": "usr_01HXYZ"
}'
{
"email": "sam@harbourgroup.example",
"first_name": "Sam",
"last_name": "Taylor",
"external_id": "usr_01HXYZ"
}
{
"id": "cmo1adm000001abcd",
"email": "sam@harbourgroup.example",
"first_name": "Sam",
"last_name": "Taylor",
"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."
}
{
"code": "OrganisationHasNoEmployer",
"error": "organisation has no employer"
}
{
"code": "ExternalIdAlreadyMapped",
"error": "external_id already mapped to a workplace admin",
"external_id": "usr_01HXYZ"
}
{
"error": "Bad request: invalid data provided."
}