> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apsio.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Compare a cohort with the rest

> The sessions that match the cohort filters, against every other session of the same app (or project) that started in the time range (default: the last 7 days, at most 30). For each dimension, the values most over-represented in the cohort, ranked by the difference in share. At least one cohort filter is required; `app_id` only narrows the population. Shares computed from a few sessions are noisy: `min_sessions` (default 2) leaves out rarer values, and a small cohort deserves a higher one.



## OpenAPI

````yaml /api-reference/openapi.json get /projects/{projectId}/cohorts/compare
openapi: 3.1.0
info:
  title: Apsio API
  version: 0.1.0
  description: >-
    Read API v0: your projects, release health and comparisons, missing symbols,
    issues, sessions, vitals, cohort comparisons, performance (app start,
    screens, hangs, MetricKit) and network endpoints and traces for one project.
    Authenticate with a project token as a bearer token, with an OAuth access
    token from Apsio's authorization server (MCP clients), or, from the console,
    with the session cookie of a member of the project's organization.
servers:
  - url: https://api.apsio.io/v1
security: []
paths:
  /projects/{projectId}/cohorts/compare:
    get:
      summary: Compare a cohort with the rest
      description: >-
        The sessions that match the cohort filters, against every other session
        of the same app (or project) that started in the time range (default:
        the last 7 days, at most 30). For each dimension, the values most
        over-represented in the cohort, ranked by the difference in share. At
        least one cohort filter is required; `app_id` only narrows the
        population. Shares computed from a few sessions are noisy:
        `min_sessions` (default 2) leaves out rarer values, and a small cohort
        deserves a higher one.
      parameters:
        - schema:
            type: string
            pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
            example: 0192f3a4-0000-7000-8000-00000000a101
          required: true
          name: projectId
          in: path
        - schema:
            type: string
            format: date-time
            description: >-
              Start of the time range, inclusive (RFC 3339). Defaults to the
              range end minus the default length.
            example: '2026-10-01T00:00:00Z'
          required: false
          description: >-
            Start of the time range, inclusive (RFC 3339). Defaults to the range
            end minus the default length.
          name: from
          in: query
        - schema:
            type: string
            format: date-time
            description: End of the time range, exclusive (RFC 3339). Defaults to now.
            example: '2026-10-08T00:00:00Z'
          required: false
          description: End of the time range, exclusive (RFC 3339). Defaults to now.
          name: to
          in: query
        - schema:
            type: string
            pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
            description: Only this app.
          required: false
          description: Only this app.
          name: app_id
          in: query
        - schema:
            type: string
            maxLength: 128
            description: Only this release.
          required: false
          description: Only this release.
          name: release
          in: query
        - schema:
            type: string
            enum:
              - crashed
              - abnormal_exit
              - ok
            description: >-
              `crashed`, `abnormal_exit`, or `ok` (every session that neither
              crashed nor ended abnormally).
          required: false
          description: >-
            `crashed`, `abnormal_exit`, or `ok` (every session that neither
            crashed nor ended abnormally).
          name: outcome
          in: query
        - schema:
            type: string
            maxLength: 128
            description: device.model.identifier, exactly.
            example: iPhone17,1
          required: false
          description: device.model.identifier, exactly.
          name: device_model
          in: query
        - schema:
            type: string
            maxLength: 64
            description: os.version, exactly.
          required: false
          description: os.version, exactly.
          name: os_version
          in: query
        - schema:
            type: string
            enum:
              - 'true'
              - 'false'
            description: Only sessions with (true) or without (false) handled errors.
          required: false
          description: Only sessions with (true) or without (false) handled errors.
          name: has_error
          in: query
        - schema:
            type: string
            pattern: ^[A-Za-z0-9._:-]{1,128}$
            description: Only sessions with an occurrence of this issue in the time range.
          required: false
          description: Only sessions with an occurrence of this issue in the time range.
          name: issue_id
          in: query
        - schema:
            type: string
            pattern: ^[A-Z_]{1,16}$
            description: 'With endpoint_host and endpoint_template: one network endpoint.'
          required: false
          description: 'With endpoint_host and endpoint_template: one network endpoint.'
          name: endpoint_method
          in: query
        - schema:
            type: string
            maxLength: 255
          required: false
          name: endpoint_host
          in: query
        - schema:
            type: string
            maxLength: 256
            description: >-
              Only sessions with a request to this endpoint in the time range
              (/network/endpoints lists them).
          required: false
          description: >-
            Only sessions with a request to this endpoint in the time range
            (/network/endpoints lists them).
          name: endpoint_template
          in: query
        - schema:
            type: string
            enum:
              - 'true'
              - 'false'
            description: >-
              With the endpoint: only sessions where a request to it failed (5xx
              or no response).
          required: false
          description: >-
            With the endpoint: only sessions where a request to it failed (5xx
            or no response).
          name: endpoint_failed
          in: query
        - schema:
            type: string
            minLength: 1
            maxLength: 256
            description: >-
              Only sessions that loaded this screen (app.screen.name) in the
              time range.
          required: false
          description: >-
            Only sessions that loaded this screen (app.screen.name) in the time
            range.
          name: screen
          in: query
        - schema:
            type:
              - integer
              - 'null'
            minimum: 0
            maximum: 600000
            description: >-
              With screen: only loads of it with a TTID of at least this many
              milliseconds.
          required: false
          description: >-
            With screen: only loads of it with a TTID of at least this many
            milliseconds.
          name: min_ttid_ms
          in: query
        - schema:
            type: string
            maxLength: 200
            description: >-
              Comma-separated, from device_model, os_version, release, country,
              feature_flag, network_type. Default: all.
            example: device_model,os_version
          required: false
          description: >-
            Comma-separated, from device_model, os_version, release, country,
            feature_flag, network_type. Default: all.
          name: dimensions
          in: query
        - schema:
            type: integer
            minimum: 1
            maximum: 20
            default: 5
            description: Values per dimension, 1 to 20.
          required: false
          description: Values per dimension, 1 to 20.
          name: limit
          in: query
        - schema:
            type: integer
            minimum: 1
            maximum: 1000
            default: 2
            description: Leave out values with fewer cohort sessions than this.
          required: false
          description: Leave out values with fewer cohort sessions than this.
          name: min_sessions
          in: query
      responses:
        '200':
          description: The over-represented values per dimension.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CohortComparison'
        '400':
          description: The request is not valid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: No valid bearer token or console session.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: The credentials cannot read this project.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearer: []
        - session: []
