Using API to send notifications

Hi all.

I keep on getting a 400 response on this API request. With same appID and header I can make a succesful get request to retrieve all users. So it’s def not authentication. Email also certainly exists in my database.

Any ideas?

This is python:

import requests
import json

appID = xyz

head = {
    'Authorization': 'Bearer xyz',
    'Content-Type': 'application/json'

url = ''

body = {
  "appId": appID,
  "audience": {"email" : ""},
  "notification": {
    "titleText": "Hello There",
    "bodyText": "This is just a test..."
notify =, headers=head, data=body)


results in 400 response.

Hi @arnevd,

Did you try to check via curl or Postman, out of curiosity?


Yes, same thing happens
upload completely sent off: 178 out of 178 bytes
< HTTP/1.1 400 Bad Request
< Server: Cowboy
< Date: Sat, 01 May 2021 13:53:37 GMT
< Connection: close
< Via: 1.1 vegur

Full anonymised curl req:
curl -H '{"Authorization": "Bearer xyz","Content-Type": "application/json"}' -d '{"appId": "xyz","audience": {"email" : ""},"notification": {"titleText": "Hello There","bodyText": "This is just a test..."}}' --verbose -X POST

Taking a look at your code, I see two mistakes:

  • You have “head” instead of “headers” in the authorization. Any reason you use headers=head?

Then it doesn’t seem you are quoting the appID:

You have
“appId”: appID, Should be “appId”: “appId”,

Thx JL_LJ,

head is a variable as is appID, just not initialized for privacy reasons here ;). With same header I can succesfully perform a GET request, so the header shouldn’t be the issue (neither should the appID, because in my get methodology I also use a variable).

I see it as a variable “appID = xyz”, but still shouldn’t the variable be wrapped in “”?

No because then it wouldn’t be a variable anymore. It would be a string.

In any case, if I use the curl statement I use 0 variables, and get the same 400 error.

I should mention I am on integrations pack trial. Maybe that’s got something to do with it?

Victor, any idea what’s happening here?

Hi @arnevd,

I’ve just tested Push notifications via API on one of my test apps - it works for me perfectly. I did it via Postman.
So as I think the problem is somewhere within your app.

By the way, did you make any native build of your app for iOS or Android? Push notifications won’t work if there were no builds before (see help doc, “In order for these API requests to succeed, you must first have at least one native build of your app. The build can be for either iOS or Android, and you do not need to have published your app to the app stores.”)

Best regards, Victor.

Aah perfect, I must’ve missed that piece of information!

@Victor Still isn’t working. I’ve become a paid customer now because I had to before I could build the app. Still get the 400 request.

Hi @arnevd,

If you have successfully completed at least one build of your app, and push notifications API isn’t working for you, then it would be a good idea to submit a support ticket:

Also, 400 isn’t just a response number alone. Usually you get some text along with 400 response, which may help to indicate what’s the problem.

Best regards, Victor.

Found the solution., headers=head, json=body) instead of data=body. So it’s a python thing i guess