Basic

Generate visitor token

Changed on

Generate an identification token for a website visitor who has been authenticated using your own system. An identification token returned from this API can be used to pass information about your already-authenticated visitor to the chat widget, so that it treats the visitor as a known contact. This allows support agents to recognize and assist the visitor more effectively.

post/visitor-identification/2026-09/tokens/create

Request

  • Base URL
    https://api.hubapi.com
  • URL
    https://api.hubapi.com/visitor-identification/2026-09/tokens/create
  • Auth
    OAuth 2
    Authorization code: https://app.hubspot.com/oauth/authorize
    Token URL: https://api.hubapi.com/oauth/v1/token scopes: conversations.visitor_identification.tokens.create

Request body

emailstring required

The email of the visitor that you wish to identify

firstNamestring

The first name of the visitor that you wish to identify. This value will only be set in HubSpot for new contacts and existing contacts where first name is unknown. Optional.

hsCustomerAgentContextobject required

An object containing additional context about the customer agent. This field is required and can include various string properties.

lastNamestring

The last name of the visitor that you wish to identify. This value will only be set in HubSpot for new contacts and existing contacts where last name is unknown. Optional.

Response

successful operation

tokenstring required

An identification token that allows the visitor to be treated as a known contact.

Changes

    • breaking

      added the new required request property

    • info

      the endpoint scheme security private_apps was removed from the API