Everything an AI agent can do with the Heap API.

A reference guide for building AI agents: every method, how to authenticate, and the permissions each one needs.

Endpoints10
API versionv1
Last updated23 June 2026
Orientation

How the Heap API works.

The Heap API is how an app or AI agent sends data into a Heap environment: recording a custom server-side event, tying an anonymous visitor to a known identity, attaching properties to a user or an account, and submitting users for deletion. Access is granted through an environment ID that names the project the data lands in, while the user-deletion methods additionally require an account API key, so the credential sets which environment a call can reach. Heap is a one-way ingestion API: data flows in and is read back through reports, and there is no push of events out to an app.

10Endpoints
5Capability groups
2Read
8Write
2Permissions
Authentication
Heap's ingestion methods authenticate by including an app_id, the environment ID of a project, in the request body. They carry no API key, secret, or token, so the app_id is the only credential, and Heap publishes no granular scopes for these calls. The user-deletion management methods are different: they exchange an app_id and account API key, sent over HTTP Basic auth, for a short-lived bearer access_token used on later requests.
Permissions
Heap's ingestion API has no per-method scopes. The app_id grants the ability to send data into that one environment, with no read, write, or resource-level breakdown, so any holder of an app_id can call every ingestion method for that environment. Finer control sits outside the API, in who holds the credential. The user-deletion methods are gated separately by the account API key.
Versioning
Heap does not publish a dated API version or a public API changelog. The track, add user properties, and add account properties methods live under an unversioned path; Identify lives under a v1 path; and the user-deletion methods live under a v0 path. There is no version header to set and nothing to pin.
Data model
Heap is ingestion-first. An agent sends events and properties in, keyed to a user by an identity or an anonymous user_id, and to an account by an account_id. A single call writes one record; a bulk call writes up to 1000 in one request. Heap does not expose an API to read raw events back; data is queried in Heap reports. Heap is now part of Contentsquare.
Connect & authenticate

Connection & authentication methods.

How an app or AI agent connects to Heap determines what it can reach. There is a route for sending data in, which identifies itself with an environment ID, and a separate management route for deleting users, which uses an account API key. Each is governed by the credential behind it.

Ways to connect

Server-side ingestion API

The ingestion methods take JSON request bodies and authenticate by including app_id, the environment ID, in the body. Standard hosting is at https://heapanalytics.com; EU datacenter environments use https://c.eu.heap-api.com for the same paths. There is no API key, scope, or token on these calls, and Heap publishes no granular permissions for them.

Best forSending events and properties into Heap from an app or AI agent.
Governed byThe app_id (environment ID) in the request body.
Docs ↗

User-deletion management API

The user-deletion methods sit under a public v0 path and use an account API key rather than just an app_id. An agent POSTs app_id and api_key over HTTP Basic auth to the auth_token method to receive a bearer access_token, then submits and polls deletions with that token. It is used for privacy and data-subject deletion requests.

Best forDeleting users for privacy requests from an app or AI agent.
Governed byThe account API key, exchanged for a bearer access_token.
Docs ↗

Contentsquare MCP server

Heap is now part of Contentsquare, and Contentsquare publishes an official Model Context Protocol server that lets AI agents query experience and analytics data, including coverage for Heap and Hotjar, in plain language. It works with MCP clients like Claude, ChatGPT, Microsoft Copilot, Dust, VS Code, and Cursor. It is a separate analytics-query surface, not the Heap ingestion API documented here, and its tool-call allowances are tied to Contentsquare plans.

Best forLetting an AI agent query Contentsquare and Heap analytics in plain language.
Governed byThe Contentsquare account and its MCP authentication.
Docs ↗
Authentication

Environment ID (app_id)

The ingestion methods authenticate by including app_id in the request body, the environment ID of the project the data lands in. There is no API key, secret, or token alongside it, and no per-method scopes, so the app_id alone authorizes every ingestion method for that one environment. It is found in Heap under Account, Manage, Privacy & Security.

TokenEnvironment ID string in the request body (app_id)
Best forAuthenticating server-side ingestion calls to one environment.
Docs ↗

Account API key (bearer token)

The user-deletion methods use an account API key. An agent sends app_id and api_key over HTTP Basic auth to the auth_token method and receives a bearer access_token, then puts that token in the Authorization header on the user_deletion and deletion_status calls. The api_key is generated in Heap under Account, Manage, Privacy & Security.

TokenBearer access_token, obtained from app_id plus api_key
Best forAuthenticating the user-deletion management methods.
Docs ↗
Endpoint reference

