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

# Obtener cliente por ID

> Retorna el detalle completo de un cliente, incluyendo contactos y campos comerciales normalizados al formato esperado por el frontend legacy.



## OpenAPI

````yaml /generated/specs/clients.json get /api/v1/client/{id}
openapi: 3.0.0
info:
  title: Raul API - Clientes
  description: Clientes, clientes padre, direcciones, contactos y activos asociados.
  version: 2.0.0
  contact: {}
servers:
  - url: https://api.raul.ugps.io
    description: Production
security: []
tags:
  - name: Clients
    description: Gestion de clientes
paths:
  /api/v1/client/{id}:
    get:
      tags:
        - Clients
      summary: Obtener cliente por ID
      description: >-
        Retorna el detalle completo de un cliente, incluyendo contactos y campos
        comerciales normalizados al formato esperado por el frontend legacy.
      operationId: ClientQueryController_getClientById
      parameters:
        - name: id
          required: true
          in: path
          description: ID del cliente (UUID)
          schema:
            type: string
      responses:
        '200':
          description: >-
            La sesión legacy recibe el detalle completo snake_case; una llamada
            MCP delegada recibe sólo la proyección curada.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/LegacyClientDetailResponseDto'
                  - $ref: '#/components/schemas/DelegatedClientDetailResponseDto'
        '404':
          description: Cliente no encontrado
      security:
        - bearerAuth: []
