Keen Queries API

Run analytical queries against Keen event collections.

Operations 11

GET /projects/{projectId}/queries/count Keen Run count query #
GET /projects/{projectId}/queries/count_unique Keen Run count_unique query #
GET /projects/{projectId}/queries/sum Keen Run sum query #
GET /projects/{projectId}/queries/average Keen Run average query #
GET /projects/{projectId}/queries/minimum Keen Run minimum query #
GET /projects/{projectId}/queries/maximum Keen Run maximum query #
GET /projects/{projectId}/queries/median Keen Run median query #
GET /projects/{projectId}/queries/percentile Keen Run percentile query #
GET /projects/{projectId}/queries/select_unique Keen Run select_unique query #
POST /projects/{projectId}/queries/funnel Keen Run funnel query #
POST /projects/{projectId}/queries/multi_analysis Keen Run multi_analysis query #

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/keen-queries-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

keen-queries-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Keen Cached Queries API
  description: The Keen Cached Queries API allows developers to create, manage, and retrieve pre-defined queries that are automatically refreshed on a schedule. Cached queries improve performance for frequently accessed analytics by storing pre-computed results, making them ideal for powering dashboards and embedded analytics experiences without incurring per-request rate limits.
  version: '3.0'
  contact:
    name: Keen Support
    url: https://keen.io/support
  license:
    name: Proprietary
    url: https://keen.io/terms-of-service
servers:
- url: https://api.keen.io/3.0
  description: Keen production API
security:
- masterKey: []
- readKey: []
tags:
- name: Queries
  description: Run analytical queries against Keen event collections.
