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

# Update an end user

> Patch name, email, phone, tags, or channel identifiers on one end-user record.

Updates fields on one end-user record. Identity fields pass through the same normalization and merge rules as the widget and CSV import.

Requires a key with the **End-users** permission. See [API authentication](/docs/developer/authentication).

<ParamField path="endUserId" type="string" required>
  The `_id` of the record, as returned by list or create.
</ParamField>

<ParamField body="name" type="string">
  Display name.
</ParamField>

<ParamField body="email" type="string">
  Email address. A value that belongs to a different record returns `400` with a duplicate error.
</ParamField>

<ParamField body="phone" type="string">
  Phone number. A value that belongs to a different record returns `400` with a duplicate error.
</ParamField>

<ParamField body="tags" type="string[]">
  Tags to apply.
</ParamField>

<ParamField body="channelIdentifiers" type="object">
  Per-channel identifiers.
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  `true` on success.
</ResponseField>

<ResponseExample>
  ```json 200 theme={null}
  { "success": true }
  ```
</ResponseExample>

## Errors

| Status | Code                                           | Cause                                                                        |
| ------ | ---------------------------------------------- | ---------------------------------------------------------------------------- |
| `400`  | `INVALID_BODY`, `INVALID_URL`, `UPDATE_FAILED` | Malformed body, a bad path, or an email or phone owned by a different record |
| `401`  | `UNAUTHORIZED`                                 | Missing, invalid, or revoked key                                             |
| `403`  | `FORBIDDEN`                                    | Key lacks the **End-users** permission                                       |
| `404`  | `NOT_FOUND`                                    | No record matches the ID                                                     |


## OpenAPI

````yaml api-reference/openapi.json PATCH /api/endusers/{endUserId}
openapi: 3.1.0
info:
  title: Tars API
  version: 3.0.0
  description: >-
    Public REST API for Tars agents: start conversations at trigger gambits,
    send channel messages, manage end users, and drive webhook campaigns.
servers:
  - url: https://us.api.hellotars.com
    description: United States
  - url: https://eu.api.hellotars.com
    description: European Union
  - url: https://in.api.hellotars.com
    description: India
  - url: https://qa.api.hellotars.com
    description: Qatar
security:
  - bearerAuth: []
tags:
  - name: Triggers
    description: Start conversations at trigger gambits
  - name: Channels
    description: Outbound channel message sends
  - name: End users
    description: End-user record management
  - name: Campaigns
    description: Webhook campaign sends and validation
paths:
  /api/endusers/{endUserId}:
    parameters:
      - name: endUserId
        in: path
        required: true
        description: The end-user record ID
        schema:
          type: string
    patch:
      tags:
        - End users
      summary: Update an end user
      operationId: updateEndUser
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: Replacement display name.
                email:
                  type: string
                  description: >-
                    Replacement email address, normalized and checked for
                    duplicates.
                phone:
                  type: string
                  description: >-
                    Replacement phone number, normalized and checked for
                    duplicates.
                tags:
                  type: array
                  items:
                    type: string
                  description: >-
                    Replacement tag list. It replaces the existing tags rather
                    than merging with them.
                channelIdentifiers:
                  $ref: '#/components/schemas/ChannelIdentifiers'
      responses:
        '200':
          description: End user updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: True when the record was updated.
                required:
                  - success
        '400':
          description: >-
            Malformed path, malformed body, or update failure, including
            duplicate email/phone (INVALID_URL, INVALID_BODY, UPDATE_FAILED)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EndUserError'
        '401':
          description: Missing, invalid, or revoked API key (UNAUTHORIZED)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EndUserError'
        '403':
          description: Key lacks the endusers scope (FORBIDDEN)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EndUserError'
        '404':
          description: No record matches the ID (NOT_FOUND)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EndUserError'
components:
  schemas:
    ChannelIdentifiers:
      type: object
      description: >-
        Where Tars can reach this end user on each channel. Every field is
        optional, and only the channels Tars has seen are present.
      properties:
        web:
          type: string
          description: The end user's identifier on the web channel.
        whatsapp:
          type: object
          description: The end user's WhatsApp identity.
          properties:
            phone:
              type: string
              description: Phone number in international format, for example +15551234567.
            bsuid:
              type: string
              description: An alternate WhatsApp identifier for the end user.
    EndUserError:
      type: object
      description: An error from the end-user endpoints.
      properties:
        error:
          type: string
          description: A sentence describing what went wrong.
        code:
          type: string
          description: >-
            A stable machine-readable code, for example DUPLICATE_ENDUSER or
            INVALID_ORIGIN.
        details:
          type: object
          description: >-
            Reserved for extra error context. The end-user endpoints do not
            currently return it.
      required:
        - error
        - code
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key sent as Authorization: Bearer YOUR_API_KEY. Campaign endpoints
        use campaign-scoped keys; the rest use organization or agent keys with
        the matching permission.

````