> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://contentful.com/developers/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://contentful.com/developers/docs/_mcp/server.

# Node.js SDK

> Access the Experience API within Node.js.

The Node.js SDK enables you to interact easily format and send events to [Experience API endpoints](/personalization/experience-api) in Node.js run times.

The Node.js SDK exposes the `sendTrackEvent` and `sendIdentifyEvent` functions. These SDK methods automatically generate the event payloads necessary for the Experience API [batch upsert endpoint](/personalization/experience-api) as `track` and `identify` events, respectively.

This SDK is deigned for sending location-agnostic `track` and `identify` events server-side, typically as part of bulk import processes or within serverless functions. The batch endpoint is used because it does not attempt to resolve the request's location.

A `page` function is purposely not exposed. For ESR/SSR use cases where `page` events may need to be sent and/or request location may need to be resolved, consider using the [Shared SDK](/personalization/shared-sdk).

```typescript
import { NinetailedAPIClient } from "@ninetailed/experience.js-node";

const apiClient = new NinetailedAPIClient({
  clientId: "YOUR_API_KEY"
  environment: "YOUR_NINETAILED_ENV"
})

apiClient.sendTrackEvent(
    id: string,
    event: name, 
    properties?: JsonObject, // A JSON object of arbitrary key:value pairs
    options?: {
        anonymousId?: string,
        timestamp?: number,
        timeout?: number | undefined // Default: 5000
    }
)

apiClient.sendIdentifyEvent(
    id: string,
    traits: Traits, // A JSON object of arbitrary key:value pairs
    options?: {
        anonymousId?: string,
        timestamp?: number,
        timeout?: number | undefined // Default: 5000
    }
)

apiClient.getProfile(
    id: string,
    options?: {
        timeout?: number | undefined // Default: 5000
    }
)
```