# Can't create new group via api (/admin/groups.json - post method)

**URL:** https://meta.discourse.org/t/cant-create-new-group-via-api-admin-groups-json-post-method/309452
**Category:** Development
**Tags:** rest-api
**Created:** [May 26, 2024, 12:41pm UTC](https://meta.discourse.org/t/cant-create-new-group-via-api-admin-groups-json-post-method/309452 "2024-05-26T12:41:28Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Nuran\_Akimbek](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nuran_akimbek/32/385793_2.png) [@Nuran\_Akimbek](https://meta.discourse.org/u/Nuran_Akimbek)
#### Post date: [May 26, 2024, 12:41pm UTC](https://meta.discourse.org/t/cant-create-new-group-via-api-admin-groups-json-post-method/309452/1 "2024-05-26T12:41:28Z")

</div>

Can’t create new group via api ([https://mywebsite/admin/groups.json](https://mywebsite/admin/groups.json) - post method)  
When I send via get method ([https://mywebsite/groups.json](https://mywebsite/groups.json)) I successfully get all groups list.

Response message is “The requested URL or resource was not found”

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [May 26, 2024, 12:59pm UTC](https://meta.discourse.org/t/cant-create-new-group-via-api-admin-groups-json-post-method/309452/2 "2024-05-26T12:59:07Z")

</div>

Hi,

Can you share details on how you create a group?

Did you provide valid `Api-Key` and `Api-Username` headers?

> [@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: ![Nuran\_Akimbek](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nuran_akimbek/32/385793_2.png) [@Nuran\_Akimbek](https://meta.discourse.org/u/Nuran_Akimbek)
#### Post date: [May 26, 2024, 1:16pm UTC](https://meta.discourse.org/t/cant-create-new-group-via-api-admin-groups-json-post-method/309452/3 "2024-05-26T13:16:57Z")

</div>

curl “[https://community.orleu-edu.kz/admin/group.json](https://community.orleu-edu.kz/admin/group.json)”   
-X POST   
-d “{\r\n "group": {\r\n "name": "dfgdfg"\r\n }\r\n}”   
-H “Content-Type: multipart/form-data”   
-H “authorization: Bearer my token”

curl “[https://community.orleu-edu.kz/admin/group.json](https://community.orleu-edu.kz/admin/group.json)”   
-X POST   
-d “{\r\n "group": {\r\n "name": ""\r\n }\r\n}”   
-H “Api-Key: key”   
-H “Content-Type: multipart/form-data”   
-H “Api-Username: nakimbekov”

This requests return same error

---

<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: [May 26, 2024, 2:44pm UTC](https://meta.discourse.org/t/cant-create-new-group-via-api-admin-groups-json-post-method/309452/4 "2024-05-26T14:44:31Z")

</div>

Not found suggests that your key isn’t working. You can look at the logs and maybe get more info.

You can try a known bad key and see that you get the same error.

I would generate a new global key and try it.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [June 25, 2024, 2:44pm UTC](https://meta.discourse.org/t/cant-create-new-group-via-api-admin-groups-json-post-method/309452/5 "2024-06-25T14:44:42Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
