REST Post: Invalid Request [SOLVED]


I am having a problem when I tried to test the REST Api. The GET commands are responding fine, but when I am trying to create any new Doctype with POST, the server responds with a message 400 Invalid Request.
I am authenticated as the Administrator.
Probably I missed something, but I don’t know what can be. Here are the details of my Post petition:

URL: http://localhost:8000/api/resource/Supplier

Content-Type : application/json
Accept: application/json

Content Body:
“supplier_name”: “Supplier”,

P.S.: I also tried adding the data on the URL (…/Supplier?data=…) but I am obtaining the same 400 message.

Thank you for your help, best regards!

can you show us your code?

Hi! It is not on code, it is a POST petition using a Firefox RESTClient.


It was necessary to add to the header the token X-Frappe-CSRF-Token: token_number of the user.

On this thread is talking about it: CSRF Token Checks Prohibit POST Rest API Calls for a Logged in User

As a petition, I think this should be added or mentioned on the Frappe REST Api guide ( for other users that could have this problem.

Thank you to @alex_melkoff for finding the thread.