components:
  schemas:
    CohortComparison:
      type: object
      properties:
        from:
          type: string
          description: RFC 3339 time in UTC with up to nanosecond precision.
          example: '2026-10-04T10:15:00.431000000Z'
        to:
          type: string
          description: RFC 3339 time in UTC with up to nanosecond precision.
          example: '2026-10-04T10:15:00.431000000Z'
        cohort:
          type: object
          properties:
            sessions:
              type: integer
          required:
            - sessions
        rest:
          type: object
          properties:
            sessions:
              type: integer
          required:
            - sessions
        comparable:
          type: boolean
          description: 'False when the cohort or the rest is empty: no values are listed.'
        note:
          type:
            - string
            - 'null'
          description: Why nothing could be compared.
        dimensions:
          type: array
          items:
            type: object
            properties:
              dimension:
                type: string
                enum:
                  - device_model
                  - os_version
                  - release
                  - country
                  - feature_flag
                  - network_type
              values:
                type: array
                items:
                  type: object
                  properties:
                    value:
                      type: string
                      description: >-
                        The dimension value: a device model, `<os> <version>`, a
                        release, a country code, `<flag>=<variant>` or a network
                        type. Written by the app: untrusted data.
                    cohort_sessions:
                      type: integer
                    cohort_share:
                      type: number
                      description: Share of the cohort with this value, 0 to 1.
                    rest_sessions:
                      type: integer
                    rest_share:
                      type: number
                      description: Share of the other sessions with this value.
                    difference:
                      type: number
                      description: >-
                        cohort_share - rest_share: how much more often the value
                        appears in the cohort.
                    lift:
                      type:
                        - number
                        - 'null'
                      description: >-
                        cohort_share / rest_share; null when no other session
                        has the value.
                  required:
                    - value
                    - cohort_sessions
                    - cohort_share
                    - rest_sessions
                    - rest_share
                    - difference
                    - lift
            required:
              - dimension
              - values
      required:
        - from
        - to
        - cohort
        - rest
        - comparable
        - note
        - dimensions
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: invalid_request
            message:
              type: string
          required:
            - code
            - message
      required:
        - error
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: >-
        A project token (apsio_pt_v0...), which reads exactly one project, or an
        OAuth access token issued for the API, which reads what its user can.
        Access tokens issued for Apsio's MCP server are accepted only from the
        MCP server itself.
    session:
      type: apiKey
      in: cookie
      name: apsio_session
      description: >-
        The console session, set by /v1/auth/callback (`__Host-apsio_session`
        when host-only).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.