# Create Topic via API behalf of another user

**URL:** <https://meta.discourse.org/t/create-topic-via-api-behalf-of-another-user/162633>\
**Category:** Development\
**Tags:** rest-api\
**Created:** [September 1, 2020, 7:55am UTC](https://meta.discourse.org/t/create-topic-via-api-behalf-of-another-user/162633 "2020-09-01T07:55:02Z")\
**Posts on this page:** 3\
**Page:** 1

## AI-generated summary

[Q3manish](/t/-/162633/1) asks if it is possible to create a topic via the API on behalf of a user who is restricted from creating topics through the dashboard. [blake](/t/-/162633/2) responds that this can be achieved using an "All Users" API key by passing the target `Api-Username` in the request headers, providing a `curl` example. [Q3manish](/t/-/162633/3) clarifies that they want to prevent users from creating topics via the interface, allowing only admins to create topics on their behalf via the API. However, they note that if a user's trust level is set, the admin is unable to create topics on behalf of that user.

<div class="post-metadata">

**Author:** ![Q3manish](https://avatars.discourse-cdn.com/v4/letter/q/258eb7/32.png) [@Q3manish](https://meta.discourse.org/u/Q3manish)\
**Post date:** [September 1, 2020, 7:55am UTC](https://meta.discourse.org/t/create-topic-via-api-behalf-of-another-user/162633/1 "2020-09-01T07:55:02Z")

</div>

Is this possible create topic via API behalf of user but that user not create a topic by dashboard.

---

<div class="post-metadata">

**Author:** ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)\
**Post date:** [September 1, 2020, 3:54pm UTC](https://meta.discourse.org/t/create-topic-via-api-behalf-of-another-user/162633/2 "2020-09-01T15:54:36Z")

</div>

With an “All Users” api key you can pass in the username of the user you want the topic to be created for.

```plaintext
curl -i -sS -X POST "http://localhost:3000/posts.json" \
-H "Content-Type: multipart/form-data;" \
-H "Api-Key: 079fb2bb12d...all-users-api-key" \
-H "Api-Username: any-username" \
-F "title=9c02314d4a5 3ce4e754374 c42066df84d" \
-F "raw=7d7225b7704b973e2e352605219fce44 4328e51d07fcbe6f3d709ef54c7a0a10 78fab042da69066d242cea6c8f3b13e1"

```

I’m not sure what you mean by “not create a topic by dashboard”.

---

<div class="post-metadata">

**Author:** ![Q3manish](https://avatars.discourse-cdn.com/v4/letter/q/258eb7/32.png) [@Q3manish](https://meta.discourse.org/u/Q3manish)\
**Post date:** [September 2, 2020, 4:27am UTC](https://meta.discourse.org/t/create-topic-via-api-behalf-of-another-user/162633/3 "2020-09-02T04:27:17Z")

</div>

Thanks Blake  
I mean user not create a topic by interface ,Only admin will create topic by API behalf of user

 ![image](https://global.discourse-cdn.com/meta/original/3X/b/e/be4f13fb3734b547fca403d56c309e4f451d6844.png) .

If i set trust level of user then admin not able to create topic behalf of user.
