Offers API Syntax

When attempting to use the offers API to post an offer in the test environment. I’m receiving the following error: HTTP400: Bad Request - The request could not be processed by the server due to invalid syntax. I’ve reviewed the API documentation and my code, see below, but can’t figure out why this isn’t posting. I replaced my API key with ‘XXXX’ for the purpose of this message.

Hi @rknapp,

Thanks for trying out our offers API! Unfortunately, your code didn’t post in your message, so I can’t troubleshoot. I did just run the following:

curl -X POST  \
-H 'content-type: application/json' -H 'fidel-key: {my key}' \
-d '{   "countryCode": "IRL", "name":"42% off Lemonade",\
"additionalTerms": "No Ducks.  Not valid on glue.", \

and I received a 201 response, and I see the following pending offer in my Dashboard:

Please post your code, and we’ll give it a debug.


var url = “”;

var offer = {
“countryCode”: “USA”,
“name”:“20% Off Everything”,
“name”:“Super Sale”,

const request = new Request(url, {
method: ‘POST’,
headers: new Headers({
‘content-type’: ‘application/json’,
‘fidel-key’: ‘xxxx’,
body: JSON.stringify(offer),

.then(res => res.json())
.then(res => console.log(res));

Hi @rknapp I can replicate your error. There is a defect in the way we post the startDate - if you attempt to set the date AND the time, you’ll get an error. Just the date works. We will have a fix deployed on Monday.

This weekend, you can use “YYYY-MM-DD” to set the offer start date (and it will default to midnight start time). Next week, we can return to setting a time. :alarm_clock:


Thanks for the reply Doug. I look forward to working more with the test environment. I changed my startDate to read


However, I still get the same error. From what you can tell, is the code I sent you correct otherwise?

So… I’ve been working with the dev team on this one all day, and it appears that now - it is breaking on the date parameter (inserted on the backend). For example - I used the correct startDate, but it failed on 2020-05-01T12:13:00.000Z (today at noon GMT) for the date field.

We’ll get this sorted on Monday. Apologies for the delay.

Not a problem. Thank you for being available to work with me.

Can you confirm if/when this fix has been made?



It is fixed, but with a slight modification:

Current offers documentation seems to have the incorrect dates format. Right now we are accepting 2 formats YYYY-MM-DD and YYYY-MM-DDThh:mm:ss , since it’s less confusing having only one format added only one. But really open to other opinions.

We have updated the documentation accordingly.


Thanks Doug - I’m still getting a syntax error. Can you tell if it’s something on my end?

Can you send me your query (minus keys, etc.?)

I grabbed this one from the docs, and just updated the Key, publisherId, BrandId and startDate.

This one worked.


curl -X POST   -H 'content-type: application/json'  -H 'fidel-key: sk_test_xxxx'  -d '{       "countryCode": "GBR",    "name":"20% Off Netflix Subscription",

var url = “”;

var offer = {​
countryCode: “USA”,​
name:“20% Off Everything”,​
name:“Super Sale”,​

const request = new Request(url, {​
method: ‘POST’,​
headers: new Headers({​
‘content-type’: ‘application/json’,​
‘fidel-key’: ‘xxxx’,​
body: JSON.stringify(offer),​

.then(res => res.json())​
.then(res => console.log(res));

Hi @rknapp
The type:name field only allows 2 parameters: amount (for a total savings like $25 off) or percentage (25% off)

name:“Super Sale”,​

You’ll need to change “super sale” to percentage (I am assuming percentage as the name of the offer is 20% off everything).

If you look at the devTools console log for your request - you can see the error:


That worked perfect - Thank you