# Personal access tokens API

> The personal access tokens endpoints, each in TypeScript, Python, the CLI and curl.

The personal access tokens endpoints, each in TypeScript, Python, the CLI and curl.

## Set up

This takes a [personal access token](/docs/authentication/), not an API key. In the SDKs, pass it as `token`.

* TypeScript

  ```bash
  npm install @reminix/sdk
  export REMINIX_TOKEN="<your personal access token>"
  ```

* Python

  ```bash
  pip install reminix
  export REMINIX_TOKEN="<your personal access token>"
  ```

* CLI

  ```bash
  npm install -g @reminix/cli
  reminix login
  ```

* curl

  ```bash
  export REMINIX_TOKEN="<your personal access token>"
  ```

## Get the current user

`GET /v1/user/me`[ Try it in the API playground (opens in a new tab)](https://api.reminix.com/v1/docs#tag/personal-access-tokens/GET/user/me)

Returns the user the personal access token belongs to, and their workspace memberships.

* TypeScript

  ```ts
  import { createClient } from "@reminix/sdk";

  const reminix = createClient({ token: process.env.REMINIX_TOKEN });
  const me = await reminix.user.me();
  console.log(me);
  ```

* Python

  ```python
  import os

  from reminix import Reminix

  reminix = Reminix(token=os.environ["REMINIX_TOKEN"])
  me = reminix.user.me()
  print(me)
  ```

* CLI

  ```bash
  reminix user me
  ```

* curl

  ```bash
  curl -X GET "https://api.reminix.com/v1/user/me" \
    -H "Authorization: Bearer $REMINIX_TOKEN"
  ```

**Returns:**

```json
{
  "id": "usr_4f8a2c1e-7b3d-4e9f-a6c5-2d1b0e9f8a7c",
  "name": "Casey Customer",
  "email": "casey@example.com",
  "workspaces": [
    {
      "id": "ws_9418b705-3720-48ca-b2bf-f726d1456684",
      "name": "Acme Inc.",
      "slug": "acme",
      "role": "owner"
    }
  ]
}
```

More about this endpoint

Use it as a smoke test for an integration (“who am I?”).

## Revoke the token making this request

`DELETE /v1/user/token`[ Try it in the API playground (opens in a new tab)](https://api.reminix.com/v1/docs#tag/personal-access-tokens/DELETE/user/token)

Revokes the personal access token that makes the request.

* TypeScript

  ```ts
  import { createClient } from "@reminix/sdk";

  const reminix = createClient({ token: process.env.REMINIX_TOKEN });
  await reminix.user.revokeToken();
  ```

* Python

  ```python
  import os

  from reminix import Reminix

  reminix = Reminix(token=os.environ["REMINIX_TOKEN"])
  reminix.user.revoke_token()
  ```

* CLI

  ```bash
  reminix user revoke-token --yes
  ```

* curl

  ```bash
  curl -X DELETE "https://api.reminix.com/v1/user/token" \
    -H "Authorization: Bearer $REMINIX_TOKEN"
  ```

**Returns** nothing (`204`).

More about this endpoint

Use it to sign out from a script or the CLI (`logout`). The token stops working immediately. Your other tokens keep working.
