Skip to content

Create Portfolio

Required scope: portfolio:create

Portfolio creation requires an existing contactId. Create the contact first with CreateContact.

customFields is keyed by the DataField name returned by ListDataFields. HeyX stores canonical DataField IDs internally, but this public endpoint deliberately accepts and returns names for compatibility. Unknown names are preserved.

Generated Reference
POST /public-api/publicapi.v1.Portfolio/CreatePortfolio

Creates a portfolio and resolves its customer identity from the supplied customer fields. Contacts are not a public API resource.

Request CreatePortfolioRequest
Response CreatePortfolioResponse

CreatePortfolioRequest

Field Type Description
title string
custom_fields map<string, string> Keys are DataField names from ListDataFields. The public API maps these to canonical internal IDs and continues returning names for compatibility.
expected_close_date optional int64
customer_name optional string
email optional string
phone optional string Accepts an international number or a local number when phone_country is set.
phone_country optional string ISO 3166-1 alpha-2 country code used to normalize a local phone number.

CreatePortfolioResponse

Field Type
portfolio Portfolio
{
"title": "Solar installation lead",
"contactId": "ad89fe4f-345d-49d2-a6c9-13ed96a8e77d",
"customFields": {
"lead_source": "website"
}
}
Terminal window
curl https://portal.heyx.app/public-api/publicapi.v1.Portfolio/CreatePortfolio \
-H "Authorization: Bearer hx_sk_..." \
-H "Content-Type: application/json" \
-d '{
"title": "Solar installation lead",
"contactId": "ad89fe4f-345d-49d2-a6c9-13ed96a8e77d",
"customFields": {
"lead_source": "website"
}
}'

Successful requests return 201 Created with the created portfolio.

{
"portfolio": {
"id": "be85f4d1-b680-4964-bf62-9828fdf4ce04",
"title": "Solar installation lead",
"contactId": "ad89fe4f-345d-49d2-a6c9-13ed96a8e77d",
"referenceNumber": "P-000456"
}
}