# Rotations Endpoint

**Base URL:** `https://api.pagerly.io/pagerly`

All endpoints require authentication using the `X-APIKEY` header.&#x20;

***

### 🔐 Authentication

All endpoints require a valid API key to be passed in the request headers.[Generate API Key here](https://docs.pagerly.io/api/generate-api-key)

#### Headers

| Name       | Type   | Required | Description                                                                                        |
| ---------- | ------ | -------- | -------------------------------------------------------------------------------------------------- |
| `X-APIKEY` | String | ✅ Yes    | Your Pagerly-issued API key. [Generate API Key here](https://docs.pagerly.io/api/generate-api-key) |

***

### 📂 GET `/o/zapier/allteams`

#### Description

Returns a list of all teams associated with the organization identified by the provided API key. Useful for populating dropdowns in Zapier or other integrations.

#### Request

* **Method:** `GET`
* **URL:** `https://api.pagerly.io/pagerly/o/zapier/allteams`
* **Headers:** See authentication section.
* **Body:** None

#### Response

**✅ Success `200 OK`**

```json
jsonCopyEdit[
  {
    "id": "team-abc123",
    "name": "Engineering"
  },
  {
    "id": "team-def456",
    "name": "Support"
  }
]
```

If no teams exist:

```json
jsonCopyEdit[]
```

**❌ Error `400 Bad Request`**

```json
jsonCopyEdit[
  {
    "Error": "API Key is not valid"
  }
]
```

#### Example cURL

```bash
bashCopyEditcurl -X GET "https://api.pagerly.io/pagerly/o/zapier/allteams" \
  -H "X-APIKEY: your_api_key_here"
```

***

### 👥 GET `/o/currentusers`

#### Description

Returns the current on-call (rotated) users for a specific team in your organization.

#### Request

* **Method:** `GET`
* **URL:** `https://api.pagerly.io/pagerly/o/currentusers`
* **Headers:** See authentication section.
* **Query Parameters:**

| Name     | Type   | Required | Description                    |
| -------- | ------ | -------- | ------------------------------ |
| teamname | String | ✅ Yes    | The name of the team to query. |

#### Response

**✅ Success `200 OK`**

```json
jsonCopyEdit[
  {
    "id": "user-abc123",
    "name": "Alice Johnson",
    "email": "alice@example.com"
  },
  {
    "id": "user-def456",
    "name": "Bob Smith",
    "email": "bob@example.com"
  }
]
```

If no users are currently on-call:

```json
[]
```

#### Example cURL

```bash
curl -X GET "https://api.pagerly.io/pagerly/o/currentusers?teamname=Engineering" \
  -H "X-APIKEY: your_api_key_here"
```
