Question: In the [Matrix](https://matrix.org/) instant messaging protocol, when using the reference implementation of the Matrix server (called `synapse`), there is an [admin API](https://github.com/matrix-org/synapse/blob/master/docs/admin_api/) with functions like [resetting a password](https://github.com/matrix-org/synapse/blob/master/docs/admin_api/user_admin_api.rst#reset-password) for a user etc..

Accessing this requires an [`access_token`](https://matrix.org/docs/spec/client_server/latest#using-access-tokens) "API key" of a server admin user.

How do I get one?

Answer: 
Solution to find your access token:

1. Log in to the account you want to get the access token for. Click on the name in the top left corner, then "Settings".
2. Click the "Help & About" tab (left side of the dialog).
3. Scroll to the bottom and click on `<click to reveal>` part of Access
Token.
4. Copy your access token to a safe place.
With the current version of the Matrix protocol, getting an access\_token programmatically works slightly different:

To find out the endpoint, e.g., for matrix.org, you need to check a `.well-known` file for the API URL ([Documentation](https://spec.matrix.org/v1.1/client-server-api/#well-known-uri)): `https://matrix.org/.well-known/matrix/client`:

```
$ curl https://matrix.org/.well-known/matrix/client
{
    "m.homeserver": {
        "base_url": "https://matrix-client.matrix.org"
    },
    "m.identity_server": {
        "base_url": "https://vector.im"
    }
}

```

Afterwards, the homeserver base url can be used for the curl call ([See Documentation for the /login endpoint](https://spec.matrix.org/v1.1/client-server-api/#post_matrixclientv3login)):

```
$ curl '{"type":"m.login.password", "user":"'$username'", "password":"'$password'"} \ 
"https://$base_url/_matrix/client/v3/login"

{
  "user_id":"@username:matrix.org",
  "access_token":"token",
  "home_server":"matrix.org",
  "device_id":"ID",
  "well_known": { 
    "m.homeserver": {
      "base_url":"https://matrix-client.matrix.org/"
    }
  }
}

```