> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flowpayroll.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Change what your account records about a person

> Needs permission user:write.

A JSON Merge Patch: leave a field out to keep it, send `null` to clear it. Answers the person as they now stand, in `GET /users/{principalId}`'s shape.

`externalId` is your own identifier for them, such as their id in your HR system, and the same value SCIM provisioning reads and writes, so changing it here changes it there. 1 to 256 characters, case-sensitive, no spaces at either end (400 `invalid_external_id`).

An identity provider finds, updates and removes people by it, so this route's `user:write` must be held across your whole account, not only in some organisations (403 `insufficient_permissions`, `missingPermission: user:write`), and, where your account gives roles, the person must not be able to do anything you cannot (403 `holder_outranks_you`). An API token is judged the same way: one with the `hr-integration` role across the account may change it. 409 `external_id_taken` when somebody else in your account has it, and `concurrent_change` when it was changed while this request ran (read it again and retry). Works on your guests too. 404 when the person is neither one of your people nor your guest.

Their name and sign-in address belong to their sign-in account, and their access to the access routes; neither changes here.



## OpenAPI

````yaml /api-reference/specs/administration.json patch /users/{principalId}
openapi: 3.0.4
info:
  title: Administration API
  description: >-
    Manage your Flow Payroll account: the organisations it owns, the people who
    can sign in to it, the API tokens it holds, its brand, and a feed of recent
    administration activity. Every resource is scoped to the account your
    credentials belong to, so no request ever names a customer and the
    `X-Org-Id` header is not used.
  version: v1
servers:
  - url: https://api.sandbox.flowpayroll.ai/v1/administration
security:
  - X-Auth-Token: []
tags:
  - name: Customer
    description: >-
      Your account: the customer every other resource on this API belongs to.
      Read it and rename it.
  - name: Organisations
    description: >-
      The organisations your account owns or manages: list them with headcounts
      and your access to each, get one in full, add one or several at a time,
      see everybody who can reach one, and read which of its data an outside
      system manages.
  - name: Organisation groups
    description: >-
      Named sets of your organisations, such as the clients one team looks
      after. Give a person or API token a group, and they reach every
      organisation in it, including ones added later.
  - name: Users
    description: >-
      The people who can sign in to your account: list, invite (one or many),
      resend invitations, and manage each person's direct grants and
      account-wide access.
  - name: Roles
    description: >-
      What people and API tokens can do where they have access: the built-in
      roles, roles of your own, and the default role. Only Administrator can be
      given today.
  - name: API tokens
    description: >-
      The client credentials your integrations authenticate with: create (the
      secret is shown once), rename, rotate, revoke, and manage which
      organisations each token reaches.
  - name: Branding
    description: >-
      Your white-label brand: edit a draft, publish it, upload its files, and
      set a company logo for each organisation.
  - name: Activity
    description: >-
      Recent administration actions in your account, and every change to who has
      access, newest first.
  - name: SCIM
    description: >-
      SCIM 2.0 provisioning: your identity provider adds, updates, suspends and
      removes your account's people, and gives them account-wide roles.
