# Document validation

**URL:** <https://discuss.jsonapi.org/t/document-validation/1025>\
**Category:** Uncategorized\
**Created:** [July 13, 2017, 6:51am UTC](https://discuss.jsonapi.org/t/document-validation/1025 "2017-07-13T06:51:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lorenzomar](https://avatars.discourse-cdn.com/v4/letter/l/db5fbb/32.png) [@lorenzomar](https://discuss.jsonapi.org/u/lorenzomar)\
**Post date:** [July 13, 2017, 6:51am UTC](https://discuss.jsonapi.org/t/document-validation/1025/1 "2017-07-13T06:51:55Z")

</div>

Hi guys, i’m working on an HTTP library specifically designed to be used with JSON API and i’m trying to figure out the expected behavior in case of invalid json api request.  
Can i return a 400 Bad Request or there is a better solution?  
Thanks

---

<div class="post-metadata">

**Author:** ![steveklabnik](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.jsonapi.org/steveklabnik/32/2_2.png) [@steveklabnik](https://discuss.jsonapi.org/u/steveklabnik)\
**Post date:** [July 13, 2017, 2:33pm UTC](https://discuss.jsonapi.org/t/document-validation/1025/2 "2017-07-13T14:33:13Z")

</div>

Did you read [http://jsonapi.org/format/#errors](http://jsonapi.org/format/#errors) ?

---

<div class="post-metadata">

**Author:** ![derrekbertrand](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.jsonapi.org/derrekbertrand/32/426_2.png) [@derrekbertrand](https://discuss.jsonapi.org/u/derrekbertrand)\
**Post date:** [July 28, 2017, 6:38am UTC](https://discuss.jsonapi.org/t/document-validation/1025/3 "2017-07-28T06:38:02Z")

</div>

[http://jsonapi.org/format/#content-negotiation](http://jsonapi.org/format/#content-negotiation)

Also check out content negotiation and the errors sections at the end of various sections. You’ll get a 4XX error, but the code might tell you quite a bit about what you did wrong.

\*\* A 5XX is also possible, but less of a concern because it wouldn’t be your fault if it went wrong.
