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

# Generate a visitor identification token

> Genera un token de identificación para un visitante del sitio web que se autenticó utilizando tu propio sistema. Un token de identificación devuelto por esta API puede utilizarse para pasar información sobre tu visitante ya autenticado al widget de chat, de modo que trate al visitante como un contacto conocido. Eso permite a los agentes de asistencia reconocer al visitante y ayudarlo con mayor eficacia.

export const ScopesList = ({scopes = [], description = "Esta API requiere uno de los siguientes ámbitos:"}) => {
  if (!scopes || scopes.length === 0) {
    return null;
  }
  const sortedScopes = scopes.sort((a, b) => a.localeCompare(b));
  return <div>
      <div className="text-sm mb-2">{description}</div>
      <div>
        {sortedScopes.map((scope, index) => <div key={index}>
            <code>
              <span className="text-xs">{scope}</span>
            </code>
          </div>)}
      </div>
    </div>;
};

export const SupportedProducts = ({marketing, sales, service, cms, marketingLevel, salesLevel, serviceLevel, cmsLevel}) => {
  const translations = {
    header: "Productos compatibles",
    description: "Se requiere uno de los siguientes productos o productos de ediciones superiores.",
    productNames: {
      marketing: "Marketing Hub",
      sales: "Sales Hub",
      service: "Service Hub",
      cms: "Content Hub"
    },
    tiers: {
      free: "Gratuito",
      starter: "Starter",
      professional: "Pro",
      enterprise: "Enterprise"
    }
  };
  const translateTier = tier => {
    if (!tier) return '';
    const lowerTier = tier.toLowerCase();
    return translations.tiers[lowerTier] || tier;
  };
  const products = [{
    name: marketing ? translations.productNames.marketing : '',
    level: translateTier(marketingLevel),
    icon: "https://mintlify-assets.b-cdn.net/Icons/marketing-bolt.svg",
    alt: "Marketing Hub"
  }, {
    name: sales ? translations.productNames.sales : '',
    level: translateTier(salesLevel),
    icon: "https://mintlify-assets.b-cdn.net/Icons/sales-star.svg",
    alt: "Sales Hub"
  }, {
    name: service ? translations.productNames.service : '',
    level: translateTier(serviceLevel),
    icon: "https://mintlify-assets.b-cdn.net/Icons/service-heart.svg",
    alt: "Service Hub"
  }, {
    name: cms ? translations.productNames.cms : '',
    level: translateTier(cmsLevel),
    icon: "https://mintlify-assets.b-cdn.net/Icons/content-play.svg",
    alt: "Content Hub"
  }].filter(product => product.name && product.level);
  if (products.length === 0) return null;
  return <div>
      <div className="text-sm mb-2">{translations.description}</div>
      <div className={`grid ${products.length === 1 ? 'grid-cols-1' : 'grid-cols-2'} gap-1.5`}>
        {products.map((product, index) => <div key={index} style={{
    display: 'flex',
    alignItems: 'center'
  }}>
            <img src={product.icon} alt={product.alt} className="w-3.5 h-3.5 mr-1.5 mt-2.5 mb-2.5 flex-shrink-0 align-middle" />
            <span className="font-medium mr-1 text-sm">{product.name} -</span>
            <span className="text-sm">{product.level}</span>
          </div>)}
      </div>
    </div>;
};

<AccordionGroup>
  <Accordion title="Supported products" defaultOpen="true" icon="cubes">
    <SupportedProducts marketing={true} sales={true} service={true} cms={true} marketingLevel="PROFESSIONAL" salesLevel="PROFESSIONAL" serviceLevel="PROFESSIONAL" cmsLevel="PROFESSIONAL" />
  </Accordion>

  <Accordion title="Required Scopes" icon="key">
    <ScopesList
      scopes={[
  'conversations.visitor_identification.tokens.create'
]}
    />
  </Accordion>
</AccordionGroup>


## OpenAPI

````yaml specs/legacy/v3/conversations-visitor-identification-v3.json POST /visitor-identification/v3/tokens/create
openapi: 3.0.1
info:
  title: Conversations Visitor Identification
  description: Basepom for all HubSpot Projects
  version: v3
  x-hubspot-product-tier-requirements:
    marketing: PROFESSIONAL
    sales: PROFESSIONAL
    service: PROFESSIONAL
    cms: PROFESSIONAL
    commerce: PROFESSIONAL
    crmHub: PROFESSIONAL
    dataHub: PROFESSIONAL
  x-hubspot-related-documentation:
    - name: 'Visitor Identification Guide '
      url: >-
        https://developers.hubspot.com/docs/guides/api/conversations/visitor-identification
