I tried with POSTMAN to upload a file to my endpoint host/jsonapi/file/file, the POST method is available but when I try to upload something, drupal gives me a 415 unsupported media type error. I tried with the binary option and with the data-form option using the next headers:

"Accept: application/vnd.api+json"
"Content-Type: application/octet-stream"
'Content-Disposition: file; filename="test.jpg"'

The GET method works well. It returns me all the files.

What is wrong?

  • 1
    Did you check the docs? Make sure that your user has permission to post files in the first place, too. Jan 19 at 13:46
  • I found the way using the relationship field and the endpoint of that relationship, it can't be done directly to the jsonapi/file/file endpoint.
    – JPcode
    Jan 19 at 14:14
  • Glad you found the answer. Feel free to post an answer to your own question; doing so is welcomed and encouraged here. Jan 19 at 23:38

1 Answer 1


To upload a file I just change the endpoint "host/jsonapi/file/file" for "host/jsonapi/node/[my_specific_name]/[relationship_field_name]" with the binary option in the body of the POST in POSTMAN.

Also this documentation was really helpful docs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.