paths:
  /users/{principalId}:
    patch:
      tags:
        - Users
      summary: Change what your account records about a person
      description: >-
        Needs permission user:write.


        A JSON Merge Patch: leave a field out to keep it, send `null` to clear
        it. Answers the person as they now stand, in `GET
        /users/{principalId}`'s shape.


        `externalId` is your own identifier for them, such as their id in your
        HR system, and the same value SCIM provisioning reads and writes, so
        changing it here changes it there. 1 to 256 characters, case-sensitive,
        no spaces at either end (400 `invalid_external_id`).


        An identity provider finds, updates and removes people by it, so this
        route's `user:write` must be held across your whole account, not only in
        some organisations (403 `insufficient_permissions`, `missingPermission:
        user:write`), and, where your account gives roles, the person must not
        be able to do anything you cannot (403 `holder_outranks_you`). An API
        token is judged the same way: one with the `hr-integration` role across
        the account may change it. 409 `external_id_taken` when somebody else in
        your account has it, and `concurrent_change` when it was changed while
        this request ran (read it again and retry). Works on your guests too.
        404 when the person is neither one of your people nor your guest.


        Their name and sign-in address belong to their sign-in account, and
        their access to the access routes; neither changes here.
      operationId: UpdateUser
      parameters:
        - name: principalId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/UpdateUserRequest'
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateUserRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserDetailResponseResponseBody'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectResponseBody'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectResponseBody'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectResponseBody'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectResponseBody'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObjectResponseBody'
components:
  schemas:
    UpdateUserRequest:
      type: object
      properties:
        externalId:
          type: string
          description: >-
            Your own identifier for this person or guest: 1 to 256 characters,
            case-sensitive, unique among your people and guests, and the same

            value SCIM provisioning reads and writes. `null` clears it.
          nullable: true
      additionalProperties: false
      description: >-
        A JSON Merge Patch (RFC 7396) of a person in your account: leave a field
        out to keep it, send `null` to clear it.

        Their name and sign-in address belong to their sign-in account and their
        access to the access routes, so neither

        changes here.
    UserDetailResponseResponseBody:
      type: object
      properties:
        message:
          $ref: '#/components/schemas/MessageWithTokenResponse'
        content:
          $ref: '#/components/schemas/UserDetailResponseContentResponse'
        validationIssues:
          type: array
          items:
            $ref: '#/components/schemas/ValidationIssue'
          nullable: true
      additionalProperties: false
    ObjectResponseBody:
      type: object
      properties:
        message:
          $ref: '#/components/schemas/MessageWithTokenResponse'
        content:
          $ref: '#/components/schemas/ObjectContentResponse'
        validationIssues:
          type: array
          items:
            $ref: '#/components/schemas/ValidationIssue'
          nullable: true
      additionalProperties: false
    MessageWithTokenResponse:
      type: object
      properties:
        text:
          type: string
        token:
          type: string
        tokenArguments:
          type: array
          items:
            $ref: '#/components/schemas/ValidationIssueArgument'
          nullable: true
      additionalProperties: false
    UserDetailResponseContentResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/UserDetailResponse'
        metadata:
          $ref: '#/components/schemas/ContentMetadataResponse'
      additionalProperties: false
    ValidationIssue:
      type: object
      properties:
        field:
          type: string
        reason:
          type: string
        reasonToken:
          type: string
        reasonTokenArguments:
          type: array
          items:
            $ref: '#/components/schemas/ValidationIssueArgument'
          nullable: true
      additionalProperties: false
    ObjectContentResponse:
      type: object
      properties:
        data: {}
        metadata:
          $ref: '#/components/schemas/ContentMetadataResponse'
      additionalProperties: false
    ValidationIssueArgument:
      type: object
      properties:
        name:
          type: string
        value: {}
      additionalProperties: false
    UserDetailResponse:
      type: object
      properties:
        user:
          $ref: '#/components/schemas/UserSummaryResponse'
        organisationIds:
          type: array
          items:
            type: string
          description: >-
            Deprecated: use `access`. Deprecated: use `access`. Every
            organisation they hold a direct grant on.
          deprecated: true
        coversWholeCustomer:
          type: boolean
          description: >-
            Deprecated: use `access`. Deprecated: use `access`. True when they
            also hold account-wide access, which reaches every organisation the

            account owns, including ones added later. When true,
            `organisationIds` is not the whole picture and is

            usually empty.
          deprecated: true
        access:
          type: array
          items:
            $ref: '#/components/schemas/AccessGrantResponse'
          description: >-
            Their grants in your account, in the shape `POST /users` takes:
            account-wide first, then each organisation

            group, then each organisation. A grant from before roles existed
            reads as `administrator`.
        guestAccess:
          type: array
          items:
            $ref: '#/components/schemas/AccessGrantResponse'
          description: >-
            On `GET /users/me` only: your grants on other accounts'
            organisations, where you are a guest, in the same

            shape. Empty elsewhere.
        isOwner:
          type: boolean
          description: >-
            On `GET /users/me` only: whether you own your account. Absent
            elsewhere.
          nullable: true
      additionalProperties: false
      description: 'One person in full: who they are, and everything they reach.'
    ContentMetadataResponse:
      type: object
      properties:
        dateFormat:
          type: string
        dateTimeFormat:
          type: string
        paginationToken:
          type: string
          nullable: true
      additionalProperties: false
    UserSummaryResponse:
      type: object
      properties:
        principalId:
          type: string
          description: >-
            The person's stable identifier on this platform. Address them with
            it on every

            `/users/{principalId}` route.
        email:
          type: string
          description: The address they sign in with.
          nullable: true
        givenName:
          type: string
          description: Their first name, as invited.
          nullable: true
        familyName:
          type: string
          description: Their last name, as invited.
          nullable: true
        accountState:
          enum:
            - unknown
            - invited
            - active
            - disabled
          type: string
          description: >-
            `invited` until they first sign in, `active` once they have,
            `disabled` when their
                        sign-in has been switched off, and `unknown` when the identity directory could not be reached
                        for this row. Somebody linked to an identity provider is `active` from the start: there is
                        no invitation to accept.
        detailsAvailable:
          type: boolean
          description: >-
            False when the identity directory did not answer for this person.
            Their name and email address

            are then the last values stored and may be out of date or absent.
            The row is still returned.
        invitedDate:
          type: string
          description: When they were first given access to this account.
          nullable: true
        accessType:
          enum:
            - Customer
            - Guest
          type: string
          description: >-
            `Customer` for one of the account's own people; `Guest` for somebody
            from another
                        business who reaches organisations here by invitation. A guest row shows only the access this
                        account granted, and their account is not this account's to manage.
        signInProviders:
          type: array
          items:
            type: string
          description: >-
            The identity providers this person signs in through, by name. Empty
            or absent when they sign

            in with a password.
          nullable: true
        passwordSignIn:
          type: string
          description: >-
            `Denied` when they sign in through their identity provider alone: no
            temporary password was
                        issued, the invitation cannot be resent, and there is nothing to reset. `Allowed` when they
                        have a password. Absent on accounts created before sign-in was recorded.
          nullable: true
        externalId:
          type: string
          description: >-
            Your own identifier for this person, set with `PATCH
            /users/{principalId}` or on invitation, and the same value

            SCIM provisioning reads and writes. Absent when none is set. A
            guest's is your account's own label for them.
          nullable: true
      additionalProperties: false
      description: One person in your account.
    AccessGrantResponse:
      type: object
      properties:
        scope:
          $ref: '#/components/schemas/AccessChangeScopeResponse'
        roleId:
          type: string
          description: The role there.
      additionalProperties: false
      description: >-
        One grant: a scope and the role it carries there, in the shape the
        create requests send it. The scope is the one

        the access-change history publishes, with `id` always filled (the
        account's own id on `Account`).
    AccessChangeScopeResponse:
      type: object
      properties:
        type:
          enum:
            - Organisation
            - OrganisationGroup
            - Account
          type: string
          description: >-
            `Organisation`, `OrganisationGroup` or `Account` (every organisation
            of the account).
        id:
          type: string
          description: The organisation, the organisation group or the account.
      additionalProperties: false
      description: What changed access reaches.
  securitySchemes:
    X-Auth-Token:
      type: apiKey
      description: FlowPayroll JWT (raw token, no Bearer prefix)
      name: X-Auth-Token
      in: header

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.