Every Heap API method.

Filter by method, access, or permission, or search any path. Select a row for version detail, rate limits, the related webhook event, and the source.

MethodEndpointWhat it doesAccessPermissionVersion

Events

Methods for sending custom events into Heap server-side.2

Authenticated only by app_id in the body; no scopes. Requires identity or user_id, but not both. Limited to 30 requests per 30 seconds per identity per app_id.

Acts onevent
Permission (capability)app_id
VersionAvailable since the API’s base version
Webhook eventNone
Rate limit30 requests / 30s per identity per app_id

Same path as track, with an events array. Max 1000 events per request. An optional idempotency_key prevents duplicates. Browser fetch, jQuery, and XMLHttpRequest are not supported.

Acts onevent
Permission (capability)app_id
VersionAvailable since the API’s base version
Webhook eventNone
Rate limit1000 events/min per identity; 15,000 events/min per app_id

Identity

Methods for tying an anonymous visitor to a known identity.1

Authenticated only by app_id. One identity per user_id; at most 10 user_ids mapped to one identity over a rolling one-month window. identity is case-sensitive, max 255 characters.

Acts onidentity
Permission (capability)app_id
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

User properties

Methods for attaching custom properties to users.2

Authenticated only by app_id. Creates the identity if it does not exist. Use the lowercase key 'email' to write the built-in Email field. Limited to 30 requests per 30 seconds per identity per app_id.

Acts onuser
Permission (capability)app_id
VersionAvailable since the API’s base version
Webhook eventNone
Rate limit30 requests / 30s per identity per app_id

Same path as add user properties, with a users array. Max 1000 users per request. Use the lowercase key 'email' for the built-in Email field.

Acts onuser
Permission (capability)app_id
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Account properties

Methods for attaching custom properties to accounts.2

Authenticated only by app_id. Requires an account_id (or the Salesforce integration). Each property key and value must be a number or a string under 1024 characters.

Acts onaccount
Permission (capability)app_id
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Same path as add account properties, with an accounts array of account_id and properties. Max 1000 accounts per request.

Acts onaccount
Permission (capability)app_id
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

User deletion

Management methods for deleting users and checking deletion status.3

Uses HTTP Basic auth with app_id as the username and api_key as the password. Returns access_token on a 200; returns 401 when credentials are invalid. The api_key is generated under Account, Manage, Privacy & Security.

Acts onauth_token
Permission (capability)api_key
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Requires the bearer access_token in the Authorization header. Takes a users array of user_id or identity, up to 10,000 users per request. Permanently removes user data.

Acts onuser_deletion
Permission (capability)api_key
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Requires the bearer access_token in the Authorization header. The deletion_request_id comes from the user_deletion response.

Acts onuser_deletion
Permission (capability)api_key
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply
No endpoints match those filters.
Webhooks

Webhook events.

Heap does not push events out to an app. Activity recorded through these methods lands in Heap, where it is queried in reports rather than streamed back, so an integration sends data in and does not receive callbacks.

EventWhat it signalsTriggered by
No events match that search.
Rate limits & pagination

Rate limits, pagination & request size.

Heap limits how fast and how much an app can send. Ingestion is capped per identity and per environment, single calls carry per-field size limits, and bulk calls cap how many records fit in one request.

Request rate

Heap meters ingestion per identity and per environment, not by a per-method cost. The single track and add user properties methods are limited to 30 requests per 30 seconds per identity per app_id. Bulk track is limited to 1000 events per minute per identity per app_id and 15,000 events per minute per app_id. The Identify method limits one identity per user_id, and at most 10 user_ids mapped to one identity over a rolling one-month window. Going over returns an error response rather than a documented retry header.

Pagination

The ingestion methods do not page, because they send data in rather than read it back. The user-deletion flow is asynchronous instead of paginated: a deletion request returns an id, and a separate status method is polled with that id to check progress.

Request size

A single track call caps the event name at 1024 characters, an identity at 255 characters, and each property key or value at 1024 characters. A bulk track call carries at most 1000 events; bulk add user properties at most 1000 users; bulk add account properties at most 1000 accounts; and a user-deletion request at most 10,000 users. An array property is flattened to a string joined by a double-pipe and capped at 1024 characters.

Errors

Status codes & error handling.

The status codes an agent should handle, and what to do about each.

