# Kable Destination

## Destination Info

* Accepts [Track](/docs/segment/connections/spec/track) calls.
* Refer to it as **Kable** in the [Integrations object.](/docs/segment/guides/filtering-data/#filtering-with-the-integrations-object)
* This integration is **partner owned.** Please reach out to the partner's support for any issues.

[Kable](https://kable.io/?utm_source=segmentio\&utm_medium=docs\&utm_campaign=partners) helps API companies launch and grow their business with easy-to-use billing infrastructure and analytics tools that work at any scale.

The fastest-growing API companies trust Kable to automate their revenue operations, improve their developer experience, and empower their product leaders to iterate on pricing and packaging without limitations or bottlenecks.

This Segment destination is maintained by Kable. For any questions or issues, please [contact Kable Support](mailto:contact@kable.io).

## Getting Started

1. From the Segment web app, click **Catalog** then **Destinations**.
2. Search for **Kable** in the Destinations Catalog, and select **Kable**.
3. Click **Configure Kable**.
4. Choose which Source(s) should send data to Kable, and add a name for your Kable Segment Destination.
5. Configure your Segment Connection Settings:
   * Add your **Kable Client ID** and **Kable API Key**. (You can find your Kable Client ID and API Keys in the [Company tab](https://dashboard.kable.io/company) of your Kable dashboard.)
   * Specify which Segment event field corresponds to your customer's **Client ID** on Kable.
   * Map any other Segment event `properties` to Kable event fields.

| Setting             | Description                                                                                                        | Example                                        |
| ------------------- | ------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------- |
| API Key             | Your Kable API Key                                                                                                 | `sk_test.h6kVNO3I...`                          |
| Kable Client ID     | Your Kable Client ID                                                                                               | `kci_3c90e9ac92c6...`                          |
| Client ID Field     | The field from your Segment events that corresponds to your customer's `clientId` on Kable.                        | `userId`                                       |
| Properties Mappings | Map fields from Segment event `properties` to fields in Kable event `data`. Use dot notation to map nested fields. | `segmentX : kableX` `nested.field : dimension` |

## Supported methods

Kable supports Segment [Track](/docs/segment/connections/spec/track) calls to capture usage metrics from your API. Learn more about Segment Track calls in the [Segment Spec](/docs/segment/connections/spec).

### Track

Send [Track](/docs/segment/connections/spec/track) calls to Segment to record [usage events](https://docs.kable.io/docs/usage-events) in Kable. For example:

```js
analytics.track({
  event: "your_event_type",
  userId: "yourcompanyuser_1234567890",
  properties: {
    segmentX: "important data point",
    messageId: "msg_ABC123XYZ456", 
    objectCount: 12, 
    bankAccountBalance: 399.99,
  }
});
```

The Segment Track event above would be transformed and transmitted to Kable as:

```bash
curl --request POST \
     --url https://live.kable.io/api/v1/events/create \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json' \
     --header 'Kable-Client-ID: <YOUR_KABLE_CLIENT_ID>' \
     --header 'Kable-Client-Secret: <YOUR_KABLE_CLIENT_SECRET>' \
     --data '
{
  "clientId": "messageId",
  "timestamp": "2022-01-09T09:32:01Z", # Segment timestamp
  "transactionId": "022bb90c-bbac-11e4-8dfc-aa07a5b093db", # Segment messageId
  "data": {
    "kableX": "important data point", # notice the property mapping here from the example above
    "messageId": "msg_ABC123XYZ456", 
    "objectCount": 12, 
    "bankAccountBalance": 399.99
  }
}
```

## Engage

You can send computed traits and audiences generated using [Engage](/docs/segment/engage) to this destination as a **user property**. To learn more about Engage, schedule a [demo](https://segment.com/contact/demo).

For user-property destinations, an [identify](/docs/segment/connections/spec/identify/) call is sent to the destination for each user being added and removed. The property name is the snake\_cased version of the audience name, with a true/false value to indicate membership. For example, when a user first completes an order in the last 30 days, Engage sends an Identify call with the property `order_completed_last_30days: true`. When the user no longer satisfies this condition (for example, it's been more than 30 days since their last order), Engage sets that value to `false`.

When you first create an audience, Engage sends an Identify call for every user in that audience. Later audience syncs only send updates for users whose membership has changed since the last sync.

> \[!NOTE]
>
> Real-time audience syncs to Kable  may take six or more hours for the initial sync to complete. Upon completion, a sync frequency of two to three hours is expected.

## Settings

Segment lets you change these destination settings from the Segment app without having to touch any code.

| Field               | Description                                                                                                                                                                  | Required | Type     |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------- |
| API Key             | Your Kable API Keys can be found on the Company page of your Kable Dashboard. (Note that you have distinct keys for Live and Test environments.)                             | Yes      | string   |
| Client ID Field     | The field from your Segment events that corresponds to your Kable customer's Client ID (by default, Kable uses Segment's userId). For nested JSON fields, use dot notation.  | No       | string   |
| Kable Client ID     | Your Kable Client ID can be found on the Company page of your Kable Dashboard.                                                                                               | Yes      | string   |
| Properties Mappings | Optionally modify the mapping of fields from Segment event properties to Kable event data.                                                                                   | No       | text-map |