paths:
  /projects/{projectId}/queries/count:
    parameters:
    - $ref: '#/components/parameters/projectId'
    get:
      operationId: queryCount
      summary: Keen Run count query
      description: Returns the number of events in a collection that match the supplied parameters.
      tags:
      - Queries
      parameters:
      - $ref: '#/components/parameters/eventCollectionQ'
      - $ref: '#/components/parameters/timeframe'
      - $ref: '#/components/parameters/filters'
      - $ref: '#/components/parameters/groupBy'
      - $ref: '#/components/parameters/interval'
      - $ref: '#/components/parameters/timezone'
      responses:
        '200':
          $ref: '#/components/responses/QueryResult'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /projects/{projectId}/queries/count_unique:
    parameters:
    - $ref: '#/components/parameters/projectId'
    get:
      operationId: queryCountUnique
      summary: Keen Run count_unique query
      description: Returns the number of distinct values for the specified target property in matching events.
      tags:
      - Queries
      parameters:
      - $ref: '#/components/parameters/eventCollectionQ'
      - $ref: '#/components/parameters/targetProperty'
      - $ref: '#/components/parameters/timeframe'
      - $ref: '#/components/parameters/filters'
      - $ref: '#/components/parameters/groupBy'
      - $ref: '#/components/parameters/interval'
      - $ref: '#/components/parameters/timezone'
      responses:
        '200':
          $ref: '#/components/responses/QueryResult'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /projects/{projectId}/queries/sum:
    parameters:
    - $ref: '#/components/parameters/projectId'
    get:
      operationId: querySum
      summary: Keen Run sum query
      description: Returns the sum of numeric values for the target property across matching events.
      tags:
      - Queries
      parameters:
      - $ref: '#/components/parameters/eventCollectionQ'
      - $ref: '#/components/parameters/targetProperty'
      - $ref: '#/components/parameters/timeframe'
      - $ref: '#/components/parameters/filters'
      - $ref: '#/components/parameters/groupBy'
      - $ref: '#/components/parameters/interval'
      - $ref: '#/components/parameters/timezone'
      responses:
        '200':
          $ref: '#/components/responses/QueryResult'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /projects/{projectId}/queries/average:
    parameters:
    - $ref: '#/components/parameters/projectId'
    get:
      operationId: queryAverage
      summary: Keen Run average query
      description: Returns the arithmetic mean of numeric values for the target property across matching events.
      tags:
      - Queries
      parameters:
      - $ref: '#/components/parameters/eventCollectionQ'
      - $ref: '#/components/parameters/targetProperty'
      - $ref: '#/components/parameters/timeframe'
      - $ref: '#/components/parameters/filters'
      - $ref: '#/components/parameters/groupBy'
      - $ref: '#/components/parameters/interval'
      - $ref: '#/components/parameters/timezone'
      responses:
        '200':
          $ref: '#/components/responses/QueryResult'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /projects/{projectId}/queries/minimum:
    parameters:
    - $ref: '#/components/parameters/projectId'
    get:
      operationId: queryMinimum
      summary: Keen Run minimum query
      description: Returns the minimum numeric value of the target property across matching events.
      tags:
      - Queries
      parameters:
      - $ref: '#/components/parameters/eventCollectionQ'
      - $ref: '#/components/parameters/targetProperty'
      - $ref: '#/components/parameters/timeframe'
      - $ref: '#/components/parameters/filters'
      - $ref: '#/components/parameters/groupBy'
      - $ref: '#/components/parameters/interval'
      - $ref: '#/components/parameters/timezone'
      responses:
        '200':
          $ref: '#/components/responses/QueryResult'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /projects/{projectId}/queries/maximum:
    parameters:
    - $ref: '#/components/parameters/projectId'
    get:
      operationId: queryMaximum
      summary: Keen Run maximum query
      description: Returns the maximum numeric value of the target property across matching events.
      tags:
      - Queries
      parameters:
      - $ref: '#/components/parameters/eventCollectionQ'
      - $ref: '#/components/parameters/targetProperty'
      - $ref: '#/components/parameters/timeframe'
      - $ref: '#/components/parameters/filters'
      - $ref: '#/components/parameters/groupBy'
      - $ref: '#/components/parameters/interval'
      - $ref: '#/components/parameters/timezone'
      responses:
        '200':
          $ref: '#/components/responses/QueryResult'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /projects/{projectId}/queries/median:
    parameters:
    - $ref: '#/components/parameters/projectId'
    get:
      operationId: queryMedian
      summary: Keen Run median query
      description: Returns the median numeric value of the target property across matching events.
      tags:
      - Queries
      parameters:
      - $ref: '#/components/parameters/eventCollectionQ'
      - $ref: '#/components/parameters/targetProperty'
      - $ref: '#/components/parameters/timeframe'
      - $ref: '#/components/parameters/filters'
      - $ref: '#/components/parameters/groupBy'
      - $ref: '#/components/parameters/interval'
      - $ref: '#/components/parameters/timezone'
      responses:
        '200':
          $ref: '#/components/responses/QueryResult'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /projects/{projectId}/queries/percentile:
    parameters:
    - $ref: '#/components/parameters/projectId'
    get:
      operationId: queryPercentile
      summary: Keen Run percentile query
      description: Returns the value at the specified percentile for the target property across matching events.
      tags:
      - Queries
      parameters:
      - $ref: '#/components/parameters/eventCollectionQ'
      - $ref: '#/components/parameters/targetProperty'
      - name: percentile
        in: query
        required: true
        schema:
          type: number
          minimum: 0
          maximum: 100
        description: Percentile to compute (e.g., 95 for the 95th percentile).
      - $ref: '#/components/parameters/timeframe'
      - $ref: '#/components/parameters/filters'
      - $ref: '#/components/parameters/groupBy'
      - $ref: '#/components/parameters/interval'
      - $ref: '#/components/parameters/timezone'
      responses:
        '200':
          $ref: '#/components/responses/QueryResult'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /projects/{projectId}/queries/select_unique:
    parameters:
    - $ref: '#/components/parameters/projectId'
    get:
      operationId: querySelectUnique
      summary: Keen Run select_unique query
      description: Returns the distinct values of the target property across matching events.
      tags:
      - Queries
      parameters:
      - $ref: '#/components/parameters/eventCollectionQ'
      - $ref: '#/components/parameters/targetProperty'
      - $ref: '#/components/parameters/timeframe'
      - $ref: '#/components/parameters/filters'
      - $ref: '#/components/parameters/groupBy'
      - $ref: '#/components/parameters/interval'
      - $ref: '#/components/parameters/timezone'
      responses:
        '200':
          $ref: '#/components/responses/QueryResult'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /projects/{projectId}/queries/funnel:
    parameters:
    - $ref: '#/components/parameters/projectId'
    post:
      operationId: queryFunnel
      summary: Keen Run funnel query
      description: Analyzes user progression through an ordered sequence of steps, each defined as a query against an event collection.
      tags:
      - Queries
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - steps
              properties:
                steps:
                  type: array
                  items:
                    type: object
                    properties:
                      event_collection:
                        type: string
                      actor_property:
                        type: string
                      timeframe:
                        type: string
                      filters:
                        type: array
                        items:
                          type: object
      responses:
        '200':
          description: Funnel result with counts per step.
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: array
                    items:
                      type: integer
        '401':
          $ref: '#/components/responses/Unauthorized'
  /projects/{projectId}/queries/multi_analysis:
    parameters:
    - $ref: '#/components/parameters/projectId'
    post:
      operationId: queryMultiAnalysis
      summary: Keen Run multi_analysis query
      description: Runs multiple analyses on the same event collection in a single request, returning all results in a combined response.
      tags:
      - Queries
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - event_collection
              - analyses
              properties:
                event_collection:
                  type: string
                analyses:
                  type: object
                  additionalProperties:
                    type: object
                    properties:
                      analysis_type:
                        type: string
                      target_property:
                        type: string
                      percentile:
                        type: number
                timeframe:
                  type: string
                filters:
                  type: array
                  items:
                    type: object
                group_by:
                  type: string
                interval:
                  type: string
      responses:
        '200':
          $ref: '#/components/responses/QueryResult'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  parameters:
    eventCollectionQ:
      name: event_collection
      in: query
      required: true
      schema:
        type: string
      description: Name of the event collection to query.
    filters:
      name: filters
      in: query
      required: false
      schema:
        type: string
      description: JSON-encoded array of filter objects to narrow events.
    timezone:
      name: timezone
      in: query
      required: false
      schema:
        type: string
      description: Time zone offset for relative timeframes.
    interval:
      name: interval
      in: query
      required: false
      schema:
        type: string
      description: Time-based grouping interval (e.g., daily, hourly).
    timeframe:
      name: timeframe
      in: query
      required: true
      schema:
        type: string
      description: Relative or absolute time frame for the query (e.g., this_7_days).
    groupBy:
      name: group_by
      in: query
      required: false
      schema:
        type: string
      description: Property name to group results by.
    projectId:
      name: projectId
      in: path
      required: true
      schema:
        type: string
      description: Keen project identifier.
    targetProperty:
      name: target_property
      in: query
      required: true
      schema:
        type: string
      description: Property used as the target of the aggregation.
  responses:
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    QueryResult:
      description: Query result returned successfully.
      content:
        application/json:
          schema:
            type: object
            properties:
              result:
                description: Result value or grouped/intervalled list of results.
  schemas:
    Error:
      type: object
      properties:
        error_code:
          type: string
        message:
          type: string
  securitySchemes:
    masterKey:
      type: apiKey
      in: header
      name: Authorization
      description: Keen Master Key for management endpoints.
    readKey:
      type: apiKey
      in: header
      name: Authorization
      description: Keen Read Key for retrieving cached results.
externalDocs:
  description: Keen Cached Queries API Documentation
  url: https://keen.io/docs/api/#cached-queries