# Api access token-tutor

**URL:** <https://discuss.openedx.org/t/api-access-token-tutor/8109>\
**Category:** Development\
**Tags:** api, tutor\
**Created:** [August 18, 2022, 5:27am UTC](https://discuss.openedx.org/t/api-access-token-tutor/8109 "2022-08-18T05:27:16Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![venkatsai1234](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/venkatsai1234/32/4276_2.png) [@venkatsai1234](https://discuss.openedx.org/u/venkatsai1234)\
**Post date:** [August 18, 2022, 5:27am UTC](https://discuss.openedx.org/t/api-access-token-tutor/8109/1 "2022-08-18T05:27:16Z")

</div>

I am trying to get the access token from postman using client ID and client Secret, but the response from the postman is “INVALID CLIENT”, why i am getting this response instead of access token?  
I am followin this doc to get client ID and client Secret [2. Authenticating as an edX REST Web Service User — EdX Course Catalog API User Guide documentation](https://course-catalog-api-guide.readthedocs.io/en/latest/authentication/index.html#getting-a-client-id-and-client-secret)

---

<div class="post-metadata">

**Author:** ![mgmdi](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/mgmdi/32/1684_2.png) [@mgmdi](https://discuss.openedx.org/u/mgmdi)\
**Post date:** [August 19, 2022, 6:02pm UTC](https://discuss.openedx.org/t/api-access-token-tutor/8109/2 "2022-08-19T18:02:38Z")

</div>

Hello! This is how I usually request the token:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/openedx/original/2X/6/6402544df47e3ae6a4983826086b8960861def28.png)

is there something different? can you attach your Django Oauth Toolkit application setup?

---

<div class="post-metadata">

**Author:** ![sarina](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/sarina/32/2308_2.png) [@sarina](https://discuss.openedx.org/u/sarina)\
**Post date:** [August 19, 2022, 8:46pm UTC](https://discuss.openedx.org/t/api-access-token-tutor/8109/3 "2022-08-19T20:46:18Z")

</div>

Hi! I’ve moved your question to the “Development” topic. Choosing the right topic when you make a post is important for visibility; the default (“Community”) is almost never what you want.

---

<div class="post-metadata">

**Author:** ![TonyH](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/tonyh/32/4079_2.png) [@TonyH](https://discuss.openedx.org/u/TonyH)\
**Post date:** [August 20, 2022, 5:04am UTC](https://discuss.openedx.org/t/api-access-token-tutor/8109/4 "2022-08-20T05:04:41Z")

</div>

Hi @venkatsai1234,

It’s not clear what could be causing that response without additional information. Here is how we generate our keys to access our API using Tutor, but the instructions should apply to other installation methods. I hope it helps!

* * *

These instructions explain how to generate an **OAuth token to access the API endpoints** using `Authorization Bearer` on Open edX. This method demonstrates one of the several ways of accessing the API.

## Create an API User (optional)

This step is optional if you already have a user that you want to use for API access. We haven’t tested it, but you can probably give specific permissions to a non-superuser account. There is some security risk to giving your API user admin rights.

```auto
tutor local createuser --staff --superuser api-user api@example.com

```

## Create the Application API

The first step is to create an OAuth API application.

1. Log into your LMS admin panel at `https://your-edx/admin`.

2. Navigate to `OAuth Applications` at `https://your-edx/admin/oauth2_provider/application/`

3. Press the `Add Application button.

4. Save the OAuth application.

## Create an Access Token

Next, you will create an access token for the API user to access the API application

1. Navigate to `Access tokens` at `https://your-edx/admin/oauth2_provider/accesstoken/`.

2. Press the `Add Access Token +` button.

3. Save to access token

## Testing and Using the API

**Tip:** Use the API Docs page to generate the API URL.

### Using API-DOCS Test site

1. First, open the API docs page (`https://your-edx/api-docs`) and log in using your API user with admin rights.

2. Find an API endpoint to test, such as a GET request for `/course_modes/v1/courses/{course_id}/`

### Using curl

You can use `curl` to access the API remotely using this syntax:

```auto
curl "<URL>" -H "Authorization: Bearer <ACCESS_TOKEN>"

```

1. **URL:** Use the `Request URL` from the API-DOC test
2. **ACCESS\_TOKEN:** Use the access token for your API user

---

<div class="post-metadata">

**Author:** ![venkatsai1234](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/venkatsai1234/32/4276_2.png) [@venkatsai1234](https://discuss.openedx.org/u/venkatsai1234)\
**Post date:** [August 22, 2022, 5:17am UTC](https://discuss.openedx.org/t/api-access-token-tutor/8109/5 "2022-08-22T05:17:59Z")

</div>

Thank you @TonyH @mgmdi @sarina for the valuable information, i will try to implement whatever u have given @TonyH and will inform you @mgmdi if it is different in my Django pannel.

---

<div class="post-metadata">

**Author:** ![SeifHafri](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/seifhafri/32/4432_2.png) [@SeifHafri](https://discuss.openedx.org/u/SeifHafri)\
**Post date:** [April 12, 2023, 11:18pm UTC](https://discuss.openedx.org/t/api-access-token-tutor/8109/6 "2023-04-12T23:18:52Z")

</div>

Thank you @TonyH been struggling whole day and now it works like charm! very clear and helpful

---

<div class="post-metadata">

**Author:** ![David\_Sperber](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/david_sperber/32/5449_2.png) [@David\_Sperber](https://discuss.openedx.org/u/David_Sperber)\
**Post date:** [June 15, 2023, 6:35am UTC](https://discuss.openedx.org/t/api-access-token-tutor/8109/7 "2023-06-15T06:35:42Z")

</div>

Hi @TonyH

1. I was able to create a CCX class  
But can’t delete via API, I get an error detail":"You do not have permission to perform this action
2. I would be happy to receive an explanation in the creation of USER does not work for me

---

<div class="post-metadata">

**Author:** ![TonyH](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/tonyh/32/4079_2.png) [@TonyH](https://discuss.openedx.org/u/TonyH)\
**Post date:** [June 15, 2023, 9:13am UTC](https://discuss.openedx.org/t/api-access-token-tutor/8109/8 "2023-06-15T09:13:58Z")

</div>

Hi @David_Sperber,

Unfortunately, I do not have experience using CCX. Some actions might require the user to be part of the course. Also, I have not tried creating a user through the API. My suggestion is to find the API code in the code repository and then see what requirements are missing or incorrect. I know that the `api-docs` page was incomplete, meaning you needed to find the required args from the function declaration itself.

Kind regards,  
Tony

---

<div class="post-metadata">

**Author:** ![choltha](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/choltha/32/7661_2.png) [@choltha](https://discuss.openedx.org/u/choltha)\
**Post date:** [July 3, 2024, 4:08am UTC](https://discuss.openedx.org/t/api-access-token-tutor/8109/9 "2024-07-03T04:08:48Z")

</div>

I can not access api [http://lms.xxxxxx/api/user/v1/users/?page=10&page\_size=10](http://lms.xxxxxx/api/user/v1/users/?page=10&page_size=10)  
show massage {“detail”:“You do not have permission to perform this action.”}

but i can access [http://lms.xxxxxx/api/user/v1/me](http://lms.xxxxxx/api/user/v1/me)

if i want access api/user/v1/users/?page=10&page\_size=10 How to config?

---

<div class="post-metadata">

**Author:** ![TonyH](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/tonyh/32/4079_2.png) [@TonyH](https://discuss.openedx.org/u/TonyH)\
**Post date:** [July 3, 2024, 5:02am UTC](https://discuss.openedx.org/t/api-access-token-tutor/8109/10 "2024-07-03T05:02:33Z")

</div>

@choltha, that’s a good question. 🤔 I haven’t tried getting all users through the API. Here are some things you might try:

- Try getting the list of users using `curl "<domain>/api/user/v1/users/?page=10&page_size=10" -H "Authorization: Bearer <ACCESS_TOKEN>"` to see if the code is the same using the API user, not the logged in user
- Verify that the API user has access to all users
- The API might limit getting all users due to security. In which case, you’ll have to find another way. For example, have an offline list of all user and then have your code call the API to get each user’s detail, such as: `GET /api/user/v1/accounts/{username}/`

---

<div class="post-metadata">

**Author:** ![choltha](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/choltha/32/7661_2.png) [@choltha](https://discuss.openedx.org/u/choltha)\
**Post date:** [July 3, 2024, 9:25am UTC](https://discuss.openedx.org/t/api-access-token-tutor/8109/11 "2024-07-03T09:25:00Z")

</div>

@TonyH  
Thank you.

---

<div class="post-metadata">

**Author:** ![Natacha\_Quilichini](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/natacha_quilichini/32/7375_2.png) [@Natacha\_Quilichini](https://discuss.openedx.org/u/Natacha_Quilichini)\
**Post date:** [September 19, 2024, 7:45am UTC](https://discuss.openedx.org/t/api-access-token-tutor/8109/12 "2024-09-19T07:45:03Z")

</div>

I can’t find the token for my Open edX when I used the API tester Bruno with the `api/user/v1/account/login_session` endpoint.