servers:
  - url: https://api.hubapi.com
security: []
tags:
  - name: Basic
paths:
  /visitor-identification/v3/tokens/create:
    post:
      tags:
        - Basic
      summary: Generar token de visitante
      description: >-
        Genera un token de identificación para un visitante del sitio web que se
        autenticó utilizando tu propio sistema. Un token de identificación
        devuelto por esta API puede utilizarse para pasar información sobre tu
        visitante ya autenticado al widget de chat, de modo que trate al
        visitante como un contacto conocido. Eso permite a los agentes de
        asistencia reconocer al visitante y ayudarlo con mayor eficacia.
      operationId: post-/visitor-identification/v3/tokens/create_generateToken
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IdentificationTokenGenerationRequest'
        required: true
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdentificationTokenResponse'
        default:
          $ref: '#/components/responses/Error'
          description: ''
      security:
        - oauth2:
            - conversations.visitor_identification.tokens.create
components:
  schemas:
    IdentificationTokenGenerationRequest:
      required:
        - email
        - hsCustomerAgentContext
      type: object
      properties:
        email:
          type: string
          description: El correo del visitante que deseas identificar
        firstName:
          type: string
          description: >-
            El nombre del visitante que deseas identificar. Este valor solo se
            establecerá en HubSpot para contactos nuevos y para contactos
            existentes cuyp nombre se desconoce. Opcional.
        hsCustomerAgentContext:
          type: object
          additionalProperties:
            type: string
        lastName:
          type: string
          description: >-
            El apellido del visitante que deseas identificar. Este valor solo se
            establecerá en HubSpot para contactos nuevos y para contactos
            existentes cuyo aprellido se desconoce. Opcional.
    IdentificationTokenResponse:
      required:
        - token
      type: object
      properties:
        token:
          type: string
          description: >-
            Un token de identificación que permite tratar al visitante como un
            contacto conocido.
    Error:
      required:
        - category
        - correlationId
        - message
      type: object
      properties:
        category:
          type: string
          description: La categoría del error
        context:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          description: Contexto de la condición de error
          example: >-
            {invalidPropertyName=[propertyValue], missingScopes=[scope1,
            scope2]}
        correlationId:
          type: string
          description: >-
            Un identificador único para la solicitud. Incluye este valor con
            cualquier informe de error o ticket de asistencia.
          format: uuid
          example: aeb5f871-7f07-4993-9211-075dc63e7cbf
        errors:
          type: array
          description: información adicional acerca del error
          items:
            $ref: '#/components/schemas/ErrorDetail'
        links:
          type: object
          additionalProperties:
            type: string
          description: >-
            Un mapa de nombres de enlaces a las URI asociadas que contienen
            documentación sobre el error o los pasos recomendados para
            solucionarlo
        message:
          type: string
          description: >-
            Un mensaje legible en el que se describa el error y los pasos para
            solucionarlo, si procede
          example: An error occurred
        subCategory:
          type: string
          description: >-
            Una categoría específica que contiene detalles más concretos acerca
            del error
      example:
        message: Invalid input (details will vary based on the error)
        correlationId: aeb5f871-7f07-4993-9211-075dc63e7cbf
        category: VALIDATION_ERROR
        links:
          knowledge-base: https://www.hubspot.com/products/service/knowledge-base
    ErrorDetail:
      required:
        - message
      type: object
      properties:
        code:
          type: string
          description: El código de estado asociado al detalle del error
        context:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          description: Contexto de la condición de error
          example: '{missingScopes=[scope1, scope2]}'
        in:
          type: string
          description: El nombre del campo o parámetro en el que se encontró el error.
        message:
          type: string
          description: >-
            Un mensaje legible en el que se describa el error y los pasos para
            solucionarlo, si procede
        subCategory:
          type: string
          description: >-
            Una categoría específica que contiene detalles más concretos acerca
            del error
  responses:
    Error:
      description: An error occurred.
      content:
        '*/*':
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://app.hubspot.com/oauth/authorize
          tokenUrl: https://api.hubapi.com/oauth/v1/token
          scopes:
            conversations.visitor_identification.tokens.create: ''

````