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

# Update a User

> Update a user and its config. If a field is sent as null then it is considered an unset or removal.



## OpenAPI

````yaml PATCH /users/{user_id}
openapi: 3.0.1
info:
  title: Payroll API
  description: A full flagged payroll api provided by Teal
  version: 1.0.0
servers:
  - url: https://api.sandbox.goteal.co
    description: Sandbox server for experiments
  - url: https://api.goteal.co
    description: Production server
security:
  - ApiKeyAuth: []
  - MemberBearerAuth: []
paths:
  /users/{user_id}:
    description: >-
      A User represents the borrowers and end-users that give authorised access
      and/or upload their payslips to our API.
    patch:
      summary: Updates a user.
      description: >-
        Update a user and its config. If a field is sent as null then it is
        considered an unset or removal.
      parameters:
        - in: path
          name: user_id
          schema:
            type: string
          required: true
          description: ID of the user to update.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/User'
      responses:
        '200':
          description: Updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatedUser'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/UnauthorizedApiKey'
        '404':
          $ref: '#/components/responses/ResourceNotFound'
components:
  schemas:
    User:
      required:
        - forename
        - surname
        - date_of_birth
        - post_codes
        - payroll_period_months
      type: object
      properties:
        forename:
          description: Forename of the user.
          type: string
          example: John
        surname:
          description: Surname of the user.
          type: string
          example: Smith
        ni_number:
          description: National Insurance number of the user. Used for direct connections.
          type: string
          example: QQ123456C
        date_of_birth:
          $ref: '#/components/schemas/Date'
          description: Date of birth of the user. Used for direct connections.
        post_codes:
          description: >-
            One or more post codes of the user over the period of the check.
            Used for direct connections where we need to verify payroll data
            matches the user given current and past post codes.
          type: array
          items:
            type: string
          example:
            - SW1A 1AA
            - SW1A 1AB
        ext_id:
          description: >-
            External ID or any string there might be a need for saving alongside
            the User information. This is an optional identifier that can be
            used to reference the user in external systems.
          type: string
          nullable: true
          example: ext-12345
        recurring_checks_enabled:
          description: >-
            Determines if recurring checks are enabled for this user. Overrides
            the same setting if present in client level configuration.
          type: boolean
        recurring_check_frequency:
          description: >-
            Frequency of the recurring check for this user. Overrides the same
            setting if present in client level configuration. Available
            frequencies in production are [WEEKLY, DAILY]. Sandbox allows HOURLY
            frequency in addition.
          type: string
          example: WEEKLY
        recurring_check_end_date:
          $ref: '#/components/schemas/Date'
          description: >-
            End date of the recurring check schedule. Overrides the same setting
            if present in client level configuration.
        payroll_period_months:
          description: >-
            Lookback period of the payroll to search on account creation.
            Overrides the same setting if present in client level configuration.
          type: integer
          format: int32
        payslip_upload_enabled:
          type: boolean
          description: >-
            Determines if payslip upload is enabled for this user. Overrides the
            same setting if present in client level configuration.
        payroll_connections_enabled:
          type: boolean
          description: >-
            Determines if payroll connections feature is enabled for this user.
            Overrides the same setting if present in client level configuration.
    CreatedUser:
      allOf:
        - required:
            - user_id
            - created_at
          properties:
            user_id:
              type: string
              format: uuid
              description: Unique identifier for user
            created_at:
              $ref: '#/components/schemas/Date'
              description: Creation time in UTC of the user
        - $ref: '#/components/schemas/User'
    Date:
      type: string
      format: date-time
      example: '2019-05-17T00:00:00.000Z'
    Error:
      required:
        - errors
      type: object
      properties:
        errors:
          type: array
          items:
            type: string
          description: An array of messages describing the errors
          example:
            - The request is missing the required field `name`
    Unauthorized:
      type: object
      properties:
        errors:
          type: string
          description: An array of messages describing the errors
          example:
            - No X-API-KEY header provided or wrong value
    NotFound:
      type: object
      properties:
        errors:
          type: string
          description: An array of messages describing the not found errors
          example:
            - >-
              The resource with id [8be3bb60-5ab4-4bd2-90e6-3b015691a827] does
              not exist
  responses:
    BadRequest:
      description: Bad request if one of the required parameters is missing
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    UnauthorizedApiKey:
      description: Unauthorized if the X-API-KEY is not provided or is wrong
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Unauthorized'
    ResourceNotFound:
      description: Resource not found
      content:
        applcation/json:
          schema:
            $ref: '#/components/schemas/NotFound'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
    MemberBearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer token for authentication. The token should be the one returned by
        the "/members/signin"

````