MyRapidi
MyRapidi

Search our Wiki

HubSpot Line Items: Creating Unique Custom Fields API Only

Overview

Line Items in HubSpot are the individual product/service entries attached to Deals, Quotes, and (via integration) invoices. Like other HubSpot objects, Line Items support custom properties (fields) that can be created from the HubSpot UI under Settings > Properties > Line Item Properties.

However, there is one important limitation to be aware of when integrating Line Items with an external system : HubSpot's UI does not expose the option to mark a custom property as unique. If your integration needs a field that enforces uniqueness (for example, an external ID used as a matching/upsert key between HubSpot and an ERP), this can only be configured through the HubSpot API.

Why This Matters for Integrations

When syncing Line Items between HubSpot and an external system, you typically need a reliable external ID field to:

  • Prevent duplicate line items being created on repeated syncs;
  • Support upsert logic (update if exists, create if not);
  • Allow lookups by external key instead of HubSpot's internal object ID;

If this field isn't unique, HubSpot will allow multiple line items with the same external ID value, which breaks matching logic and can cause duplicate or orphaned records downstream.

Since the "unique value" property setting (hasUniqueValue) isn't available as a toggle in the property creation UI, the property must be created (or updated) via the CRM Properties API.

Creating the Property via API

Endpoint:

POST https://api.hubapi.com/crm/v3/properties/line_items

Auth: Bearer token (Private App token) or OAuth access token, passed as an Authorization: Bearer {token} header.

Postman Request Body

json

{
  "name": "external_id",
  "label": "External ID",
  "type": "string",
  "fieldType": "text",
  "groupName": "lineitemattributes",
  "description": "Unique external identifier used to match this line item with the source ERP/CRM system.",
  "hasUniqueValue": true
}

Field Notes

FieldPurpose
nameInternal property name (lowercase, underscores, no spaces) - this is what you'll reference in API calls and mappings.
labelDisplay name shown in the HubSpot UI.
typeUnderlying data type (string, number, datetime, enumeration, etc.).
fieldTypeUI input type (text, number, date, select, etc.).
groupNameProperty group it belongs to — lineitemattributes is the default group for Line Items.
hasUniqueValueThis is the key setting. Set to true to enforce uniqueness at the database level. Not available via the UI - API only.

Verifying the Property

To confirm the property was created correctly, you can retrieve it with:

GET https://api.hubapi.com/crm/v3/properties/line_items/external_id

The response will include "hasUniqueValue": true if the setting was applied successfully.