Replace position by employee identifier (CPF or Email)

Finds a position by the current occupant's CPF or email, then performs a COMPLETE replacement of that position. The identifier parameter automatically detects if the value is an email (contains @) or a CPF.

Parent Position (Leader):

• For ROOT positions: omit all three parent fields (externalCodeParent, parentEmail, parentTaxpayerRegistry)

• For NON-ROOT positions: you MUST provide ONE of:

  • externalCodeParent: External code of the parent position
  • parentEmail: Email of the leader (will find their active position)
  • parentTaxpayerRegistry: CPF of the leader (will find their active position)

This is a PUT operation - all required fields must be provided.

Examples:

• identifier: "[email protected]" (email)

• identifier: "13306708792" (CPF)

• externalCodeParent: "POS-123" (traditional way)

• parentEmail: "[email protected]" (sets the position leader by email)

• parentTaxpayerRegistry: "987.654.321-00" (sets the position leader by CPF)

Business Rules:

• The identifier (CPF or email) must match an existing employee

• The employee must have an active position

• For non-root positions, ONE parent identifier must be provided (externalCodeParent OR parentEmail OR parentTaxpayerRegistry)

• If parentEmail/parentTaxpayerRegistry is provided, the leader must exist and have an active position

• All required fields (name, externalCodeRole, externalCodeArea) must be provided

• This operation replaces all position data

• Set nullable fields to null to remove them

• Role and Area must exist

• New employee can only be assigned to one position at a time

• When additionalParents is provided, it completely replaces any existing additional leaders

• An empty array for additionalParents removes all additional leaders

• When additionalParents is not provided (undefined), existing additional leaders remain unchanged

• Maximum of 5 additional parents allowed

• Additional parents cannot include the position itself (self-reference)

• Additional parents cannot include the direct parent position

• All additional parent positions must exist

Use Cases:

• Complete position replacement

• Update all position fields at once including the leader

• Change the occupant with full position update

• Make a position vacant by setting employeeEmail to null

• Create or update root positions by omitting parent fields

Language
Credentials
Bearer
JWT
Response
Click Try It! to start a request and see the response here!