components:
  schemas:
    LegacyClientDetailResponseDto:
      type: object
      properties:
        client_id:
          type: string
          description: ID del cliente
        client_name:
          type: string
          nullable: true
          description: Nombre legal del cliente
        fantasy_name:
          type: string
          nullable: true
          description: Nombre de fantasía del cliente
        rut:
          type: string
          nullable: true
          description: RUT formateado del cliente
        classification:
          type: number
          nullable: true
          description: Clasificación del cliente
        platform_usage_frequency:
          type: number
          nullable: true
          description: Frecuencia de uso de plataforma
        usage_preference:
          type: number
          nullable: true
          description: Preferencia de uso
        address:
          type: string
          nullable: true
          description: Dirección comercial
        city_id:
          type: string
          nullable: true
          description: ID de la ciudad
        integration:
          type: boolean
          nullable: true
          description: Integración activa
        id_navixy:
          type: string
          nullable: true
          description: ID de Navixy
        id_wialon:
          type: string
          nullable: true
          description: ID de Wialon
        atlas_client_id:
          type: string
          nullable: true
          description: Id del cliente de Atlas vinculado (ObjectId)
        rubro_id:
          type: number
          nullable: true
          description: ID del rubro
        rubro_name:
          type: string
          nullable: true
          description: Nombre del rubro
        giro:
          type: string
          nullable: true
          description: Giro comercial
        type_of_contract_id:
          type: string
          nullable: true
          description: ID del tipo de contrato
        type_of_contract_name:
          type: string
          nullable: true
          description: Nombre del tipo de contrato
        base_plan_id:
          type: number
          nullable: true
          description: ID del plan base
        base_plan_name:
          type: string
          nullable: true
          description: Nombre del plan base
        special_prices:
          type: string
          nullable: true
          description: Precios especiales
        email:
          type: string
          nullable: true
          description: Correo comercial
        phone:
          type: string
          nullable: true
          description: Teléfono comercial
        logo_url:
          type: string
          nullable: true
          description: URL del logo del cliente
        linkedin_url:
          type: string
          nullable: true
          description: URL de LinkedIn del cliente
        linkedin_summary:
          type: string
          nullable: true
          description: Resumen de LinkedIn del cliente
        contact_list:
          description: Contactos legacy del cliente
          type: array
          items:
            $ref: '#/components/schemas/LegacyClientContactResponseDto'
        gps_count:
          type: number
          description: Cantidad de GPS activos
        id_father:
          type: string
          nullable: true
          description: ID del cliente padre
        city_name:
          type: string
          nullable: true
          description: Nombre de la ciudad
        region_name:
          type: string
          nullable: true
          description: Nombre de la región
        seller_id:
          type: string
          nullable: true
          description: ID del vendedor
        seller_name:
          type: string
          nullable: true
          description: Nombre del vendedor
        payment_terms:
          type: number
          description: Días de plazo de pago
        dte_type:
          type: string
          description: Tipo de documento tributario
        dte_casilla_email:
          type: string
          nullable: true
          description: Casilla DTE del cliente
        factura:
          type: boolean
          description: Indica si factura
        orden_compra:
          type: boolean
          description: Indica si requiere orden de compra
        requires_hes:
          type: boolean
          description: Indica si requiere HES
        invoice_description_template:
          type: string
          nullable: true
          description: Plantilla de descripción de factura
        consolidate_billing_groups:
          type: boolean
          description: Indica si consolida grupos de facturación
      required:
        - client_id
        - client_name
        - fantasy_name
        - rut
        - classification
        - platform_usage_frequency
        - usage_preference
        - address
        - city_id
        - integration
        - id_navixy
        - id_wialon
        - atlas_client_id
        - rubro_id
        - rubro_name
        - giro
        - type_of_contract_id
        - type_of_contract_name
        - base_plan_id
        - base_plan_name
        - special_prices
        - email
        - phone
        - logo_url
        - linkedin_url
        - linkedin_summary
        - contact_list
        - gps_count
        - id_father
        - city_name
        - region_name
        - seller_id
        - seller_name
        - payment_terms
        - dte_type
        - dte_casilla_email
        - factura
        - orden_compra
        - requires_hes
        - invoice_description_template
        - consolidate_billing_groups
    DelegatedClientDetailResponseDto:
      type: object
      properties:
        client_id:
          type: string
          description: ID del cliente
        client_name:
          type: string
          nullable: true
          description: Nombre legal del cliente
        fantasy_name:
          type: string
          nullable: true
          description: Nombre de fantasía del cliente
        rut:
          type: string
          nullable: true
          description: RUT formateado del cliente
        giro:
          type: string
          nullable: true
          description: Giro comercial del cliente
        email:
          type: string
          nullable: true
          description: Correo comercial del cliente
        phone:
          type: string
          nullable: true
          description: Teléfono comercial del cliente
        address:
          type: string
          nullable: true
          description: Dirección comercial del cliente
        city_name:
          type: string
          nullable: true
          description: Ciudad comercial del cliente
        contacts:
          description: Contactos comerciales permitidos
          type: array
          items:
            $ref: '#/components/schemas/DelegatedClientContactResponseDto'
      required:
        - client_id
        - contacts
    LegacyClientContactResponseDto:
      type: object
      properties:
        contact_id:
          type: string
          description: ID del contacto
        contact_name:
          type: string
          nullable: true
          description: Nombre del contacto
        phone:
          type: string
          nullable: true
          description: Teléfono del contacto
        email:
          type: string
          nullable: true
          description: Correo del contacto
        linkedin_url:
          type: string
          nullable: true
          description: URL de LinkedIn del contacto
        linkedin_summary:
          type: string
          nullable: true
          description: Resumen de LinkedIn del contacto
        rol:
          type: string
          nullable: true
          description: Rol comercial del contacto
        role_contact_name:
          type: string
          nullable: true
          description: Nombre del rol del contacto
        position:
          type: string
          nullable: true
          description: Cargo del contacto
        functional_roles:
          type: array
          items:
            type: object
            additionalProperties: true
          description: Roles funcionales legacy del contacto
      required:
        - contact_id
        - contact_name
        - phone
        - email
        - linkedin_url
        - linkedin_summary
        - rol
        - role_contact_name
        - position
        - functional_roles
    DelegatedClientContactResponseDto:
      type: object
      properties:
        contact_name:
          type: string
          nullable: true
          description: Nombre del contacto
        email:
          type: string
          nullable: true
          description: Correo del contacto
        phone:
          type: string
          nullable: true
          description: Teléfono del contacto
        rol:
          type: string
          description: Rol comercial del contacto
      required:
        - rol
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Token de sesión Better Auth para rutas de backoffice; las rutas de
        portal usan su token propio.

````

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