Solved

Only getting HTTP 400 errors from the API

  • 12 December 2020
  • 3 replies
  • 593 views

I have now tried to do queries towards the engage endpoint in the API anyway possible, and all I can get it a non-descriptive HTTP 400 response back.

I’ve tried both using the query builder in the Mixpanel API docs, and get the same error there as in Postman:

 

Here’s my “raw log” from postman with my auth-header masked:

POST /api/2.0/engage?project_id=123456 HTTP/1.1
Authorization: Basic xxx=
User-Agent: PostmanRuntime/7.26.8
Accept: */*
Cache-Control: no-cache
Postman-Token: 00c0730f-68cf-4421-b628-5cb5664025a3
Host: mixpanel.com
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 0
HTTP/1.1 400 Bad Request
Server: nginx
Date: Fri, 11 Dec 2020 23:03:29 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
Cache-Control: no-cache, no-store
ot-tracer-traceid: 00000000000000005c9c4888b43fa0cb
ot-tracer-spanid: 0000000000000000ddf7941f4cd683ea
ot-tracer-sampled: false
x-force-trace: 0
X-Server-Elapsed: 0.443
Query-Ids: 2c365565f474494aaa55013940c03330
Access-Control-Allow-Origin: *
{"request": "/api/2.0/engage?project_id=123456", "error": "engage-distributed-query server error: 400 \nfor params: {'project_id': 2240903, 'include_all_users': False, 'selector': '', 'global_filters': b'', 'query_id': '2c365565f474494aaa55013940c03330', 'timezone': 'Europe/Stockholm', 'enable_id_mapping': True, 'enable_async_shuffle': True}"}

Can you help me to get a response from the engage endpoint?

Thanks!

icon

Best answer by Malthe 4 August 2021, 13:04

View original

3 replies

Userlevel 6
Badge +3

I noticed you are working with our support team, but in case others experience the same issue, here is a good starting point if you are in the EU:

The first step is to confirm that you are using a normal endpoint instead of a EU endpoint. For example, api.mixpanel.com instead of api-eu.mixpanel.com. Here's a list of HTTP API and its EU equivalent for your reference - https://developer.mixpanel.com/reference/overview.

We are working on improving the clarify in the API error message, and the support of EU projects in our API docs. 

I am getting the same problem when using https://developer.mixpanel.com/reference/insights page to do the requests.

 

By the looks of the original post the url is correct. What was the problem here?

I experienced the same issue, but fixed it by simply adding the eu. subdomain to the endpoint, like so:

https://eu.mixpanel.com/api/2.0/engage

So not api-eu like what cherise mentioned. I noticed that the admin area of mixpanel when I logged in was on the eu-subdomain, and so I just copied that. So perhaps login to your mixpanel user and check what the url is, and copy the same subdomain for your API-calls. 

Hopefully this saves someone else a few hours of headache :) 

Reply