# Discourse-abonnementen van een gebruiker ophalen via de API

**URL:** https://meta.discourse.org/t/getting-a-users-discourse-subscriptions-through-api/215395
**Category:** Development
**Tags:** rest-api
**Created:** [19 januari 2022 om 23:02 UTC](https://meta.discourse.org/t/getting-a-users-discourse-subscriptions-through-api/215395 "2022-01-19T23:02:42Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Nerd\_Alert](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nerd_alert/32/237766_2.png) [@Nerd\_Alert](https://meta.discourse.org/u/Nerd_Alert)
#### Post date: [19 januari 2022 om 23:02 UTC](https://meta.discourse.org/t/getting-a-users-discourse-subscriptions-through-api/215395/1 "2022-01-19T23:02:42Z")

</div>

Hey everyone! i’m trying to get a user’s discourse subscriptions (through the official plugin) using the api. But anytime I try it returns

```plaintext
{"errors":["You need to be logged in to do that."],"error_type":"not_logged_in"}

```

I’m passing in their csrf token (which has been validated to work before making the request), I’ve found all this through reversing the api but it seems I might be missing something? Thanks to whoever provides a solution!

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [19 januari 2022 om 23:07 UTC](https://meta.discourse.org/t/getting-a-users-discourse-subscriptions-through-api/215395/2 "2022-01-19T23:07:57Z")

</div>

> [@Nerd\_Alert](#):
>
> I’m passing in their csrf token

You should be passing in the API key and username:

> [@Discourse REST API Documentation](https://meta.discourse.org/t/discourse-rest-api-documentation/22706/1):
>
> Here is an example POST request via cURL:
> 
> ```plaintext
> curl -X POST "http://127.0.0.1:3000/categories" \
> -H "Content-Type: multipart/form-data;" \
> -H "Api-Key: 714552c6148e1617aeab526d0606184b94a80ec048fc09894ff1a72b740c5f19" \
> -H "Api-Username: discourse1" \
> -F "name=89853c20-4409-e91a-a8ea-f6cdff96aaaa" \
> -F "color=49d9e9" \
> -F "text_color=f0fcfd"
> 
> ```

---

<div class="post-metadata">

### Author: ![Nerd\_Alert](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nerd_alert/32/237766_2.png) [@Nerd\_Alert](https://meta.discourse.org/u/Nerd_Alert)
#### Post date: [19 januari 2022 om 23:09 UTC](https://meta.discourse.org/t/getting-a-users-discourse-subscriptions-through-api/215395/3 "2022-01-19T23:09:14Z")

</div>

Oh, thought it was like logging users in where you pass in a forum session and a csrf token and it just works. Thanks!
