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

# Criar ou atualizar usuário

> Upsert de usuario final (`USER` por defecto). `externalUserId` es el id estable en tu sistema. Alcance: **chat:users**.



## OpenAPI

````yaml /es/chat-api/api-reference/openapi-chat.json put /v1/chat/users
openapi: 3.0.3
info:
  title: Notifique API Chat
  description: >-
    Chat in-app: apps, usuarios, JWT, conversaciones y mensajes. Autentica con
    `Authorization: Bearer sk_live_...` (backend) o JWT del usuario. No envíes
    `x-workspace-id`.
  version: 1.0.0
servers:
  - url: https://api.notifique.dev
    description: Produção
security:
  - ntfChatBearerAuth: []
  - ntfChatApiKeyHeader: []
tags:
  - name: Chat Apps
    description: CRUD de Chat Apps e rotação do signing secret
  - name: Chat Users
    description: Usuários, JWT e agentes
  - name: Chat Conversations
    description: Conversas 1:1, grupos e membros
  - name: Chat Messages
    description: Envio, listagem e exclusão
  - name: Chat Blocks
    description: Bloqueo entre usuarios de la misma Chat App
paths:
  /v1/chat/users:
    put:
      tags:
        - Chat Users
      summary: Criar ou atualizar usuário
      description: >-
        Upsert de usuario final (`USER` por defecto). `externalUserId` es el id
        estable en tu sistema. Alcance: **chat:users**.
      operationId: ntfChat_putV1ChatUsers
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - chatAppId
                - externalUserId
              properties:
                chatAppId:
                  type: string
                  example: clxxapp...
                externalUserId:
                  type: string
                  example: user_alice
                name:
                  type: string
                  example: Alice
                kind:
                  type: string
                  enum:
                    - USER
                    - AGENT
                  description: Por defecto USER. Para AGENT use POST /v1/chat/agents.
                email:
                  type: string
                  format: email
                  description: Opcional. Ayuda a vincular con el contacto de audiencia.
                  example: alice@tusitio.com
                phone:
                  type: string
                  example: '+5511999990000'
                avatarUrl:
                  type: string
                  format: uri
                  example: https://cdn.tusitio.com/alice.png
                contactId:
                  type: string
            example:
              chatAppId: clxxapp...
              externalUserId: user_alice
              name: Alice
              email: alice@tusitio.com
              avatarUrl: https://cdn.tusitio.com/alice.png
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    $ref: '#/components/schemas/NtfChat_ChatUser'
        '401':
          description: API Key ou JWT ausente/inválido.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfChat_ErrorResponse'
        '402':
          description: Workspace bloqueado ou créditos insuficientes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfChat_ErrorResponse'
        '403':
          description: >-
            Sem escopo, origem não permitida ou JWT sem permissão
            (CHAT_CLIENT_CREATE_DISABLED).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfChat_ErrorResponse'
components:
  schemas:
    NtfChat_ChatUser:
      type: object
      properties:
        id:
          type: string
        chatAppId:
          type: string
        externalUserId:
          type: string
        name:
          type: string
          nullable: true
        kind:
          type: string
          enum:
            - USER
            - AGENT
          example: USER
        workspaceUserId:
          type: string
          nullable: true
          description: Informado en AGENT.
        email:
          type: string
          nullable: true
        phone:
          type: string
          nullable: true
        avatarUrl:
          type: string
          nullable: true
        contactId:
          type: string
          nullable: true
    NtfChat_ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
        code:
          type: string
        message:
          type: string
  securitySchemes:
    ntfChatBearerAuth:
      type: http
      scheme: bearer
      description: API Key `sk_live_…` / `sk_test_…` ou JWT do usuário do chat (`eyJ…`).
    ntfChatApiKeyHeader:
      type: apiKey
      in: header
      name: x-api-key

````