# PostHog integrations: feature flags and persons

> Create a feature flag, update a person and create an insight in PostHog. Connect PostHog to the rest of your data and analytics stack with Tray.ai.

**Canonical page:** https://tray.ai/connectors/posthog-integrations/
**Categories:** Data and analytics
**Connects through:** HTTP Connector

## Overview

PostHog is a product analytics platform that records how people use an app, with feature flags, experiments, session replays, and dashboards in one place. Tray.ai connects to PostHog through the HTTP Connector, so your workflows can call the PostHog API alongside the rest of your stack.

## Use cases

### Feature flags

Read, create, update, and delete feature flags in PostHog from any Tray.ai workflow. The PostHog API covers calls such as list feature flags and create a feature flag.

- List feature flags
- Create a feature flag
- Get a feature flag

### Persons

Read and update persons in PostHog from any Tray.ai workflow. The PostHog API covers calls such as list persons and get a person.

- List persons
- Get a person
- Update a person

### Insights

Read, create, update, and delete insights in PostHog from any Tray.ai workflow. The PostHog API covers calls such as list insights and create an insight.

- List insights
- Create an insight
- Get an insight

### Cohorts

Read, create, update, and delete cohorts in PostHog from any Tray.ai workflow. The PostHog API covers calls such as list cohorts and create a cohort.

- List cohorts
- Create a cohort
- Get a cohort

### Annotations

Read, create, update, and delete annotations in PostHog from any Tray.ai workflow. The PostHog API covers calls such as list annotations and create an annotation.

- List annotations
- Create an annotation
- Update an annotation

### Events

Work with events in PostHog from any Tray.ai workflow. The PostHog API covers calls such as capture an event and capture a batch of events.

- Capture an event
- Capture a batch of events

## Challenges Tray.ai solves

### Keeping PostHog credentials out of logs

A raw API call usually means pasting a key or token into the request, where it ends up in step inputs, logs, and screenshots.

**How Tray.ai helps:** Store PostHog credentials once as a Tray.ai authentication and reference them from the HTTP Connector. Tray.ai masks authentication values in logs, so the secret never shows up in a step's input or output.

### Going from the PostHog API docs to a working call

Translating an example request from API docs into a workflow step means copying the method, URL, headers, and body by hand.

**How Tray.ai helps:** Paste a cURL example from the PostHog API docs into the HTTP Connector and Tray.ai fills in the method, URL, headers, and body for you.

### Handling files and non-JSON responses

Not every API answers in JSON. Some return XML, files, or binary data, or expect a multipart upload.

**How Tray.ai helps:** The HTTP Connector parses JSON and XML responses, returns files you can pass to the next step, and sends multipart form data for uploads.

## Frequently asked questions

### Does Tray.ai connect to PostHog?

Yes. Tray.ai connects to PostHog through the HTTP Connector, which calls the PostHog API directly. Any call the PostHog API documents can run as a step in a Tray.ai workflow.

### How does Tray.ai authenticate with PostHog?

The PostHog API uses a bearer token and OAuth 2.0. You save it once as a Tray.ai authentication, and the HTTP Connector adds it to every request.

### Can I get a dedicated PostHog connector?

PostHog runs through the HTTP Connector rather than a dedicated connector. If your team wants one, the Tray.ai connector SDK can build a dedicated PostHog connector from the PostHog API.

## Learn more

- Intelligent Integration: https://tray.ai/platform/intelligent-ipaas/
- Merlin Agent Builder: https://tray.ai/platform/merlin-agent-builder/
- Agent Gateway for MCP: https://tray.ai/platform/agent-gateway/
- Book a demo: https://tray.ai/contact/
