View as Markdown
Amplitude icon

Amplitude ACTION

Get Event Segmentation

Query 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 with event={"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.
  • Action
  • Read only
  • API key
  • SDK
  • MCP

IMPLEMENTATION

Call this tool

Connect a user's Amplitude account once, then configure and run Get Event Segmentation from your backend or agent.

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-get-event-segmentation",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    amplitude: { authProvisionId: "apn_xxxxxxx" },
    event: "Event",
    startDate: "Start Date",
  },
})

console.log(result)

SCHEMA

Inputs

Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.

Get Event Segmentation inputs
Property Type Description
event Event string
A single JSON-encoded event definition (the e param). event_type is required; filters and group_by are optional. Use a real event name from your project (e.g. Purchase, Sign Up), or Amplitude's built-in _active/_new events to query overall activity. Example: {"event_type":"_active"} (Amplitude's built-in "any active event" — do NOT use the literal string "Any Active Event", which is Amplitude UI label text, not a valid event_type value, and returns a 400).
Required
startDate Start Date string
Start date, inclusive, in YYYYMMDD format (the start param). Example: 20240706.
Required
endDate End Date string
End date, inclusive, in YYYYMMDD format (the end param). Example: 20240805.
Required
metric Metric string
Metric to compute (the m param). One of: uniques, totals, pct_dau, average, histogram, sums, value_avg, formula. Defaults to uniques.
Optional
interval Interval integer
Time interval (the i param). One of -300000 (realtime), -3600000 (hourly), 1 (daily), 7 (weekly), 30 (monthly). Defaults to 1.
Optional
segmentDefinitions Segment Definitions string
JSON-encoded array of segment definitions (the s param). Example: [{"prop":"country","op":"is","values":["US"]}].
Optional
groupBy Group By string
A user or event property name to group results by (the g param).
Optional
groupBy2 Group By 2 string
A second property name to group results by (the g2 param). Only used together with Group By.
Optional
secondEvent Second Event string
A second JSON-encoded event definition (the e2 param) for a derived/comparison metric. Example: {"event_type":"Purchase"}.
Optional
limit Limit integer
Maximum number of grouped values to return (the limit param). Min 1, max 1000. Defaults to 100. Amplitude has no cursor for this endpoint — values beyond this cap are silently dropped by the API, not just this tool. If more than limit distinct group-by values may exist, raise this toward 1000 or narrow with Segment Definitions/Group By.
Optional
formula Formula string
Custom formula metric expression (the formula param). Required if Metric is set to formula. Example: UNIQUES(A)/UNIQUES(B).
Optional

REFERENCE

Tool details

Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.

Registry key
amplitude-get-event-segmentation
Version
0.0.2
App
Amplitude
Authentication
API key
Read-only
Yes
Destructive
No
Open world
Yes