> ## Documentation Index
> Fetch the complete documentation index at: https://help.doozy.live/llms.txt
> Use this file to discover all available pages before exploring further.

# Calling the API from Zapier

> Learn how to integrate Doozy API with Zapier

> [!WARNING]
>
> The Doozy API is currently in **closed beta**. To request access, please email [hello@doozy.live](mailto:hello@doozy.live).

This guide walks you through calling the Doozy API from [Zapier](https://zapier.com) to automate your reporting workflows.

## Prerequisites

Before you begin, ensure you have:

* A Doozy account with API access enabled (see [Authentication](https://help.doozy.live/api/authentication.md))
* A Doozy API key
* A Zapier account (Professional plan or higher recommended for Webhooks)

## Using Webhooks by Zapier

Since there isn't a native Doozy app in Zapier, you'll use **Webhooks by Zapier** to make API requests.

**1. Create a New Zap**

Log in to Zapier and click **Create Zap**.

**2. Add a Trigger**

Choose any trigger that suits your workflow (e.g., **Schedule by Zapier** for periodic reports).

**3. Add Webhooks by Zapier Action**

Click **+** to add an action, search for **Webhooks by Zapier**, and select **Custom Request**.

**4. Configure the Request**

Set up the webhook with the following settings:

| Field | Value |
| - | - |
| **Method** | `GET` |
| **URL** | `https://api.doozy.live/v1/quizzes` |
| **Headers** | `x-api-key \| your-api-key` |

> [!NOTE]
>
> In Zapier, headers use the format `Header-Name | Header-Value`. Enter your API key as:
>
> ```
> x-api-key | dzy_xxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> ```

**5. Test the Action**

Click **Test action** to verify the connection. You should see your quiz data in the response.

## Example: Fetching a Quiz Report

To fetch detailed results for a specific quiz:

| Field | Value |
| - | - |
| **Method** | `GET` |
| **URL** | `https://api.doozy.live/v1/quizzes/{quizId}/report` |
| **Headers** | `x-api-key \| your-api-key` |

Replace `{quizId}` with the actual quiz ID from your Doozy dashboard.

## Parsing the Response

The API returns JSON data. To use specific fields in subsequent Zap steps:

**1. Access Response Data**

After testing the webhook, Zapier automatically parses the JSON response.

**2. Use Fields in Later Steps**

In subsequent actions, you can reference specific fields from the response, such as:

* `quiz.title` - The quiz title
* `summary.totalParticipants` - Number of participants
* `summary.averageScore` - Average quiz score

## Handling Pagination

For endpoints returning multiple items:

1. Make the initial request with a `limit` parameter in the URL:
   ```
   https://api.doozy.live/v1/quizzes?limit=100
   ```

2. Use Zapier's **Looping by Zapier** or **Paths** to handle pagination if you need more than 100 items.

## Example Workflow: Daily Quiz Summary to Slack

**1. Schedule Trigger**

Use **Schedule by Zapier** to run daily at your preferred time.

**2. Fetch Quiz Report**

Add **Webhooks by Zapier** → **Custom Request** to fetch `/v1/quizzes/{quizId}/report`.

**3. Format the Message**

Use **Formatter by Zapier** to create a summary message with the quiz results.

**4. Send to Slack**

Add **Slack** → **Send Channel Message** to post the summary.

## Example Workflow: Export Quiz Results to Google Sheets

**1. Schedule Trigger**

Use **Schedule by Zapier** to run weekly.

**2. Fetch Quiz Data**

Use **Webhooks by Zapier** to fetch quiz report data.

**3. Add to Spreadsheet**

Use **Google Sheets** → **Create Spreadsheet Row** to log the results.

## Error Handling

Zapier will mark a Zap step as failed if it receives a non-2xx response. Common errors:

| Error | Cause | Solution |
| - | - | - |
| **401 Unauthorized** | Invalid API key | Verify your API key is correct |
| **404 Not Found** | Resource doesn't exist | Check the quiz ID |
| **429 Too Many Requests** | Rate limit exceeded | Reduce frequency or add delays |

> [!TIP]
>
> Use Zapier's built-in **Error Handling** feature to add retry logic or send notifications when errors occur.

See [Error Handling](https://help.doozy.live/api/errors.md) for a complete list of error codes.

## Security Best Practices

> [!WARNING]
>
> Never share your Zap publicly if it contains your API key. Anyone with access to the Zap could view your key.

* Keep your Zaps private
* Regularly rotate your API keys (see [Authentication](https://help.doozy.live/api/authentication.md#rotating-api-keys))
* Monitor your Zap history for unexpected errors


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.