canonical: https://jentic.com/apis/segment.com/segment

# Segment API

Jentic publishes the only available OpenAPI specification for Segment API, keeping it validated and agent-ready. Configure and manage the customer data infrastructure that collects events from sources, routes them to destinations, and enforces data quality through tracking plans. The API provides programmatic control over sources, destinations, warehouses, tracking plans, functions, spaces, users, and audit logs - enabling teams to treat their data pipeline as code.

## For AI agents

Configure data collection sources, manage event routing destinations, enforce tracking plans, and audit customer data pipeline changes programmatically.

## Scope

Does not handle event analytics querying, dashboards, or visualization - use for data collection routing and pipeline configuration only.

## Capabilities

- Provision and configure event collection sources for web, mobile, and server-side applications
- Connect and manage destinations that receive routed event data from sources
- Define tracking plans that validate event schemas before data reaches destinations
- Query warehouse sync configurations for data lake and analytics database connections
- Deploy custom functions that transform or route events in-flight within the pipeline
- Retrieve audit event logs showing who changed pipeline configuration and when

## Use cases

### AI Agent Data Pipeline Management

AI agents configure and monitor Segment's customer data infrastructure programmatically - creating sources, connecting destinations, and deploying tracking plans without manual UI interaction. Through Jentic, an agent discovers the needed pipeline operation by intent, receives the schema, and executes configuration changes directly. This enables infrastructure-as-code patterns for data pipelines managed by automated systems.

Example prompt: Create a new JavaScript source via POST /sources, then connect a BigQuery destination via POST /destinations with the source ID

### Source and Destination Configuration

Programmatically create, list, and inspect event collection sources and their connected destinations. Sources represent data origins (websites, mobile apps, servers), while destinations are the tools that receive routed events (analytics platforms, warehouses, marketing tools). The API enables teams to manage hundreds of source-destination connections at scale without manual UI configuration.

Example prompt: GET all sources from /sources, then for the first source retrieve its connected destinations via GET /destinations

### Tracking Plan Governance

Enforce data quality by defining tracking plans that specify which events and properties are expected from each source. The tracking plans endpoint lets teams create plans, attach them to sources, and ensure that only validated events flow downstream. Invalid events can be blocked or flagged, preventing data quality issues from propagating to warehouses and analytics tools.

Example prompt: List all tracking plans via GET /tracking-plans, then create a new tracking plan via POST /tracking-plans with rules for 'page_viewed' and 'order_completed' events

### Data Pipeline Audit and Compliance

Query the audit events endpoint to track who made changes to pipeline configuration, when changes occurred, and what was modified. This supports compliance requirements, debugging pipeline issues by correlating config changes with data anomalies, and maintaining a full audit trail of workspace activity across all team members.

Example prompt: GET audit events from /audit-events for the last 7 days and return all configuration changes made to sources and destinations

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | /sources | List all configured event collection sources |
| POST | /sources | Create a new data collection source |
| GET | /destinations | List all configured event routing destinations |
| POST | /destinations | Connect a new destination to receive events |
| GET | /tracking-plans | List tracking plans for schema governance |
| POST | /tracking-plans | Create a new tracking plan with event rules |
| GET | /warehouses | List warehouse sync configurations |
| GET | /audit-events | Retrieve pipeline configuration audit logs |

## Key resources

- **Sources** — Create and list event collection sources for web, mobile, and server applications
- **Destinations** — Connect and manage tools that receive routed event data
- **Tracking Plans** — Define and enforce event schema validation rules
- **Warehouses** — Configure and monitor data warehouse sync connections
- **Functions** — Deploy custom transformation and routing logic within the pipeline
- **Spaces** — Manage identity resolution and user profile spaces
- **Users** — List workspace users and their access permissions
- **Audit Events** — Query the audit trail of pipeline configuration changes

## Why Jentic

- **Setup:** Wiring the Segment API by hand means obtaining its bearer workspace token, threading it onto every call, and building each source, destination, and tracking-plan request yourself. Through Jentic you install once, import Segment from the API Directory, store the token once, and your agent calls it.
- **Permission scoping:** The Segment API takes its new sources, destinations, and tracking plans in the request body rather than a resource in the URL path, so scope by operation: limit the agent to the operations it needs, such as listing sources or reading audit events, and leave destination or tracking-plan creation out unless you add them.
- **Credential handling:** Your Segment token is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'create an event source' or 'list destinations', and Jentic returns the matching Segment operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Mixpanel API** — Mixpanel receives events routed by Segment and provides product analytics querying capabilities
- **Amplitude API** — Amplitude is a common Segment destination for behavioral analytics and revenue reporting
- **Snowflake API** — Snowflake is a warehouse destination that stores raw events routed from Segment for SQL analysis
- **PostHog API** — PostHog offers built-in event collection alongside analytics, eliminating the need for a separate CDP layer

## FAQ

### Why is there no official OpenAPI spec for Segment API?

Segment does not publish an OpenAPI specification. Jentic generates and maintains this spec so that AI agents and developers can call Segment API via structured tooling. It is validated against the live API and kept up to date. Get started with Jentic One, the self-hosted execution layer.

### What authentication does the Segment API use?

The Segment API uses Bearer token authentication. You generate a Personal Access Token or workspace token from the Segment app and include it in the Authorization header as 'Bearer {token}'. Through Jentic, your token is stored encrypted in the credential vault and agents receive scoped access without the raw token entering their context.

### Can I create sources and destinations programmatically with the Segment API?

Yes. POST /sources creates a new event collection source (web, mobile, or server). POST /destinations connects a new tool to receive events from a source. Both endpoints accept configuration objects specifying the source/destination type and settings.

### What are the rate limits for the Segment API?

The Segment Config API allows up to 100 requests per second per workspace on business plans. Each endpoint returns rate limit headers (X-RateLimit-Limit, X-RateLimit-Remaining) so you can implement backoff logic. Read operations have higher limits than write operations.

### How do I enforce data quality with tracking plans through Jentic?

Search Jentic for 'enforce event schema validation' to discover the /tracking-plans operations. Create a tracking plan via POST /tracking-plans with event rules that specify required properties and types, then attach it to a source. Events that violate the plan can be blocked or flagged. Install with pip install jentic.

### Can I query audit logs for pipeline configuration changes?

Yes. The GET /audit-events endpoint returns a chronological log of all workspace changes including source creation, destination modification, user permission changes, and tracking plan updates. Filter by date range and event type to find specific changes.

### How do I deploy custom event transformation functions?

POST /functions creates a custom function that executes JavaScript code on events as they flow through the pipeline. Functions can filter PII, transform event shapes, or conditionally route events. GET /functions lists all deployed functions with their configuration and status.

### Can I limit what my agent is allowed to do with the Segment API?

Yes. Because you run Jentic One yourself, your own rules decide which Segment operations and credentials the agent may use, and since new sources, destinations, and tracking plans are defined in the request body rather than a URL path, you scope by operation. For a read-only pipeline audit you can allow just GET /sources, GET /destinations, and GET /audit-events while withholding POST /sources, POST /destinations, and POST /tracking-plans. Add the write operations only when the agent genuinely needs to create or connect resources.
