# "Api-Key" and "Api-Username" for try.discourse.org?

**URL:** https://meta.discourse.org/t/api-key-and-api-username-for-try-discourse-org/203150
**Category:** Development
**Tags:** rest-api
**Created:** [September 10, 2021, 10:32am UTC](https://meta.discourse.org/t/api-key-and-api-username-for-try-discourse-org/203150 "2021-09-10T10:32:49Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![orli](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/orli/32/233721_2.png) [@orli](https://meta.discourse.org/u/orli)
#### Post date: [September 10, 2021, 10:32am UTC](https://meta.discourse.org/t/api-key-and-api-username-for-try-discourse-org/203150/1 "2021-09-10T10:32:49Z")

</div>

Hi, I would like to create some weekly statistic reports using the REST API. I will be doing this for  
forum linkingyourthinking com

but I would like to start early before I have gotten the keys from the administrator which might take a while, since they are in the middle of a 6 week workshop.

So I was hoping to begin right now with [try.discourse.org](http://try.discourse.org), Is that possible? I have tried  
`curl -X GET https://try.discourse.org/site.json`  
and it works nicely.

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [September 10, 2021, 11:33am UTC](https://meta.discourse.org/t/api-key-and-api-username-for-try-discourse-org/203150/2 "2021-09-10T11:33:57Z")

</div>

You can set up a local development instance of discourse for such work. It is fairly simple to do so.

See [Set up a local Discourse Development Environment?](https://meta.discourse.org/t/how-do-i-set-up-a-local-discourse-development-environment/182882)

---

<div class="post-metadata">

### Author: ![orli](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/orli/32/233721_2.png) [@orli](https://meta.discourse.org/u/orli)
#### Post date: [September 10, 2021, 11:51am UTC](https://meta.discourse.org/t/api-key-and-api-username-for-try-discourse-org/203150/3 "2021-09-10T11:51:54Z")

</div>

Thanks for the tip! Will there by any demo data in such an instance: users, groups and posts?

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [September 10, 2021, 12:00pm UTC](https://meta.discourse.org/t/api-key-and-api-username-for-try-discourse-org/203150/4 "2021-09-10T12:00:37Z")

</div>

There will be some default seeded data but you’re always free to create some data as per your own need.

---

<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: [September 10, 2021, 1:04pm UTC](https://meta.discourse.org/t/api-key-and-api-username-for-try-discourse-org/203150/5 "2021-09-10T13:04:30Z")

</div>

> [@orli](#):
>
> So I was hoping to begin right now with [try.discourse.org](http://try.discourse.org), Is that possible? I have tried  
> `curl -X GET https://try.discourse.org/site.json`  
> and it works nicely.

If you are doing reports on public data on [try.discourse.org](http://try.discourse.org) you won’t need the API keys, as the `GET` requests will work just fine without it!

---

<div class="post-metadata">

### Author: ![orli](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/orli/32/233721_2.png) [@orli](https://meta.discourse.org/u/orli)
#### Post date: [September 10, 2021, 1:11pm UTC](https://meta.discourse.org/t/api-key-and-api-username-for-try-discourse-org/203150/6 "2021-09-10T13:11:17Z")

</div>

Thank you! I don’t have the terminology clear for me right now. I want to

- list all groups
- for each group, list group member statistics: seen, posts, read time, …
- do this on a weekly basis and mail to the group leaders/guides.

That data is probably not public?

---

<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: [September 10, 2021, 1:20pm UTC](https://meta.discourse.org/t/api-key-and-api-username-for-try-discourse-org/203150/7 "2021-09-10T13:20:50Z")

</div>

It is! Discourse aims to be an open and crawleable platform _by default_. In fact you can even do the same on Meta.

> [@orli](#):
>
> list all groups

`curl https://meta.discourse.org/g.json`

> [@orli](#):
>
> for each group, list group member statistics: seen, posts, read time, …

`curl https://meta.discourse.org/groups/translators/members.json?offset=0&order=&asc=true&filter=`

`https://meta.discourse.org/u/falco/summary.json`

> [@orli](#):
>
> do this on a weekly basis and mail to the group leaders/guides.

Group leader data will be on the first request.

🙂

---

<div class="post-metadata">

### Author: ![Tarun\_Sharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tarun_sharma/32/483195_2.png) [@Tarun\_Sharma](https://meta.discourse.org/u/Tarun_Sharma)
#### Post date: [January 28, 2025, 10:41am UTC](https://meta.discourse.org/t/api-key-and-api-username-for-try-discourse-org/203150/8 "2025-01-28T10:41:53Z")

</div>

Hi can anyone tell me the difference and usage of Api-key and Api-Username.

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [January 28, 2025, 3:47pm UTC](https://meta.discourse.org/t/api-key-and-api-username-for-try-discourse-org/203150/9 "2025-01-28T15:47:34Z")

</div>

The api username will tell Discourse which capabilities are enabled. An admin or a regular user don’t have the same capabilities, and using one or another will restrict what you can achieve using the api.

the api key is the password to be used with the api username.

---

<div class="post-metadata">

### Author: ![Tarun\_Sharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tarun_sharma/32/483195_2.png) [@Tarun\_Sharma](https://meta.discourse.org/u/Tarun_Sharma)
#### Post date: [January 29, 2025, 4:56am UTC](https://meta.discourse.org/t/api-key-and-api-username-for-try-discourse-org/203150/10 "2025-01-29T04:56:21Z")

</div>

So in my scenario I only want to use the discourse api and my confusion is that every user who is using my app can create post, like, comment other features so now do i want to create api-username and api-key for each user to use respective api’s?

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [January 29, 2025, 6:40am UTC](https://meta.discourse.org/t/api-key-and-api-username-for-try-discourse-org/203150/12 "2025-01-29T06:40:33Z")

</div>

have you read the api documentation?

especially this

> [@User API keys specification](https://meta.discourse.org/t/user-api-keys-specification/48536):
>
> Discourse contains a system for generating API keys per user if a very specific protocol is followed. This feature facilitates “application” access to Discourse instances without needing to involve moderators. High level description At a high level: Client (desktop app, browser plugin, mobile app) generates a private/public key pair and return url Client redirects to a route on discourse giving discourse its public key Discourse gets approval from user to use app Discourse generat…

also these

> [@Discourse REST API Documentation](https://meta.discourse.org/t/discourse-rest-api-documentation/22706):
>
> Discourse API Please view the Discourse API Documentation site for detailed info: [https://docs.discourse.org](https://docs.discourse.org)information_source Authentication API requests must use HTTP header based authentication. Pass your Api-Key and Api-Username as HTTP headers. Authentication via query parameters or request body is not supported (this was removed in April 2020). Please see the example cURL request below. The only API endpoints that continue to support credentials in query parameters are requests to…

---

<div class="post-metadata">

### Author: ![Tarun\_Sharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tarun_sharma/32/483195_2.png) [@Tarun\_Sharma](https://meta.discourse.org/u/Tarun_Sharma)
#### Post date: [February 4, 2025, 11:59am UTC](https://meta.discourse.org/t/api-key-and-api-username-for-try-discourse-org/203150/13 "2025-02-04T11:59:42Z")

</div>

Acc. to doc I have created a “All users” api key but I am getting this error

```plaintext
{
    "errors": [
        "You are not permitted to view the requested resource. The API username or key is invalid."
    ],
    "error_type": "invalid_access"
}

```

in post man while hitting this api /tags.json.  
Can you please help me with this

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [February 4, 2025, 12:36pm UTC](https://meta.discourse.org/t/api-key-and-api-username-for-try-discourse-org/203150/14 "2025-02-04T12:36:09Z")

</div>

Can you post your full request here?
