Mixpanel Service Accounts API

API for programmatically managing service accounts within your organization, including creating, deleting, listing service accounts, and managing their project memberships.

OpenAPI Specification

mixpanel-service-accounts-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Mixpanel Service Accounts API
  description: >-
    API for programmatically managing service accounts within your
    organization, including creating, deleting, listing service accounts,
    and managing their project memberships.
  version: '1.0'
  contact:
    name: Mixpanel Support
    email: [email protected]
    url: https://mixpanel.com/get-support
  termsOfService: https://mixpanel.com/legal/terms-of-use
externalDocs:
  description: Mixpanel Service Accounts API Documentation
  url: https://developer.mixpanel.com/reference/service-accounts-api
servers:
  - url: https://mixpanel.com/api/app
    description: Mixpanel US Data Residency
  - url: https://eu.mixpanel.com/api/app
    description: Mixpanel EU Data Residency
tags:
  - name: Project Memberships
    description: Manage service account project access
  - name: Service Accounts
    description: Manage service accounts for API access
security:
  - basicAuth: []
paths:
  /organizations/{organizationId}/service-accounts:
    get:
      operationId: listServiceAccounts
      summary: Mixpanel List service accounts
      description: >-
        Retrieve all service accounts within an organization.
      tags:
        - Service Accounts
      parameters:
        - $ref: '#/components/parameters/organizationId'
      responses:
        '200':
          description: List of service accounts
          content:
            application/json:
              schema:
                type: object
                properties:
                  results:
                    type: array
                    items:
                      $ref: '#/components/schemas/ServiceAccount'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden - insufficient organization permissions
    post:
      operationId: createServiceAccount
      summary: Mixpanel Create a service account
      description: >-
        Create a new service account within the organization. Returns
        the service account credentials including the secret which is
        only shown once.
      tags:
        - Service Accounts
      parameters:
        - $ref: '#/components/parameters/organizationId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateServiceAccountRequest'
      responses:
        '200':
          description: Service account created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceAccountWithSecret'
        '400':
          description: Invalid request
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
  /organizations/{organizationId}/service-accounts/{serviceAccountId}:
    get:
      operationId: getServiceAccount
      summary: Mixpanel Get service account
      description: >-
        Retrieve details of a specific service account.
      tags:
        - Service Accounts
      parameters:
        - $ref: '#/components/parameters/organizationId'
        - $ref: '#/components/parameters/serviceAccountId'
      responses:
        '200':
          description: Service account details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceAccount'
        '401':
          description: Unauthorized
        '404':
          description: Service account not found
    delete:
      operationId: deleteServiceAccount
      summary: Mixpanel Delete service account
      description: >-
        Delete a service account. This revokes all API access for
        the account immediately.
      tags:
        - Service Accounts
      parameters:
        - $ref: '#/components/parameters/organizationId'
        - $ref: '#/components/parameters/serviceAccountId'
      responses:
        '200':
          description: Service account deleted
        '401':
          description: Unauthorized
        '404':
          description: Service account not found
  /organizations/{organizationId}/service-accounts/{serviceAccountId}/projects:
    get:
      operationId: listServiceAccountProjects
      summary: Mixpanel List service account projects
      description: >-
        Retrieve the projects that a service account has access to.
      tags:
        - Project Memberships
      parameters:
        - $ref: '#/components/parameters/organizationId'
        - $ref: '#/components/parameters/serviceAccountId'
      responses:
        '200':
          description: List of project memberships
          content:
            application/json:
              schema:
                type: object
                properties:
                  results:
                    type: array
                    items:
                      $ref: '#/components/schemas/ProjectMembership'
        '401':
          description: Unauthorized
        '404':
          description: Service account not found
    post:
      operationId: addServiceAccountToProject
      summary: Mixpanel Add service account to project
      description: >-
        Grant a service account access to a project with a specified role.
      tags:
        - Project Memberships
      parameters:
        - $ref: '#/components/parameters/organizationId'
        - $ref: '#/components/parameters/serviceAccountId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - projectId
                - role
              properties:
                projectId:
                  type: integer
                  description: The project ID to grant access to
                role:
                  type: string
                  enum: [admin, analyst, consumer]
                  description: The role to assign
      responses:
        '200':
          description: Project membership added
        '400':
          description: Invalid request
        '401':
          description: Unauthorized
  /organizations/{organizationId}/service-accounts/{serviceAccountId}/projects/{projectId}:
    delete:
      operationId: removeServiceAccountFromProject
      summary: Mixpanel Remove service account from project
      description: >-
        Remove a service account's access to a specific project.
      tags:
        - Project Memberships
      parameters:
        - $ref: '#/components/parameters/organizationId'
        - $ref: '#/components/parameters/serviceAccountId'
        - name: projectId
          in: path
          required: true
          schema:
            type: integer
          description: The project ID to remove access from
      responses:
        '200':
          description: Project membership removed
        '401':
          description: Unauthorized
        '404':
          description: Membership not found
components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: >-
        Service account credentials for API authentication.
  parameters:
    organizationId:
      name: organizationId
      in: path
      required: true
      schema:
        type: integer
      description: The Mixpanel organization ID
    serviceAccountId:
      name: serviceAccountId
      in: path
      required: true
      schema:
        type: integer
      description: The service account ID
  schemas:
    ServiceAccount:
      type: object
      properties:
        id:
          type: integer
          description: Service account unique identifier
        name:
          type: string
          description: Service account display name
        username:
          type: string
          description: Service account username for basic auth
        organizationId:
          type: integer
          description: Parent organization ID
        createdAt:
          type: string
          format: date-time
          description: When the service account was created
    ServiceAccountWithSecret:
      allOf:
        - $ref: '#/components/schemas/ServiceAccount'
        - type: object
          properties:
            secret:
              type: string
              description: >-
                Service account secret (only returned once at creation).
                Store this securely.
    CreateServiceAccountRequest:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          description: Display name for the service account
    ProjectMembership:
      type: object
      properties:
        projectId:
          type: integer
          description: The project ID
        projectName:
          type: string
          description: The project name
        role:
          type: string
          enum: [admin, analyst, consumer]
          description: Role assigned to the service account