---
title: "Generate visitor token"
method: POST
path: "/visitor-identification/2026-03/tokens/create"
tags: ["Basic"]
---

# Generate visitor token

`POST /visitor-identification/2026-03/tokens/create`

## Request

- Base URL: `https://api.hubapi.com`
- URL: `https://api.hubapi.com/visitor-identification/2026-03/tokens/create`
- Auth: one of:
  - HTTP bearer
  - API key in query parameter `hapikey`
  - none

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.

## Request body

- ConversationsVisitorIdentificationIdentificationTokenGenerationRequest
  - `email` string, required: The email of the visitor that you wish to identify
  - `firstName` string: 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.
  - `hsCustomerAgentContext` object, required
  - `lastName` string: 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 `200`

successful operation

- ConversationsVisitorIdentificationIdentificationTokenResponse
  - `token` string, required: An identification token that allows the visitor to be treated as a known contact.

## Other responses

- `default`: An error occurred.

## Changes

> 14 revisions in range; 1 not diffed, 2 could not be searched.

- **2026-05-27** `f9c7181056c5`: 1 breaking
  - added the new required request property `hsCustomerAgentContext`
- **2026-04-08** `b0d8bc008db9`: 1 info
  - api operation id `post-/visitor-identification/2026-03/tokens/create_generateToken` removed and replaced with `post-/visitor-identification/2026-03/tokens/create`
- **2026-03-25** `62586336cea2`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/hubspot/apis/hubspot-api-specification/changes/visitor-identification/2026-03/tokens/create/post.md)

---

[API](https://skmtc.dev/hubspot/apis/hubspot-api-specification.md) - [All operations](https://skmtc.dev/hubspot/apis/hubspot-api-specification/llms.txt) - [OpenAPI document](https://skmtc.dev/hubspot/apis/hubspot-api-specification/revisions/f9c7181056c5?raw)
