# How to logout user by api

**URL:** https://meta.discourse.org/t/how-to-logout-user-by-api/386607
**Category:** Support
**Tags:** rest-api
**Created:** [October 24, 2025, 7:07am UTC](https://meta.discourse.org/t/how-to-logout-user-by-api/386607 "2025-10-24T07:07:29Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![adopilot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/adopilot/32/105040_2.png) [@adopilot](https://meta.discourse.org/u/adopilot)
#### Post date: [October 24, 2025, 2:34pm UTC](https://meta.discourse.org/t/how-to-logout-user-by-api/386607/2 "2025-10-24T14:34:52Z")

</div>

My apologies for opening topic.

Problem was that my development setup point to http not https instance of discource.

When I switched to https endpoint it start working.

I get confused because some of api endpoints woking over http but this on does not.

For future readers here how i logout users by C#

```plaintext
             var url = $"/admin/users/{user.user.id}/log_out";
            using var formData = new MultipartFormDataContent{
{ new StringContent(_forumConfigModel.ApiKey), “api_key” },
{ new StringContent(_forumConfigModel.User), “api_username” }
};

var response = await _httpClient.PostAsync(url, formData);

```

---

_[View the full topic](https://meta.discourse.org/t/how-to-logout-user-by-api/386607)._
