Skip to main content
POST
/
jql
Custom JQL Query
curl --request POST \
  --url https://{regionAndDomain}.com/api/query/jql \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data 'script=function main(){
  return Events(params)
    .groupBy(
      ["name"],
      mixpanel.reducer.count()
    )
}
' \
  --data 'params={
  "from_date": 2016-01-01T00:00:00.000Z,
  "to_date": 2016-01-07T00:00:00.000Z
}
'
[
  {}
]
JQL is currently in maintenance mode. We recommend discontinuing use of JQL and using an alternate method to get the data you need. Below are alternatives for common use cases and you need help deciding the best method for you, reach out to support.
The HTTP API is the lowest-level way to use JQL. At its core, the API is very simple: you write a script, and you post it to an API endpoint with some authentication parameters. For longer scripts, you will likely want to keep the code in a file. If you had your script in a file called my_query.js, you could run it using the following cURL command:
curl https://mixpanel.com/api/query/jql \
     -u YOUR_API_SECRET: \
     --data-urlencode script@my_query.js
Example curl with the script directly inside of the curl:
curl --request POST \
     --url https://mixpanel.com/api/query/jql \
     --header 'accept: application/json' \
     --header 'content-type: application/x-www-form-urlencoded' \
     --data 'script=function main(){
  return Events(params)
    .groupBy(
      ["name"],
      mixpanel.reducer.count()
    )
}
' \
     --data 'params={
  "scriptParam": "paramValue"
}
'
Note
  • The Query API has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.
  • Queries will timeout after 2 minutes of run-time.
  • You cannot make remote network requests (using XMLHttpRequest) from JavaScript.
  • Queries to the JQL endpoint contribute to Query API rate limit and have their own individual limit as well. There is a maximum of 5 concurrent queries and of 60 queries per hour. There is also a 5 GB limit on data that can be processed in a single query, and a 2 GB limit on the resulting output data.

Authorizations

Authorization
string
header
required

Service Account

Query Parameters

project_id
integer
required

Required if using service account to authenticate request.

workspace_id
integer

The id of the workspace if applicable.

Body

application/x-www-form-urlencoded
script
string
default:function main(){ return Events(params) .groupBy( ["name"], mixpanel.reducer.count() ) }
required

The script to run.

params
string<blob>
default:{ "scriptParam": "paramValue" }

A JSON-encoded object that will be made available to the script as the params global variable.

Response

200 - application/json

Success