segment Batch API

Operations for sending multiple calls in a single request.

Operations 1

POST /batch Send a batch of events #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/segment-batch-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

segment-batch-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Segment HTTP Tracking Batch API
  description: The Segment HTTP Tracking API enables developers to record analytics data from any website or application by sending HTTP requests directly to Segment servers. It supports identify, track, page, screen, group, alias, and batch calls, and Segment routes the collected data to configured destinations. The API accepts batch requests up to 500 KB and requires each payload to include a userId or anonymousId. It is a server-side alternative to Segment's client-side SDKs.
  version: 1.0.0
  contact:
    name: Segment Support
    url: https://segment.com/help/
  termsOfService: https://segment.com/legal/terms/
servers:
- url: https://api.segment.io/v1
  description: Production Server (US)
- url: https://events.eu1.segmentapis.com/v1
  description: Production Server (EU)
security:
- basicAuth: []
tags:
- name: Batch
  description: Operations for sending multiple calls in a single request.
paths:
  /batch:
    post:
      operationId: batch
      summary: Send a batch of events
      description: Sends multiple identify, track, page, screen, group, and alias calls in a single request. The batch endpoint accepts up to 500 KB per request and a maximum of 2500 events per batch. Each individual event must be less than 32 KB.
      tags:
      - Batch
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchCall'
      responses:
        '200':
          description: Batch accepted successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse'
        '400':
          description: Invalid request payload.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Invalid or missing write key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    Integrations:
      type: object
      description: Dictionary of destinations to enable or disable. Pass a destination name as key and true/false as the value to control which destinations receive the data.
      additionalProperties:
        oneOf:
        - type: boolean
        - type: object
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          description: Always false for error responses.
        message:
          type: string
          description: A human-readable error message.
    Context:
      type: object
      description: Dictionary of extra context for the call. Context is a dictionary of extra information that provides useful context about a data point, such as the user's IP address, locale, or device information.
      properties:
        active:
          type: boolean
          description: Whether the user is active.
        ip:
          type: string
          description: The IP address of the user.
        locale:
          type: string
          description: The locale string for the user.
        userAgent:
          type: string
          description: The user agent string of the client.
        library:
          type: object
          description: Information about the library making the call.
          properties:
            name:
              type: string
              description: The name of the library.
            version:
              type: string
              description: The version of the library.
        page:
          type: object
          description: Information about the current page.
          properties:
            path:
              type: string
              description: The path of the page.
            referrer:
              type: string
              format: uri
              description: The referrer URL.
            search:
              type: string
              description: The search query string.
            title:
              type: string
              description: The page title.
            url:
              type: string
              format: uri
              description: The full URL of the page.
        device:
          type: object
          description: Information about the user's device.
          properties:
            id:
              type: string
              description: The device ID.
            manufacturer:
              type: string
              description: The device manufacturer.
            model:
              type: string
              description: The device model.
            name:
              type: string
              description: The device name.
            type:
              type: string
              description: The device type.
    BatchCall:
      type: object
      required:
      - batch
      description: A batch call sends multiple events in a single request.
      properties:
        batch:
          type: array
          description: An array of identify, track, page, screen, group, or alias call objects. Maximum 2500 events per batch. Each event must be less than 32 KB.
          maxItems: 2500
          items:
            type: object
            required:
            - type
            properties:
              type:
                type: string
                description: The type of call.
                enum:
                - identify
                - track
                - page
                - screen
                - group
                - alias
              userId:
                type: string
                description: Unique identifier for the user.
              anonymousId:
                type: string
                description: A pseudo-unique substitute for a user ID.
              event:
                type: string
                description: Event name, required for track calls.
              properties:
                type: object
                description: Event or page/screen properties.
                additionalProperties: true
              traits:
                type: object
                description: User or group traits.
                additionalProperties: true
              groupId:
                type: string
                description: Group ID, required for group calls.
              previousId:
                type: string
                description: Previous ID, required for alias calls.
              name:
                type: string
                description: Page or screen name.
              context:
                $ref: '#/components/schemas/Context'
              integrations:
                $ref: '#/components/schemas/Integrations'
              timestamp:
                type: string
                format: date-time
                description: ISO 8601 date string.
              messageId:
                type: string
                description: Unique identifier for the message.
        context:
          $ref: '#/components/schemas/Context'
        integrations:
          $ref: '#/components/schemas/Integrations'
    SuccessResponse:
      type: object
      properties:
        success:
          type: boolean
          description: Whether the request was accepted.
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: HTTP Basic authentication using the source write key as the username and an empty password. The write key is found in the Segment source settings.
externalDocs:
  description: Segment HTTP Tracking API Documentation
  url: https://segment.com/docs/connections/sources/catalog/libraries/server/http-api/