CONNECT APP
Build with Amplitude
Data Analytics
- API key
MCP
Give your agent Amplitude tools
Every Amplitude action is exposed as an MCP tool on Pipedream's remote server. Point a client at it with your end user's ID and Connect resolves that user's Amplitude account for each tool call — you store no tokens.
// accessToken: mint a short-lived token with the Connect SDK — see the MCP guide
const transport = new StreamableHTTPClientTransport(
new URL("https://remote.mcp.pipedream.net/v3"),
{
requestInit: {
headers: {
Authorization: `Bearer ${accessToken}`,
"x-pd-project-id": "{project_id}",
"x-pd-environment": "production",
"x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
"x-pd-app-slug": "amplitude",
},
},
},
)
const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)
const { tools } = await mcp.listTools()
// e.g. run Create Cohort:
const result = await mcp.callTool({
name: "amplitude-create-cohort",
arguments: {
cohortName: "Name",
appId: 10,
},
})# access_token: mint a short-lived token with the Connect SDK — see the MCP guide
headers = {
"Authorization": f"Bearer {access_token}",
"x-pd-project-id": "{project_id}",
"x-pd-environment": "production",
"x-pd-external-user-id": "{external_user_id}", # any stable ID for this user in your system
"x-pd-app-slug": "amplitude",
}
async with streamablehttp_client("https://remote.mcp.pipedream.net/v3", headers=headers) as (read, write, _):
async with ClientSession(read, write) as session:
await session.initialize()
tools = await session.list_tools()
# e.g. run Create Cohort:
result = await session.call_tool("amplitude-create-cohort", {
"cohortName": "Name",
"appId": 10,
})API PROXY
Call the Amplitude API directly
For an endpoint with no pre-built tool, the Connect proxy forwards your request to the Amplitude API with the connected user's credentials attached. You store no tokens and write no refresh logic.
const resp = await pd.proxy.get({
externalUserId: "{external_user_id}", // any stable ID for this user in your system
accountId: "apn_xxxxxxx",
url: "https://api.example.com/v1/me",
})
// Any allowed Amplitude endpoint works here. Pipedream attaches the
// connected account's credentials to the outgoing request.# The path segment is the target URL, URL-safe base64 encoded:
# https://api.example.com/v1/me
curl "https://api.pipedream.com/v1/connect/{project_id}/proxy/aHR0cHM6Ly9hcGkuZXhhbXBsZS5jb20vdjEvbWU?external_user_id={external_user_id}&account_id=apn_xxxxxxx" \
-H "Authorization: Bearer {access_token}" \
-H "x-pd-environment: production"SDK
Run Amplitude actions from your backend
Connect a user's Amplitude account once, then run Create Cohort on their behalf from your own code — TypeScript, Python, or plain HTTP.
import { PipedreamClient } from "@pipedream/sdk"
const pd = new PipedreamClient({
projectId: process.env.PIPEDREAM_PROJECT_ID!,
clientId: process.env.PIPEDREAM_CLIENT_ID!,
clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
projectEnvironment: "production",
})
const result = await pd.actions.run({
id: "amplitude-create-cohort",
externalUserId: "{external_user_id}", // any stable ID for this user in your system
configuredProps: {
amplitude: { authProvisionId: "apn_xxxxxxx" },
cohortName: "Name",
appId: 10,
},
})from pipedream import Pipedream
pd = Pipedream(
client_id="{oauth_client_id}",
client_secret="{oauth_client_secret}",
project_id="{project_id}",
project_environment="production",
)
result = pd.actions.run(
id="amplitude-create-cohort",
external_user_id="{external_user_id}", # any stable ID for this user in your system
configured_props={
"amplitude": {"authProvisionId": "apn_xxxxxxx"},
"cohortName": "Name",
"appId": 10,
},
)curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
-H "Content-Type: application/json" \
-H "X-PD-Environment: production" \
-H "Authorization: Bearer {access_token}" \
-d '{
"external_user_id": "{external_user_id}",
"id": "amplitude-create-cohort",
"configured_props": {
"amplitude": { "authProvisionId": "apn_xxxxxxx" },
"cohortName": "Name",
"appId": 10
}
}'TOOLS
Amplitude actions
On-demand operations your product or agent can configure and run on behalf of a connected user.
-
Create Cohort
actionCreate a static cohort in Amplitude from an explicit list of user or Amplitude IDs viaPOST /api/3/cohorts/upload(the only REST-documented cohort creation endpoint; behavioral/dynamic cohorts cannot be created via REST). Use List Cohorts to find an existing cohort ID if updating. Example: call withcohortName="Power Users Q3",appId=849238,idType="BY_USER_ID",ids=["user@example.com"],owner="admin@example.com"-> returns{cohortId: "abc123"}. See the documentation.Writev0.0.2 -
Download Cohort File
actionDownload a completed cohort export's member list (step 3 of 3: request -> status -> download). Call Request Cohort Download then Get Cohort Download Status first, and only call this once status isJOB COMPLETED— calling it earlier will fail. Returns one record per member (amplitude_id/user_id, plus any requested user properties) — not the cohort's own metadata (name, size, definition); use List Cohorts for that. Example: call withrequestId="req_456"-> returns{requestId: "req_456", memberCount: 4200, returnedCount: 4200, truncated: false, members: [{amplitude_id: "123456789", user_id: "user@example.com"}, ...]}. See the documentation.Read-onlyv0.0.2 -
Get Cohort Download Status
actionCheck whether a cohort download job has finished (step 2 of 3: request -> status -> download). Call Request Cohort Download first to get arequestId. This action polls internally for up to ~35 seconds before returning, since Amplitude's export jobs commonly take 30-60+ seconds regardless of cohort size. If the returnedasync_statusis stillJOB INPROGRESS, call this action again with the same request ID (it may take a few calls) — do not call Download Cohort File untilasync_statusisJOB COMPLETED. Example: call withrequestId="req_456"-> returns{request_id: "req_456", cohort_id: "abc123", async_status: "JOB COMPLETED"}. See the documentation.Read-onlyv0.0.2 -
Get Event Segmentation
actionQuery event segmentation data (counts, uniques, and other metrics) for one or more events over a date range from the Amplitude Dashboard REST API. Use this to analyze how an event trends over time, optionally broken down by user properties. Example: call withevent={"event_type":"Purchase"},startDate="20240706",endDate="20240805",metric="uniques"-> returns{data: {xValues: ["2024-07-06", ...], series: [[42, 51, ...]]}}(one value per day per requested series). See the documentation.Read-onlyv0.0.2 -
Get Funnel Analysis
actionCompute conversion rates across an ordered (or unordered/sequential) set of funnel steps over a date range from the Amplitude Dashboard REST API. Provide one event definition per funnel step. Example: call withevents=["{\"event_type\":\"Sign Up\"}","{\"event_type\":\"Purchase\"}"],startDate="20240706",endDate="20240805"-> returns{data: [{stepByStep: [...], cumulative: [...], eventCount: 4200}, ...]}(one entry per step). See the documentation.Read-onlyv0.0.2 -
Get Retention Analysis
actionCompute retention (return rate) between a start event and a return event over a date range from the Amplitude Dashboard REST API. Example: call withstartEvent={"event_type":"_new"},returnEvent={"event_type":"_active"},startDate="20240706",endDate="20240805"-> returns{data: {series: [[...retention counts per interval...]], seriesLabels: [...]}}. See the documentation.Read-onlyv0.0.2 -
Get User Activity
actionFetch the event stream for a single user by their numeric Amplitude ID from the Amplitude Dashboard REST API. Each returned event defaults to just event_type and event_time; passfieldsto also get e.g.event_properties,user_properties,uuid,session_id,amplitude_id,device_id(event objects can carry many properties, so these stay opt-in). Amplitude's API caps each request at 1000 events with no cursor; this tool pagesoffsetforward automatically to collect up tolimitevents (set it above 1000, up to 5000, to fetch more than one page). Use Search Users first to resolve the Amplitude ID. Example: call withuser=12345678,limit=50-> returns{events: [{event_type: "Purchase", event_time: "2024-08-05 14:22:10"}, ...], userData: {...}, truncated: false}(truncated: truemeans more events likely exist beyond what was returned — raiselimit/offsetto fetch further). See the documentation.Read-onlyv0.0.2 -
List Cohorts
actionList all behavioral cohorts in the Amplitude project. Returns acohortsarray; each entry defaults to id, name, size, lastMod, appId. Passfieldsto get more, e.g.description,published,archived, or the largedefinition(the cohort's filter logic) /owners/viewers(email arrays). Use this to discover valid cohort IDs for Request Cohort Download (step 1 of 3, followed by Get Cohort Download Status and Download Cohort File, to fetch a cohort's member list). Example: call with no parameters -> returns{cohorts: [{id: "abc123", name: "Power Users Q3", size: 4200, lastMod: 1722873600000, appId: 849238}, ...]}. See the documentation.Read-onlyv0.0.2 -
Request Cohort Download
actionStart a behavioral cohort download job (step 1 of 3: request -> status -> download, per Amplitude's Behavioral Cohorts Download API). Returns arequest_id— pass it to Get Cohort Download Status to poll until the job completes, then to Download Cohort File to fetch the member list. Use List Cohorts first to discover valid cohort IDs. Example: call withcohortId="abc123"-> returns{request_id: "req_456", cohort_id: "abc123"}. See the documentation.Writev0.0.2 -
Search Users
actionLook up Amplitude users by Amplitude ID, Device ID, User ID, or a User ID prefix. Use this before Get User Activity to resolve a user'samplitude_id. Example: call withuser="user@example.com"-> returns{matches: [{amplitude_id: 12345678, user_id: "user@example.com"}], type: "user_id"}. See the documentation.Read-onlyv0.0.2 -
Send Event Data
actionRecord a single analytics event for a user or device via Amplitude's HTTP V2 API. Use this to send product-usage events (page views, feature use, purchases) as they happen, rather than the read-only Dashboard REST actions in this app (e.g. Get Event Segmentation, Get Retention Analysis), which only read existing data back. Identify the user withuserIdand/ordeviceId— Amplitude requires at least one. Example: call withuserId="user_123",eventType="Purchase",eventProperties={"item":"Pro Plan","price":29.99}-> returns{code: 200, events_ingested: 1, payload_size_bytes: 148, server_upload_time: 1722873600000}. See the documentationWritev0.1.1
EVENTS
Amplitude triggers
Event sources your backend can deploy for users and receive through a webhook.
No Amplitude triggers are available yet.
MULTI-APP
Use Amplitude with other popular apps
Most products don't stop at one integration. Pair Amplitude with the other apps your users rely on, and ship use cases that span both.
- App slug
- amplitude
- Authentication
- API key
- Categories
- Data Analytics
- Actions
- 11
- Triggers
- 0
- API proxy
- Available