# Invalid\_access error

**URL:** https://meta.discourse.org/t/invalid-access-error/175657
**Category:** Support
**Created:** [January 10, 2021, 5:18am UTC](https://meta.discourse.org/t/invalid-access-error/175657 "2021-01-10T05:18:49Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Minhaj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/minhaj/32/137595_2.png) [@Minhaj](https://meta.discourse.org/u/Minhaj)
#### Post date: [January 10, 2021, 5:18am UTC](https://meta.discourse.org/t/invalid-access-error/175657/1 "2021-01-10T05:18:49Z")

</div>

I want to fetch all topics by tag. I am sending a GET request to the URL `https://discourse-url/tag/kind:feature.json`. But I am getting the error `"You are not permitted to view the requested resource. The API username or key is invalid."`. Whereas my `API-key` and `API-username` are correct. What could be the problem?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 10, 2021, 2:31pm UTC](https://meta.discourse.org/t/invalid-access-error/175657/2 "2021-01-10T14:31:09Z")

</div>

Just to confirm, you can use the same header to request, say /admin/users.json? (I think that’s an admin route, but you can check in a web browser)

---

<div class="post-metadata">

### Author: ![Minhaj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/minhaj/32/137595_2.png) [@Minhaj](https://meta.discourse.org/u/Minhaj)
#### Post date: [January 10, 2021, 7:36pm UTC](https://meta.discourse.org/t/invalid-access-error/175657/3 "2021-01-10T19:36:27Z")

</div>

Getting `404` error for this url. I can fetch any topic by sending the request to `/t/topic-id.json` but not able to do any other GET query successfully. What could be the possible problem

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 10, 2021, 7:38pm UTC](https://meta.discourse.org/t/invalid-access-error/175657/4 "2021-01-10T19:38:56Z")

</div>

Can you get `http://example.com/admin/dashboard.json`? I’m sure that URL should work.

---

<div class="post-metadata">

### Author: ![Minhaj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/minhaj/32/137595_2.png) [@Minhaj](https://meta.discourse.org/u/Minhaj)
#### Post date: [January 11, 2021, 4:23am UTC](https://meta.discourse.org/t/invalid-access-error/175657/5 "2021-01-11T04:23:16Z")

</div>

Not able to get it. Same error `404`.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 11, 2021, 12:05pm UTC](https://meta.discourse.org/t/invalid-access-error/175657/6 "2021-01-11T12:05:53Z")

</div>

Then you’re not passing the credentials correctly. You can search for examples of how to pass them in the header.

But I just tested this one:

```plaintext
DISCOURSE_API_KEY==API_KEY=
DISCOURSE_API_USER==API_USER=
    curl -s -X GET --header "Api-Key: $DISCOURSE_API_KEY" --header "Api-Username: $DISCOURSE_API_USER" https://example.com/admin/dashboard.json

```

---

<div class="post-metadata">

### Author: ![Minhaj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/minhaj/32/137595_2.png) [@Minhaj](https://meta.discourse.org/u/Minhaj)
#### Post date: [January 11, 2021, 5:54pm UTC](https://meta.discourse.org/t/invalid-access-error/175657/7 "2021-01-11T17:54:25Z")

</div>

I am passing credentials correctly. I verified it by trying to fetch an internal topic by `id` which can’t be fetched without proper credentials. But seems like only working query I can do is on `discourse-url/t/tid.json`. Anything else simply returns error 403.
