Mixpanel Identity API

Manage user identity resolution and merging

OpenAPI Specification

mixpanel-identity-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Mixpanel Annotations Identity API
  description: API for creating, retrieving, updating, and deleting annotations that label specific points in time on Mixpanel charts with descriptions, useful for marking product launches, campaigns, or data anomalies.
  version: '1.0'
  contact:
    name: Mixpanel Support
    email: support@mixpanel.com
    url: https://mixpanel.com/get-support
  termsOfService: https://mixpanel.com/legal/terms-of-use
servers:
- url: https://mixpanel.com/api/app
  description: Mixpanel US Data Residency
- url: https://eu.mixpanel.com/api/app
  description: Mixpanel EU Data Residency
security:
- basicAuth: []
tags:
- name: Identity
  description: Manage user identity resolution and merging
paths:
  /identity/create:
    post:
      operationId: createIdentity
      summary: Mixpanel Create identity
      description: Create an identity mapping between an anonymous (device) ID and an identified (user) ID. This links pre-login anonymous activity to a known user.
      tags:
      - Identity
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - $identified_id
              - $anon_id
              - $token
              properties:
                $identified_id:
                  type: string
                  description: The known user ID (e.g., user ID from your database)
                $anon_id:
                  type: string
                  description: The anonymous device ID to link
                $token:
                  type: string
                  description: Mixpanel project token
      responses:
        '200':
          description: Identity created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdentityResponse'
        '400':
          description: Invalid request
        '401':
          description: Unauthorized
        '429':
          description: Rate limit exceeded
  /identity/create-alias:
    post:
      operationId: createAlias
      summary: Mixpanel Create alias
      description: Create an alias that maps one distinct_id to another. This is a legacy method for identity management. For new implementations, use the create identity endpoint with ID merge instead.
      tags:
      - Identity
      deprecated: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - alias
              - distinct_id
              - $token
              properties:
                alias:
                  type: string
                  description: The new alias to create
                distinct_id:
                  type: string
                  description: The existing distinct_id to link
                $token:
                  type: string
                  description: Mixpanel project token
      responses:
        '200':
          description: Alias created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdentityResponse'
        '400':
          description: Invalid request
        '401':
          description: Unauthorized
        '429':
          description: Rate limit exceeded
  /identity/merge:
    post:
      operationId: mergeIdentities
      summary: Mixpanel Merge identities
      description: Merge two distinct_id values into a single identity cluster. All events and profile data associated with both IDs will be combined. This operation is irreversible.
      tags:
      - Identity
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - $distinct_ids
              - $token
              properties:
                $distinct_ids:
                  type: array
                  items:
                    type: string
                  minItems: 2
                  maxItems: 2
                  description: Array of two distinct_ids to merge
                $token:
                  type: string
                  description: Mixpanel project token
      responses:
        '200':
          description: Identities merged successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdentityResponse'
        '400':
          description: Invalid request
        '401':
          description: Unauthorized
        '429':
          description: Rate limit exceeded
components:
  schemas:
    IdentityResponse:
      type: object
      properties:
        status:
          type: integer
          enum:
          - 0
          - 1
          description: 1 for success, 0 for failure
        error:
          type: string
          description: Error message if status is 0
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: Service account credentials for API authentication.
externalDocs:
  description: Mixpanel Annotations API Documentation
  url: https://developer.mixpanel.com/reference/create-annotation