> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/integrations/catalog/heap.md).

# Heap

Send server-side events, user properties and account properties to Heap, and delete users, from StackAI workflows.

### Connectors

Choose the connector that matches your authentication method. The options below use the names shown in StackAI.

| Connector | Authentication |
| --------- | -------------- |
| Heap      | API Key        |

#### Heap

Connect to Heap to send server-side events, user and account properties, and to delete users.

**Set up in Heap**

1. Prepare the Heap account or service that the workflow will access. Grant access to the required resources and operations.
2. **API Key:** Generated by an admin under Account > Manage > Privacy & Security. It is used for user deletion and to verify this connection.

**Set up in StackAI**

1. Open **Settings → Connections**, add a connection, and select **Heap**.
2. Enter the credentials and connection details in the fields below.
3. Save the connection and check its connection status. Select this saved connection when configuring an action or feature that uses it.

**Connection fields**

| StackAI field | Required                 | What to enter                                                                                                                                                                                                                                                                                                                                           |
| ------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| App ID        | Yes                      | The environment ID of your Main Production environment, shown at the bottom of Account > Manage > Privacy & Security. It must be Main Production: Heap only verifies credentials and deletes users for that environment, and this connection is checked against it. [Provider instructions](https://heapanalytics.com/app/manage/privacy-and-security). |
| API Key       | Yes                      | Generated by an admin under Account > Manage > Privacy & Security. It is used for user deletion and to verify this connection. [Provider instructions](https://heapanalytics.com/app/manage/privacy-and-security).                                                                                                                                      |
| Region        | Optional / as applicable | 'us' (default) sends events and properties to heapanalytics.com; 'eu' sends them to c.eu.heap-api.com, which Heap requires when your data lives in the EU data center. User deletion always goes to heapanalytics.com, as Heap documents.                                                                                                               |

#### Verify the connection

Check that the connection is healthy. Then run a read operation against a resource the connected account can access. A successful connection check confirms authentication; it does not guarantee permission for every action.

If access is denied, check the credential or OAuth permissions, the selected account or environment, and access to the specific resource. Update expired credentials or reconnect after permissions change.

### Use an action

1. Add the required **Heap** action to the workflow.
2. Select a connection when the action requests one.
3. Complete the required fields. Use the reference picker when a value comes from another workflow step.
4. Run the workflow and inspect the action’s output. Check the result before using it in a later step.

### Actions

#### Track Event

Send a custom event for a user to Heap from your workflow.

**Inputs**

| Field           | Type     | Required | Description                                                  |
| --------------- | -------- | -------- | ------------------------------------------------------------ |
| Event name      | string   | Yes      | The name of the event as it should appear in Heap.           |
| Identity        | string   | No       | The identified user the event belongs to.                    |
| Heap user ID    | string   | No       | The numeric user id assigned by the Heap SDK.                |
| Properties      | object   | No       | Key-value details to attach to the event.                    |
| Timestamp       | datetime | No       | When the event happened. Defaults to now.                    |
| Idempotency key | string   | No       | A unique key so a repeated send does not create a duplicate. |
| Session ID      | string   | No       | Optional Heap session to attach the event to.                |

**Outputs**

| Field          | Type    | Description                                                     |
| -------------- | ------- | --------------------------------------------------------------- |
| Event name     | string  | The event name that was sent.                                   |
| Identity       | string  | The identity the event was attributed to, if one was given.     |
| Heap user ID   | string  | The Heap user id the event was attributed to, if one was given. |
| Property count | integer | How many properties were attached.                              |

#### Add User Properties

Set custom properties such as plan or sign-up date on a Heap user.

**Inputs**

| Field      | Type   | Required | Description                              |
| ---------- | ------ | -------- | ---------------------------------------- |
| Identity   | string | Yes      | The identified user to update.           |
| Properties | object | Yes      | Key-value properties to set on the user. |

**Outputs**

| Field          | Type          | Description                       |
| -------------- | ------------- | --------------------------------- |
| Identity       | string        | The user that was updated.        |
| Property names | string\_array | The property names that were set. |
| Property count | integer       | How many properties were set.     |

#### Bulk Import Users

Create or update up to 1000 Heap users with their properties in one call.

**Inputs**

| Field | Type          | Required | Description                                              |
| ----- | ------------- | -------- | -------------------------------------------------------- |
| Users | object\_array | Yes      | The users to create or update, each with its properties. |

**Outputs**

| Field          | Type          | Description                                  |
| -------------- | ------------- | -------------------------------------------- |
| Imported count | integer       | How many users were sent to Heap.            |
| Identities     | string\_array | The identities that were created or updated. |

#### Add Account Properties

Set account-level properties such as plan tier or owner on a Heap account.

**Inputs**

| Field      | Type   | Required | Description                                                        |
| ---------- | ------ | -------- | ------------------------------------------------------------------ |
| Account ID | string | Yes      | The account to update, as configured in Heap's Account ID setting. |
| Properties | object | Yes      | Key-value properties to set on the account.                        |

**Outputs**

| Field          | Type          | Description                       |
| -------------- | ------------- | --------------------------------- |
| Account ID     | string        | The account that was updated.     |
| Property names | string\_array | The property names that were set. |
| Property count | integer       | How many properties were set.     |

#### Delete User

Permanently delete a user and all their data from your Heap workspace.

**Inputs**

| Field        | Type   | Required | Description                                   |
| ------------ | ------ | -------- | --------------------------------------------- |
| Identity     | string | No       | The identified user to delete.                |
| Heap user ID | string | No       | The numeric user id assigned by the Heap SDK. |

**Outputs**

| Field               | Type   | Description                                         |
| ------------------- | ------ | --------------------------------------------------- |
| Deletion request ID | string | Heap's id for this deletion request.                |
| Status              | string | The request status, 'pending' when first submitted. |
| Status URL          | string | URL where the deletion status can be polled.        |

### Important behavior

Actions that create, update, send, or delete data can change the connected service. Review their inputs before running them. A retry can repeat an operation; consider this when configuring retries for actions that change data.

The catalog lists the fields and capabilities available in the supplied provider definition. Availability can also depend on your deployment and organization’s Feature Access settings.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/integrations/catalog/heap.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
