# Unable to create new topic via API

**URL:** <https://meta.discourse.org/t/unable-to-create-new-topic-via-api/146319>\
**Category:** Development\
**Created:** [March 31, 2020, 5:44pm UTC](https://meta.discourse.org/t/unable-to-create-new-topic-via-api/146319 "2020-03-31T17:44:54Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![xceph](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xceph/32/174216_2.png) [@xceph](https://meta.discourse.org/u/xceph)\
**Post date:** [March 31, 2020, 5:44pm UTC](https://meta.discourse.org/t/unable-to-create-new-topic-via-api/146319/1 "2020-03-31T17:44:54Z")

</div>

I’ve created an API token using the API, my response after the auth redirect looks so like:  
{  
api = 4;  
key = bd0553a26566b6ace74869ad6042fc22;  
nonce = “5A3D2DD2-D6E3-4539-BDE1-3F114B9EC3A1”;  
push = 0;  
}

I then try and create a new post using the API like so:

```
---REQUEST------------------
URL: https://myserver.com/posts.json
METHOD: POST
Api-Key: bd0553a26566b6ace74869ad6042fc22
Content-Type: application/json
Api-Username: AndrewB
BODY: {
  "title" : "Test topic",
  "raw" : "This is posted from the API",
  "category" : 0
}
----------------------------

```

But I get an invalid access error:

```
---RESPONSE------------------
URL: https://myserver.com/posts.json
MIMEType: application/json
Status Code: 403
Content-Type: application/json; charset=utf-8
x-runtime: 0.006244
Content-Encoding: gzip
Server: nginx
x-download-options: noopen
x-xss-protection: 1; mode=block
x-permitted-cross-domain-policies: none
referrer-policy: strict-origin-when-cross-origin
Date: Tue, 31 Mar 2020 17:37:54 GMT
x-request-id: 82b293d8-a609-42b1-8338-dcbdcbc72a61
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
Vary: Accept-Encoding
Response Data: {"errors":["You are not permitted to view the requested resource. The API username or key is invalid."],"error_type":"invalid_access"}
Response JSON: {
    "error_type" = "invalid_access";
    errors = (
        "You are not permitted to view the requested resource. The API username or key is invalid."
    );
}
----------------------------

```

The users account looks like so:

 ![Screen Shot 2020-03-31 at 3.09.21 PM](https://global.discourse-cdn.com/meta/original/3X/4/c/4c109495b7109e5ed603240456e7a96facf38b0d.png)

Admins API section:

 ![Screen Shot 2020-03-31 at 3.17.22 PM](https://global.discourse-cdn.com/meta/original/3X/1/3/137ffbceecbc519e729cd3ca03448c0fa63ce63e.png)  
Am I missing something obvious here? Any help is apprecaited!

---

_[View the full topic](https://meta.discourse.org/t/unable-to-create-new-topic-via-api/146319)._
