Habitica POST Request returning "[400] unexpected token t in json at position 0"

I wanted to experiment with Make + Habitica with custom API calls that aren’t included in the main integration. I started by using code from their documentation and added header items for User ID/API Key (Key omitted from screenshot for privacy reasons) One time it returned a “404 error not found” but most of the time it returned the “unexpected token” error, with the token being t or some other letter.

I am looking for a solution that uses the “Make API Call” action from Habitica with as little coding as possible.

The body needs to be Json most likely. Have a look here.

Thanks for sharing this link, but I’m not sure if it helps. I already have Habitica’s API here: Habitica

Was there a different part of the forum thread that I needed to pay attention to?

In the doc they show what looks like Json for successful/failed results, but the command itself looks like a URL.

Can you link in the docs to your particular endpoint?

I am not entirely sure if this is the endpoint but the url I was using in my current experiment was https://habitica.com/api/v3/tasks/user/

You also need to populate x-client-header


Here it is

The required Body Parameters need to be in a json structure in your request content. It’s a json string you need to build.

You must use json or xml in the request content body always.

See their example

    "text": "Update Habitica API Documentation - Tasks",
    "type": "todo",
    "alias": "hab-api-tasks",
    "notes": "Update the tasks api on GitHub",
    "tags": [
    "checklist": [
            "text": "read wiki",
            "completed": true
            "text": "write code"
    "priority": 2
1 Like

I think I got it from an example on the wiki and thought it would work if I put everything in the right place.

curl -X POST -d "type=todo&text=New Task Text&notes=Some Notes" \
    -H "x-api-user: 12345678-90ab-416b-cdef-1234567890ab" \
    -H "x-api-key: 12345678-90ab-416b-cdef-1234567890ab" \
    -H "x-client: 12345678-90ab-416b-cdef-1234567890ab-Testing" \

Source: Application Programming Interface | Habitica Wiki | Fandom

Wait, the “successful response” is what I needed to look at for the json example? :dizzy_face:

A response is what the api call sends back. Request content is what you send in. Curl examples aren’t going to cut it. The -d option is a key value pair that is converted to json behind the scenes.

Here’s more on the topic of json young padawan.

Animated GIF

1 Like

:flushed: Just making sure I wasn’t misreading it. But if I want to use the API form in the Habitica module it would be something like this:

URL: (relative to habitica API url)

METHOD: (Method)

Then for the Headers, I would want to put all of the headers included in the guidance article (or the ones I need to actually Do The Thing)?

Yes that’s right. Their docs are a bit of Mess but look at the link I sent you and ignore their curl stuff.


Okay the example worked. It makes a little more sense now. I agree that their docs are hard to follow. I appreciate the help.

1 Like

That’s good. Their docs are pretty much par for the course. If you really want to understand apis and practice how they work use postman and look for postman collections. That will give you a very thorough understanding.

1 Like