Personal access tokens API
The personal access tokens endpoints, each in TypeScript, Python, the CLI and curl.
Set up
Section titled “Set up”This takes a personal access token, not an API key. In the SDKs, pass it as token.
npm install @limitry/sdkexport LIMITRY_TOKEN="<your personal access token>"pip install limitryexport LIMITRY_TOKEN="<your personal access token>"npm install -g @limitry/clilimitry loginexport LIMITRY_TOKEN="<your personal access token>"Get the current user
Section titled “Get the current user”GET /v1/user/me Try it in the API playground (opens in a new tab) Returns the user the personal access token belongs to, and their workspace memberships.
import { createClient } from "@limitry/sdk";
const limitry = createClient({ token: process.env.LIMITRY_TOKEN });const me = await limitry.user.me();console.log(me);import os
from limitry import Limitry
limitry = Limitry(token=os.environ["LIMITRY_TOKEN"])me = limitry.user.me()print(me)limitry user mecurl -X GET "https://api.limitry.com/v1/user/me" \ -H "Authorization: Bearer $LIMITRY_TOKEN"Returns:
{ "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
Section titled “Revoke the token making this request”DELETE /v1/user/token Try it in the API playground (opens in a new tab) Revokes the personal access token that makes the request.
import { createClient } from "@limitry/sdk";
const limitry = createClient({ token: process.env.LIMITRY_TOKEN });await limitry.user.revokeToken();import os
from limitry import Limitry
limitry = Limitry(token=os.environ["LIMITRY_TOKEN"])limitry.user.revoke_token()limitry user revoke-token --yescurl -X DELETE "https://api.limitry.com/v1/user/token" \ -H "Authorization: Bearer $LIMITRY_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.