# Send Event Data — Amplitude

> Record 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…

- Key: `amplitude-send-event-data`
- Type: Action (Write)
- Version: 0.1.1
- App: Amplitude (`amplitude`) — https://pipedream.com/apps/amplitude.md
- This page (HTML): https://pipedream.com/apps/amplitude/actions/send-event-data
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/amplitude/actions/send-event-data/send-event-data.mjs

## Description

Record 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 with `userId` and/or `deviceId` — Amplitude requires at least one. Example: call with `userId="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 documentation](https://www.docs.developers.amplitude.com/analytics/apis/http-v2-api/#keys-for-the-event-argument)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `userId` | `string` | No | A unique identifier for a user. Amplitude requires either this or Device ID (or both) — omitting both fails the request. Example: user_123. |
| `deviceId` | `string` | No | A unique identifier for a device. Amplitude requires either this or User ID (or both) — omitting both fails the request. Example: device_abc123. |
| `eventType` | `string` | Yes | The type of event being sent. |
| `time` | `integer` | No | The time the event occurred in milliseconds since epoch. |
| `eventProperties` | `object` | No | A dictionary of key-value pairs that represent additional data to be sent along with the event. |
| `userProperties` | `object` | No | A dictionary of key-value pairs that represent additional data tied to the user. |
| `groups` | `object` | No | Dictionary of key-value pairs that represent groups to associate with the user. |
| `groupProperties` | `object` | No | Dictionary of key-value pairs that represent additional data tied to the groups. |
| `skipUserPropertiesSync` | `boolean` | No | If true, user property operations in the same event are not applied to the user. |
| `appVersion` | `string` | No | The version of the application. |
| `platform` | `string` | No | The platform the user is on. |
| `osName` | `string` | No | The name of the operating system the user is using. |
| `osVersion` | `string` | No | The version of the operating system the user is using. |
| `deviceBrand` | `string` | No | The brand of the device the user is using. |
| `deviceManufacturer` | `string` | No | The manufacturer of the device the user is using. |
| `deviceModel` | `string` | No | The model of the device the user is using. |
| `carrier` | `string` | No | The carrier the user is using. |
| `country` | `string` | No | The country of the user. |
| `region` | `string` | No | The region of the user. |
| `city` | `string` | No | The city of the user. |
| `dma` | `string` | No | The designated market area of the user. |
| `language` | `string` | No | The language set by the user. |
| `price` | `string` | No | The price of the product. |
| `quantity` | `integer` | No | The quantity of the product. |
| `revenue` | `string` | No | The revenue from the product. |
| `productId` | `string` | No | The ID of the product. |
| `revenueType` | `string` | No | The type of revenue. |
| `locationLat` | `string` | No | The latitude of the user's location. |
| `locationLng` | `string` | No | The longitude of the user's location. |
| `ip` | `string` | No | The IP address of the user. |
| `idfa` | `string` | No | Identifier for Advertisers. |
| `idfv` | `string` | No | Identifier for Vendors. |
| `adid` | `string` | No | Google Play Advertising ID. |
| `androidId` | `string` | No | Android ID. |
| `eventId` | `integer` | No | A unique identifier for the event. |
| `sessionId` | `integer` | No | A unique identifier for the session. |
| `insertId` | `string` | No | A unique identifier for the event that is used for deduplication. |
| `plan` | `object` | No | Dictionary of key-value pairs that represent the plan. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
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 accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_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()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "amplitude-send-event-data",
  arguments: {
    userId: "User ID",
    deviceId: "Device ID",
  },
})
```

**TypeScript**

```ts
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-send-event-data",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    amplitude: { authProvisionId: "apn_xxxxxxx" },
    userId: "User ID",
    deviceId: "Device ID",
  },
})

console.log(result)
```

**cURL**

```bash
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-send-event-data",
    "configured_props": {
      "amplitude": { "authProvisionId": "apn_xxxxxxx" },
      "userId": "User ID",
      "deviceId": "Device ID"
    }
  }'
```

---

- App: https://pipedream.com/apps/amplitude.md · All apps: https://pipedream.com/apps
