# /api/v4/posts not working, everything else is!?

**URL:** <https://forum.mattermost.com/t/api-v4-posts-not-working-everything-else-is/11311>\
**Category:** Troubleshooting\
**Created:** [February 26, 2021, 2:12pm UTC](https://forum.mattermost.com/t/api-v4-posts-not-working-everything-else-is/11311 "2021-02-26T14:12:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sushimaster](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@Sushimaster](https://forum.mattermost.com/u/Sushimaster)\
**Post date:** [February 26, 2021, 2:12pm UTC](https://forum.mattermost.com/t/api-v4-posts-not-working-everything-else-is/11311/1 "2021-02-26T14:12:30Z")

</div>

#### Summary

/api/v4/posts endpoint only returns  
{“id”:“api.context.404.app\_error”,“message”:“Sorry, we could not find the page.”,“detailed\_error”:“There doesn’t appear to be an api call for the url=’/api/v4/posts/’. Typo? are you missing a team\_id or user\_id as part of the url?”,“status\_code”:404}

#### Steps to reproduce

I installed latest Mattermost (v5.32.1) from scratch on debian 10 without any problems.  
Every API call is working, e.g.  
/api/v4/users/me  
/api/v4/channels  
/api/v4/channels/CHANNEL\_ID/posts  
…etc

Only /api/v4/posts returns 404

Full api url is like  
mymm.mydomain.tld/api/v4/

However, the whole application is working, just the /posts endpoint returns 404!?

#### Edit:

The error appears as user in browser as well as in postman or any other way to call the api.

#### Edit2:

From the nginx logs you can see, /api/v4/posts simply generates a 404 error:  
myiphere - - [26/Feb/2021:15:39:59 +0100] “POST /api/v4/posts/ HTTP/1.1” 404 251 “-” “PostmanRuntime/7.26.10”

---

<div class="post-metadata">

**Author:** ![ahmaddanial](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/ahmaddanial/32/2938_2.png) [@ahmaddanial](https://forum.mattermost.com/u/ahmaddanial)\
**Post date:** [March 2, 2021, 2:32am UTC](https://forum.mattermost.com/t/api-v4-posts-not-working-everything-else-is/11311/2 "2021-03-02T02:32:49Z")

</div>

Hello, @Sushimaster

I attempted to use the `/api/v4/posts` without any issues on my end. Eg.

```auto
curl --location --request POST "<URL>/api/v4/posts" --header "Authorization: Bearer <personal_token>" --header "Content-Type: application/json" --header "X-Requested-With: XMLHttpRequest" --data "{\"message\":\"This is a test message\", \"channel_id\":\"<channel_id>\"}"

```

Can you please confirm if you are still facing the same issue when you use this cURL command on your end and if yes, what is the error that you are seeing on your side?

Also, does the user token have the right permission to post on channels?

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mattermost/original/2X/3/385a99345200f887516c12b8ff78826104eca254.png)

---

<div class="post-metadata">

**Author:** ![Sushimaster](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@Sushimaster](https://forum.mattermost.com/u/Sushimaster)\
**Post date:** [April 12, 2021, 11:01am UTC](https://forum.mattermost.com/t/api-v4-posts-not-working-everything-else-is/11311/3 "2021-04-12T11:01:48Z")

</div>

Oh shit, I forgot to reply!

The problem was, that I did not used “raw” (which is the correct setting!) in body field (here: Postman), that causes the problem.

![image](https://us1.discourse-cdn.com/flex020/uploads/mattermost/original/2X/e/e25d399c48a61deec544d3bdfa25880c27ee156f.png)

However, the **error code is terribly misleading** , because 404 says the URL would be wrong, but the sent data was malformed. That’s a huge difference!

---

<div class="post-metadata">

**Author:** ![ahmaddanial](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/ahmaddanial/32/2938_2.png) [@ahmaddanial](https://forum.mattermost.com/u/ahmaddanial)\
**Post date:** [April 12, 2021, 11:23pm UTC](https://forum.mattermost.com/t/api-v4-posts-not-working-everything-else-is/11311/4 "2021-04-12T23:23:13Z")

</div>

Hi, @Sushimaster

No worries. Just to make sure that this is an actual issue with Mattermost instead of Postman, did you try out the CLI I shared earlier and verify if you managed to make it work or does it also fail with the 404 error?

> [@ahmaddanial](#):
>
> ```auto
> curl --location --request POST "<URL>/api/v4/posts" --header "Authorization: Bearer <personal_token>" --header "Content-Type: application/json" --header "X-Requested-With: XMLHttpRequest" --data "{\"message\":\"This is a test message\", \"channel_id\":\"<channel_id>\"}"
> 
> ```

Just want to make sure that we understand the problem properly.
