# Workspace API

> The workspace endpoints, each in TypeScript, Python, the CLI and curl.

The workspace endpoints, each in TypeScript, Python, the CLI and curl.

## Set up

* TypeScript

  ```bash
  npm install @limitry/sdk
  export LIMITRY_API_KEY="lim_test_…"
  ```

* Python

  ```bash
  pip install limitry
  export LIMITRY_API_KEY="lim_test_…"
  ```

* CLI

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

* curl

  ```bash
  export LIMITRY_API_KEY="lim_test_…"
  ```

To pass the key yourself, use `createClient({ apiKey: key })` in TypeScript or `Limitry(api_key=key)` in Python.

## Get the current workspace

`GET /v1/workspace`[ Try it in the API playground (opens in a new tab)](https://api.limitry.com/v1/docs#tag/workspace/GET/workspace)

Scope: `workspace:read`.

Returns the workspace the credential acts in.

* TypeScript

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

  // Uses the LIMITRY_API_KEY environment variable.
  const limitry = createClient();
  const workspace = await limitry.workspace.get();
  console.log(workspace);
  ```

* Python

  ```python
  from limitry import Limitry

  # Uses the LIMITRY_API_KEY environment variable.
  limitry = Limitry()
  workspace = limitry.workspace.get()
  print(workspace)
  ```

* CLI

  ```bash
  limitry workspace get
  ```

* curl

  ```bash
  curl -X GET "https://api.limitry.com/v1/workspace" \
    -H "Authorization: Bearer $LIMITRY_API_KEY"
  ```

**Returns:**

```json
{
  "id": "ws_9418b705-3720-48ca-b2bf-f726d1456684",
  "name": "Acme Inc.",
  "slug": "acme",
  "createdAt": "2026-08-19T12:00:00.000Z"
}
```

More about this endpoint

For an API key, that is the key’s own workspace. For a personal access token, it is the one named in `X-Workspace`. Use it as a smoke test for an integration (“who am I?”).

## List workspace members

`GET /v1/workspace/members`[ Try it in the API playground (opens in a new tab)](https://api.limitry.com/v1/docs#tag/workspace/GET/workspace/members)

Scope: `workspace.members:read`.

Lists the workspace’s members and their roles, newest first.

* TypeScript

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

  // Uses the LIMITRY_API_KEY environment variable.
  const limitry = createClient();
  const members = await limitry.workspace.members.list();
  console.log(members);
  ```

* Python

  ```python
  from limitry import Limitry

  # Uses the LIMITRY_API_KEY environment variable.
  limitry = Limitry()
  members = limitry.workspace.members.list()
  print(members)
  ```

* CLI

  ```bash
  limitry workspace members list
  ```

* curl

  ```bash
  curl -X GET "https://api.limitry.com/v1/workspace/members" \
    -H "Authorization: Bearer $LIMITRY_API_KEY"
  ```

**Returns:**

```json
{
  "items": [
    {
      "id": "mem_5070e1f6-5adf-4170-92bd-20cac815d34c",
      "userId": "usr_4f8a2c1e-7b3d-4e9f-a6c5-2d1b0e9f8a7c",
      "name": "Ana Lopez",
      "email": "ana@example.com",
      "role": "member",
      "joinedAt": "2026-08-19T12:00:00.000Z"
    }
  ],
  "nextCursor": null
}
```

| Field                  | Description                                     |
| ---------------------- | ----------------------------------------------- |
| `limit` number, query  | Items per page, 1–100 (default 25).             |
| `cursor` string, query | Opaque token from a previous page's nextCursor. |

More about this endpoint

Paginate with the opaque `nextCursor`. `limit` takes 1 to 100 and defaults to 25. Invite members, remove them and give them roles in the app.

## List pending invitations

`GET /v1/workspace/invitations`[ Try it in the API playground (opens in a new tab)](https://api.limitry.com/v1/docs#tag/workspace/GET/workspace/invitations)

Scope: `workspace.members:read`.

Lists the invitations that are not yet accepted, declined or expired, newest first.

* TypeScript

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

  // Uses the LIMITRY_API_KEY environment variable.
  const limitry = createClient();
  const invitations = await limitry.workspace.invitations.list();
  console.log(invitations);
  ```

* Python

  ```python
  from limitry import Limitry

  # Uses the LIMITRY_API_KEY environment variable.
  limitry = Limitry()
  invitations = limitry.workspace.invitations.list()
  print(invitations)
  ```

* CLI

  ```bash
  limitry workspace invitations list
  ```

* curl

  ```bash
  curl -X GET "https://api.limitry.com/v1/workspace/invitations" \
    -H "Authorization: Bearer $LIMITRY_API_KEY"
  ```

**Returns:**

```json
{
  "items": [
    {
      "id": "inv_c1d9e0a4-2b7f-4e3a-9f6d-8a5b4c3e2f10",
      "email": "sam@example.com",
      "role": "member",
      "teamIds": [
        "team_5cfbfbdc-bd74-4b1b-aacf-cc18a0ab960e"
      ],
      "expiresAt": "2026-08-21T12:00:00.000Z",
      "createdAt": "2026-08-19T12:00:00.000Z"
    }
  ],
  "nextCursor": null
}
```

| Field                  | Description                                     |
| ---------------------- | ----------------------------------------------- |
| `limit` number, query  | Items per page, 1–100 (default 25).             |
| `cursor` string, query | Opaque token from a previous page's nextCursor. |

More about this endpoint

With a personal credential, only owners and admins can call this, as in the app. A workspace API key always can. Paginate with the opaque `nextCursor`.

## Get your plan’s usage this period

`GET /v1/workspace/plan-usage`[ Try it in the API playground (opens in a new tab)](https://api.limitry.com/v1/docs#tag/workspace/GET/workspace/plan-usage)

Scope: `workspace:read`.

Returns what the workspace used this period, with one entry for each thing its plan counts.

* TypeScript

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

  // Uses the LIMITRY_API_KEY environment variable.
  const limitry = createClient();
  const planUsage = await limitry.workspace.planUsage.get();
  console.log(planUsage);
  ```

* Python

  ```python
  from limitry import Limitry

  # Uses the LIMITRY_API_KEY environment variable.
  limitry = Limitry()
  plan_usage = limitry.workspace.plan_usage.get()
  print(plan_usage)
  ```

* CLI

  ```bash
  limitry workspace plan-usage get
  ```

* curl

  ```bash
  curl -X GET "https://api.limitry.com/v1/workspace/plan-usage" \
    -H "Authorization: Bearer $LIMITRY_API_KEY"
  ```

**Returns:**

```json
{
  "periodStart": "2026-10-17T14:30:00.000Z",
  "periodEnd": "2026-11-17T14:30:00.000Z",
  "state": "grace",
  "counts": [
    {
      "id": "webhook_deliveries",
      "label": "Webhook deliveries",
      "unit": "per month",
      "description": "Webhook deliveries this period",
      "used": 10400,
      "limit": 10000,
      "stopsAt": 11000,
      "state": "grace",
      "overage": {
        "label": "Extra checks",
        "rate": "$40 per million checks",
        "extraUnits": 700000,
        "costCents": 2800,
        "capCents": 3900,
        "defaultCapCents": 3900,
        "capIsDefault": true
      }
    }
  ],
  "notices": []
}
```

More about this endpoint

Each entry has the plan’s limit, or null when there is no limit. Each entry also says where it stands and where we start refusing new use. A period is one month from the workspace’s billing date. That date comes from its subscription or, without one, from the day you created the workspace. On an annual plan, the counts still reset every month from the subscription’s start.

## List teams

`GET /v1/workspace/teams`[ Try it in the API playground (opens in a new tab)](https://api.limitry.com/v1/docs#tag/workspace/GET/workspace/teams)

Scope: `workspace.teams:read`.

Lists the workspace’s teams and their members’ user ids, newest first.

* TypeScript

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

  // Uses the LIMITRY_API_KEY environment variable.
  const limitry = createClient();
  const teams = await limitry.workspace.teams.list();
  console.log(teams);
  ```

* Python

  ```python
  from limitry import Limitry

  # Uses the LIMITRY_API_KEY environment variable.
  limitry = Limitry()
  teams = limitry.workspace.teams.list()
  print(teams)
  ```

* CLI

  ```bash
  limitry workspace teams list
  ```

* curl

  ```bash
  curl -X GET "https://api.limitry.com/v1/workspace/teams" \
    -H "Authorization: Bearer $LIMITRY_API_KEY"
  ```

**Returns:**

```json
{
  "items": [
    {
      "id": "team_5cfbfbdc-bd74-4b1b-aacf-cc18a0ab960e",
      "name": "Engineering",
      "isDefault": false,
      "memberIds": [
        "usr_4f8a2c1e-7b3d-4e9f-a6c5-2d1b0e9f8a7c"
      ],
      "createdAt": "2026-08-19T12:00:00.000Z"
    }
  ],
  "nextCursor": null
}
```

| Field                  | Description                                     |
| ---------------------- | ----------------------------------------------- |
| `limit` number, query  | Items per page, 1–100 (default 25).             |
| `cursor` string, query | Opaque token from a previous page's nextCursor. |

More about this endpoint

Paginate with the opaque `nextCursor`. `limit` takes 1 to 100 and defaults to 25. Create teams and add members to them in the app.
