# Segment Identify

> Segment analytics identify call with user traits and context.

- Name: `segment-identify`
- Categories: analytics
- Detail page: https://open-types.dev/types/segment-identify

## Install

```bash
# Types only
npx shadcn add @open-types/segment-identify

# Types + Zod v4 validators
npx shadcn add @open-types/segment-identify-zod

# Types + real-world examples
npx shadcn add @open-types/segment-identify-examples
```

## Types

```typescript
export interface SegmentIdentifyCall {
  userId?: string;
  anonymousId?: string;
  traits?: Record<string, unknown>;
  context?: Record<string, unknown>;
  timestamp?: string;
  integrations?: Record<string, boolean>;
}
```

## Zod validator

```typescript
import * as z from "zod";
import type { SegmentIdentifyCall } from "../types/segment-identify";

export const segmentIdentifyCallSchema = z.object({
  userId: z.string().optional(),
  anonymousId: z.string().optional(),
  traits: z.record(z.string(), z.unknown()).optional(),
  context: z.record(z.string(), z.unknown()).optional(),
  timestamp: z.iso.datetime({ error: "Invalid timestamp" }).optional(),
  integrations: z.record(z.string(), z.boolean()).optional(),
}) satisfies z.ZodType<SegmentIdentifyCall>;

export type { SegmentIdentifyCall } from "../types/segment-identify";
```

## Examples

```typescript
// Source: https://segment.com/docs/connections/spec/identify/
// Captured: 2026-05
import type { SegmentIdentifyCall } from "../types/segment-identify";

const identified = {
  userId: "97980cfea0067",
  traits: {
    email: "jenny.rosen@example.com",
    name: "Jenny Rosen",
    plan: "pro",
    company: { name: "Open Types", industry: "Software" },
  },
  context: {
    ip: "203.0.113.42",
    library: { name: "analytics.js", version: "5.10.0" },
  },
  timestamp: "2026-04-13T18:30:00.000Z",
  integrations: { All: true, Intercom: true, Salesforce: false },
} as const satisfies SegmentIdentifyCall;

export const segmentIdentifyCallExamples = {
  identified,
  anonymous: {
    anonymousId: "anon_1234567890",
    traits: { email: "lead@example.com" },
  } satisfies SegmentIdentifyCall,
  upgradePlan: {
    userId: "user_777",
    traits: { plan: "team", upgraded_at: "2026-04-13T18:30:00.000Z" },
    integrations: { All: false, Webhook: true },
  } satisfies SegmentIdentifyCall,
  minimal: { userId: "user_321" } satisfies SegmentIdentifyCall,
  aliasFromAnon: {
    userId: "user_321",
    anonymousId: "anon_1234567890",
    traits: { email: "linked@example.com" },
  } satisfies SegmentIdentifyCall,
} as const;
```
