This guide walks through the basics of creating a cohort sync integration with Amplitude.
This doc uses a list-based integration in its examples. If you create a property-based cohort syn integration, some steps may be slightly different than you see here.
The first step is to configure the integration tile that appears on the Amplitude Destinations page after Amplitude has validated your integration. You also need to decide between a List-based cohort integration or a Property-based cohort integration. See this doc for more information.
This determines what users will see in the catalog page. Note that the name must be globally unique to all other cohort sync integrations.
The configuration page has two sections.
The next several sections walk through configuration and testing options.
The first step is determining how you plan to authenticate the API call between Amplitude and your company.
Click Custom Headers, choose from the following:
These fields collect and replace the $variable
declared in the payloads in the API calls, and build the modal customers use to enable your integration. Fields you add here are required fields when your users set up the integration.
$api_key
instead of $api-key
.Map fields to specify how Amplitude fields connect to the fields in your system. The value of the mapping replaces item_template
in the payloads.
user_id_field_amplitude
.You can slugify cohort names to standardize them. This is helpful if your system doesn't support special characters or foreign characters. This option converts your cohort name to a URL slug by replacing the Unicode special characters and spaces with ASCII and hyphens. This feature is only available when the variable $amplitude_cohort_name
appears in the payload of the endpoints. The slugify rule is as follows:
Saturday's cohort & héllo
to Saturday-s-cohort-he-llo
You need to call three different APIs for a list-based integration. The first one is the list creation endpoint. When a cohort syncs for the first time, Amplitude calls this API, and creates a list on your platform. Amplitude expects your app to send a response with the unique identifier for listID
. From that response, Amplitude stores the listID
uses the ID as part of the payload for list updates.
https://api.yourapp.com/list
. Choose which method to use in the call.
$
to find created variables easily.Add error status code and error messages for every endpoint so that end users can debug and get faster help.
Expand Error Classifications, and click Add New Error to add more status codes. Amplitude recommends including as many status codes and sub error codes as you need to. These codes and messages make debugging much faster for your end users.
Here are some common examples of status codes that most partners include:
Amplitude suggests giving a clear Failure Reason (Description) and Error Message in case cohort sync fails. Clear messages drastically improve your end user's experience and can help deflect support issues and frustration.
"This cohort sync has encountered an unidentified kind of error for this integration. Please contact support or your CSM to create a ticket and ask for help in solving this issue."
The add users API is called every time a cohort syncs from Amplitude to your app. This could be hourly or daily. This call calculates the difference in the current cohort size compared to the last successful sync.
URL Endpoint: There is a $list_Id
placeholder in the URL but it's not required. You can design your API to place this in the payload if you want, for example: https://your.domain/lists/$listId/add
.
API payload that to send to the destination: You can customize and define whether this payload is a batch. The important key here is the $items
variable. The contents of An array of items that replaces the $items variable in the payload replace this variable.
This $items
variable is usually the identifier for every user in a cohort. For example, there are 20 new users to add to your existing cohort. The Batch object contains a collection (a list of 20 users) so these 20 objects are sent to your endpoint. Your payload might look something like this:
{
"userIds": $items,
"context": {
"integration":{
"name": "Amplitude Cohort Sync",
"version": "1.0.0"
}
}
}
Maximum number of items in each API call (batch size): The default is 10,000, but you can specify this. Amplitude's recommendation is to have a 10,000 user per cohort batch.
An array of items that replaces the $items
variable in the payload: Specify the format of object that replaces the $item
variable in the payload. For example, "$user_id_field_amplitude"
.
Avoid rate limiting if possible. If you do have rate limits, for example, 90 requests per second, make the them explicit in your user documentation. Amplitude sends out 4 requests in parallel with each request having up to 10,000 users.
Instead of creating every single status code, failure reasons, error message, and sub error code again, Amplitude recommends using the same set of error codes from your list creation endpoint. Just select Copy errors from other endpoints and select an endpoint you've written errors for.
The remove users API is called every time a cohort syncs from Amplitude to your app. This could be hourly or daily. This call calculates the difference in the current cohort size compared to the last successful sync.
URL Endpoint: There is a $listId
placeholder in the URL but it's not required. You can design your API to place this in the payload if you want, for example: https://your.domain/lists/$listId/remove
.
API payload to send to the destination: You can customize and define whether this payload is a batch. The important key here is the $items
variable which is replaced by the contents of An array of items that replaces the $items variable in the payload
This $items
variable is usually the identifier for every user in a cohort. For example, there are 20 new users to remove from your existing cohort. The Batch object contains a collection (a list of 20 users) so these 20 objects are sent to your endpoint. Your payload might look something like this:
{
"userIds": $items,
"context": {
"integration":{
"name": "Amplitude Cohort Sync",
"version": "1.0.0"
}
}
}
Maximum number of items in each API call (batch size): The default is 10,000, but you can specify this. Amplitude's recommendation is to have a 10,000 user per cohort batch.
An array of items that replaces the $items
variable in the payload: Specify the format of object that replaces the $item
variable in the payload. For example, "$user_id_field_amplitude"
.
Instead of creating every single status code, failure reasons, error message, and sub error code again, Amplitude recommends using the same set of error codes from your list creation endpoint. Just select Copy errors from other endpoints and select an endpoint you've written errors for.
Before submitting your configuration for review, test the mock payload that you expect to receive from Amplitude. In Testing Tab, follow these steps to preview and test your configuration.
In the Testing tab, the Destination Settings is identical to what users of your integration will see. This form is used to control the parameters you have defined in the headers of the payload.
To generate users, you can upload a CSV or click regenerate which will generate users based on your configurations. The CSV must have an Operation column which must be either add or remove. Any parameters used in the List Creation payload must also be the same across all rows in the CSV. The CSV must also have columns for each of the parameters used.
Here is a sample CSV that can be used for the default configurations:
operation,user_id_field_amplitude,amp_cohort_name,amp_cohort_id
add,user123,Unified Cohort,unified_cohort_001
add,user456,Unified Cohort,unified_cohort_001
remove,user789,Unified Cohort,unified_cohort_001
add,john.doe@example.com,Unified Cohort,unified_cohort_001
Check the parameters table to make sure all variables are accounted for and resolve any errors. Ensure that all declared fields are non empty.
To modify the headers use the Destination Settings form which can be seen on both the Configuration and Testing tab.
Check your headers and payloads and when ready, click Test Endpoint to send a test API call to the predefined endpoint. You can also see the response/error for easy debugging.
After you click Test Endpoint, you should get a success response. Retrieve the $list_id
here and then Amplitude uses the $list_id
for the "Add Users Endpoint".
The {listId: $list_id}
is the expected response for list creation API call. To change the structure, change the Path to List ID in the response value in the list creation configuration.
Use the $list_id
you retrieved to test the add to add users and remove users endpoints.
You can also test end to end with the Test Endpoint button in the Test Integration section, which will automatically run all necessary tests.
To test in your org, click Release Internally. This enables anyone within your org to use the integration you defined. The integration should be instantly available once you do this.
After you have finalized your testing, click Submit to submit your integration to the Amplitude team. The review process should take about one week. When Amplitude approves you integration, you're notified via email and can see your integration tile in the Destination section of Amplitude.
June 17th, 2024
Need help? Contact Support
Visit Amplitude.com
Have a look at the Amplitude Blog
Learn more at Amplitude Academy
© 2025 Amplitude, Inc. All rights reserved. Amplitude is a registered trademark of Amplitude, Inc.