StatusCodeMeaningWhat to do
200OKThe ingestion call was accepted. A successful track, identify, or add-properties call returns an HTTP 200, typically with an empty JSON body.Treat 200 as accepted. Because ingestion is asynchronous, a 200 confirms the request was taken, not that the data is queryable yet.
400Bad RequestThe request was malformed or violated a constraint, like a missing required field, both identity and user_id supplied to track, or a property over the size limit.Read the error message, fix the body to satisfy the field and size rules, and resend. The request is not retryable as-is.
401UnauthorizedOn the management methods, the app_id and api_key credentials were invalid when requesting an auth_token, or the bearer access_token was missing or expired.Confirm the api_key and app_id are correct, request a fresh access_token, and send it in the Authorization header.
Versioning & freshness

Version history.

Heap's server-side ingestion endpoints carry no dated versioning. Most live under an unversioned path, the Identify method sits under a v1 path, and the user-deletion management endpoints sit under a v0 path.

Version history

What changed, and when

Latest versionv1
v1Current version
Current server-side ingestion API

Heap's server-side ingestion API carries no dated versioning and Heap publishes no public API changelog. The track, add user properties, and add account properties methods live under an unversioned path; the Identify method lives under a v1 path; and the user-deletion management methods live under a public v0 path. There is no version header to set.

What changed
  • Ingestion methods (track, add_user_properties, add_account_properties) sit under an unversioned path.
  • Identify sits under a v1 path.
  • User-deletion management methods sit under a public v0 path.
  • Heap is now part of Contentsquare.
Earlier
Bulk and account-property methods added

Heap extended the server-side ingestion API beyond single calls. Bulk forms of track, add user properties, and add account properties were added, each capped at 1000 records per request, alongside the account-properties methods for attaching data at the account level. Heap does not date these changes in a public changelog.

What changed
  • Bulk track, bulk add user properties, and bulk add account properties introduced.
  • Account-level property methods added alongside user-level ones.
  • idempotency_key supported on bulk track to prevent duplicate events.

Heap does not publish a dated API changelog, so there is no version to pin.

Heap API reference ↗
Questions

Heap API, answered.

How does an agent authenticate to the Heap ingestion API?+
By including app_id in the request body, the environment ID of the project the data should land in. The ingestion methods (track, identify, add user properties, add account properties, and their bulk forms) carry no API key, secret, or bearer token; the app_id is the only credential. It is found in Heap under Account, Manage, Privacy & Security, where the environment ID is also shown.
Why do the user-deletion methods need a separate credential?+
User deletion is a management action, not ingestion, so it uses an account API key. An agent first POSTs to the auth_token method with app_id and api_key over HTTP Basic auth to receive a bearer access_token, then sends that token on the user_deletion and deletion_status calls. The api_key is generated in Heap under Account, Manage, Privacy & Security.
Does Heap have granular permissions or scopes for the API?+
No. The ingestion API has no per-method scopes or read/write split. An app_id grants the ability to send any supported data into that one environment, so anyone holding it can call every ingestion method for that environment. Access is controlled by who holds the credential, not by scopes on the API, which is exactly the boundary Bollard adds in front of Heap.
Does Heap send webhooks or push events to my app?+
No. Heap is a one-way ingestion API. Data sent through these methods lands in Heap and is read back through reports inside Heap, not streamed out. There are no outbound webhooks or event callbacks, so an integration sends data in and does not subscribe to receive anything.
Can I export raw events out of Heap through the API?+
Heap's public API is for sending data in, not pulling raw events out. The documented methods cover ingestion and user deletion; data is analyzed in Heap reports rather than fetched event by event over the API. Plan for Heap as a destination an agent writes to, not a source it queries.
How are EU-hosted Heap environments different?+
EU datacenter environments use a different host for the same methods and paths, c.eu.heap-api.com in place of heapanalytics.com. The body fields, limits, and authentication are otherwise identical, so only the base host changes for an EU project.
Related

More analytics API guides for agents

What is Bollard AI?

Control what every AI agent can do in Heap.

Bollard AI sits between a team's AI agents and Heap. Grant each agent exactly the access it needs, read or write, method by method, and every call is checked and logged.

  • Set read, write, or full access per agent, never a shared Heap key.
  • Denied by default, so an agent reaches only what has been explicitly allowed.
  • Every call recorded in plain English: who, what, where, and the decision.
Heap
Analytics Agent
Send custom events ActionOffReadFull use
Set user properties ActionOffReadFull use
Delete users ActionOffReadFull use
Per-agent access, set in Bollard AI, not in Heap