> For the complete documentation index, see [llms.txt](https://docs.getpenfold.dev/dev/llms.txt)

# Register a workplace admin

> POST /organisations/{organisation_id}/workplace_admins
> 
> **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.



## Servers
- https://payroll-api.getpenfold.dev/v4: https://payroll-api.getpenfold.dev/v4


## Authentication methods
- O auth2 client credentials


## Parameters

### Path parameters

- **organisation_id** (string)
  Penfold organisation id.



### Body: application/json (object)

- **email** (string(email))
  Where Penfold sends the invitation to set a password. Must not already belong to a Penfold Workplace Platform user.

- **first_name** (string)

- **last_name** (string)

- **external_id** (string)
  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`).



## Responses
### 201
Workplace admin registered and invitation sent

#### Body: application/json (object)
- **id** (string)
  Penfold workplace admin id.

- **email** (string(email))
  The admin's Penfold email address.

- **first_name** (string)

- **last_name** (string)

- **external_id** (string | null)
  Your identifier for this person: the subject id your identity provider puts
  in its sign-in token. `null` if your organisation does not use single sign-on
  with Penfold.


### 400
Request body failed validation, or `external_id` was sent or missing contrary to your organisation's single sign-on setting.

#### Body: application/json (object)
- **error** (string)
  A descriptive error message.

- **validation_errors** (array[object])


### 401
Missing or invalid authentication token

#### Body: application/json (object)
- **error** (string)
  A descriptive error message.


### 404
Organisation not found, or not one you manage.

#### Body: application/json (object)
- **error** (string)
  A descriptive error message.


### 405
Method not allowed. Partner organisations only.

#### Body: application/json (object)
- **error** (string)
  A descriptive error message.


### 409
The organisation has no employer yet (`OrganisationHasNoEmployer`), the
`external_id` already belongs to an active admin (`ExternalIdAlreadyMapped`), or
the email already belongs to a Penfold Workplace Platform user
(`EmailAlreadyInUse`). Check `code`. Nothing was created and no invitation was sent.


#### Body: application/json (object)
- **code** (string)
  Use this field, rather than `error`, to distinguish between 409 responses.
  `OrganisationHasNoEmployer`: create an employer in the organisation first,
  then retry. `EmailAlreadyInUse`: the email already belongs to a Penfold
  Workplace Platform user. Nothing was created and no invitation was sent.

- **error** (string)


### 500
Internal server error

#### Body: application/json (object)
- **error** (string)
  A descriptive error message.



[Powered by Bump.sh](https://bump.sh)
