Skip to main content
The Hightouch integration syncs usage rows from your warehouse, database or spreadsheet to Lago as billable events. Use it when usage already lives in a data source and you want Lago to rate it against a contract.

Prerequisites

In Lago:
  1. Create a Lago organization to manage your billing and invoicing.
  2. Create a billable metric to track the usage of your customers.
  3. Create a metered product on that metric, price it with a rate card, and add it to a plan.
  4. Create a customer and a contract for that customer.
In Hightouch:
  1. Create a Hightouch account.
  2. Create a data source (ideally, product usage of your customer).
  3. Create an HTTP Request destination.

Send usage from Hightouch to Lago

Create a data source

First, create a source in Hightouch:
  1. Navigate to the Sources tab.
  2. Add a new source.
  3. Choose and set up a data source available in Hightouch (a database, a warehouse or a spreadsheet, for instance).
Hightouch Sources tab listing available data sources

Hightouch Sources

Use the HTTP Request destination

Lago uses Hightouch’s HTTP Request destination to ingest usage:
  1. Go to the Destinations tab.
  2. Select the HTTP Request destination.
  3. Define your Headers. Lago requires Authorization (secret, Bearer __YOUR_API_KEY__) and Content-Type: application/json.
  4. Save the destination.
Hightouch HTTP Request destination with Authorization and Content-Type headers

Hightouch HTTP Request Destination

Create a sync

Go to the Syncs tab and create a new sync from your source to the HTTP Request destination.
  1. Configure when to trigger the event (row added, row deleted, row updated).
  2. Define POST as the HTTP method.
  3. Define the target URL: https://api.getlago.com/api/v2/events (or https://api.eu.getlago.com/api/v2/events for EU-hosted organizations).
  4. Send data as JSON and use the JSON editor.
  5. Define rate limits, if applicable.

Example JSON payload

You define the JSON payload sent to Lago. Hightouch supports the Liquid template language to insert variables from your source: "{{ row.variable }}", where variable is the column name in your source. The payload follows the events schema of POST /api/v2/events. Each event targets a contract through external_contract_id:
transaction_id and code are required. code must match a billable metric code. external_contract_id must match the external_id of the contract you bill. timestamp is a Unix timestamp in seconds and defaults to the request time. Adapt properties to your billable metric.

Test and activate your sync

Test the sync with a data sample. The event should appear in Lago’s events list, or through GET /api/v2/events. Once ready, activate the sync and define the periodic trigger.
Hightouch Test a row dialog before syncing a usage row to Lago

Hightouch Test Sync with Lago

Hightouch to Lago demo video

This video was recorded with the legacy v1 events payload. Its Hightouch setup steps still apply. Use the V2 URL and payload above.

Ingest usage

How events target a contract.

Ingest a batch of events

POST /api/v2/events/batch reference.