# Getting Started Using the Admin API

<!---
Actions needed:
- [ ] 

# Getting Started Using the Admin API
--->

<!---<p class="callout info">Remember to check our <a href="https://ems-docs.element.io/books/kieranml-test-book/page/have-you-tried-httpselementiohelp">Looking for help?</a> page for answers to Frequently Asked Questions and our User Guide!</p>--->

The <a href="https://element-hq.github.io/synapse/latest/usage/administration/admin_api/" target="_blank" rel="noopener noreferrer">Synapse Admin API</a> allows administration of your homeserver, such as managing users, rooms and media. In order to make use of the API you will need to have an admin user account present on the homeserver you wish to manage.

### Promoting a Matrix Account to Admin

If you're an EMS customer, you can create / manage your users via the <a href="https://ems.element.io/user/hosting#/admin" target="_blank" rel="noopener noreferrer">Server Admin</a> tab of the <a href="https://ems.element.io/user/hosting" target="_blank" rel="noopener noreferrer">EMS Control Panel</a>.
<!---Check out the [Server Admin]() section of the [EMS Control Panel]() doc for more guidance.--->

If you're an ESS customer, you can create / manage your users via your admin dashboard, or via the Admin tab available when running the installer.

Promote the user you will be using to Admin by clicking on the desired user, and checking the `Admin` checkbox and confirming.

### Getting your `access_token`

In order to use the <a href="https://element-hq.github.io/synapse/latest/usage/administration/admin_api/" target="_blank" rel="noopener noreferrer">Synapse Admin API</a> you will need to authenticate your calls to the API using an `access_token` from an Admin user account. You can find your `access_token` from the `Help & About` section of your settings. Check out the [Help & About](https://ems-docs.element.io/books/element-support/page/help-about) page from the [Element Web/Desktop Client Settings](https://ems-docs.element.io/books/element-support/chapter/element-webdesktop-client-settings) chapter for more guidance.

### Making an Admin API request

Using your preferred method, you will need to authenticate each request to an Admin API endpoint by providing the token as either a query parameter or a request header. To add it as a request header in cURL, you can use the following, replacing `syt_AjfVef2_L33JNpafeif_0feKJfeaf0CQpoZk` with your own `access_token`:

```bash
curl --header "Authorization: Bearer syt_AjfVef2_L33JNpafeif_0feKJfeaf0CQpoZk" -X GET http://127.0.0.1:8008/_synapse/admin/v2/users/@foo:bar.com
```

Here is the equivalent action using Python and the `requests` library:

```python
import requests

headers = {
    'Authorization': 'Bearer syt_AjfVef2_L33JNpafeif_0feKJfeaf0CQpoZk',
}

response = requests.get('http://127.0.0.1:8008/_synapse/admin/v2/users/@foo:bar.com', headers=headers)
```

Further details on the using the API are out-of-scope for this documentation, please consult the <a href="https://element-hq.github.io/synapse/latest/usage/administration/admin_api/" target="_blank" rel="noopener noreferrer">Synapse Admin API</a> documentation. You will find multiple sections covering its use, such as <a href="https://element-hq.github.io/synapse/latest/admin_api/rooms.html" target="_blank" rel="noopener noreferrer">Rooms</a>, <a href="https://element-hq.github.io/synapse/latest/admin_api/user_admin_api.html" target="_blank" rel="noopener noreferrer">Users</a> and <a href="https://element-hq.github.io/synapse/latest/admin_api/media_admin_api.html" target="_blank" rel="noopener noreferrer">Media</a>.