# Rotations Endpoint

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

All endpoints require authentication using the `X-APIKEY` header.

***

### 🔐 Authentication

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

#### Headers

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

***

### 📂 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"
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pagerly.io/api/rotations-endpoint.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
