# Getting quest modules

### Overview

The modules endpoint allows you to fetch all available modules and their quests for a given community. When called with a user token, it provides additional information about the user's progress, including whether quests have been started, completed, or claimed.

Key features:

* Fetch all modules for a community
* Get quest details and requirements
* Track user progress when authenticated
* View quest rewards and completion status

### How It Works

1. The endpoint determines the community from the URL
2. If a user token is provided, it includes the user's progress
3. Returns modules containing quests with their completion status
4. Each quest includes required accounts, wallets, and rewards

### API Reference

```
GET /api/modules
```

#### Query Parameters

| Parameter | Type   | Required | Description                                          |
| --------- | ------ | -------- | ---------------------------------------------------- |
| `userId`  | String | No       | Automatically included when request is authenticated |

#### Response

The response includes an array of modules, each containing quest deployments with their details and user progress.

**Response Properties**

| Property                                        | Type    | Description                                     |
| ----------------------------------------------- | ------- | ----------------------------------------------- |
| `data`                                          | Array   | List of modules                                 |
| `data[].id`                                     | String  | Unique identifier of the module                 |
| `data[].name`                                   | String  | Name of the module                              |
| `data[].description`                            | String  | Description of the module                       |
| `data[].deployments`                            | Array   | List of quests in the module                    |
| `data[].deployments[].id`                       | String  | Unique identifier of the quest                  |
| `data[].deployments[].title`                    | String  | Title of the quest                              |
| `data[].deployments[].description`              | String  | Description of the quest                        |
| `data[].deployments[].tasks`                    | Array   | List of tasks in the quest                      |
| `data[].deployments[].tasks[].id`               | String  | Unique identifier of the task                   |
| `data[].deployments[].tasks[].name`             | String  | Name of the task                                |
| `data[].deployments[].tasks[].type`             | String  | Type of the task (e.g., 'custom')               |
| `data[].deployments[].tasks[].requiredWallets`  | Array   | List of required wallet configurations          |
| `data[].deployments[].tasks[].requiredAccounts` | Array   | List of required account types                  |
| `data[].deployments[].quest`                    | Object  | Quest configuration and rewards                 |
| `data[].deployments[].isClaimed`                | Boolean | Whether the user has claimed the rewards        |
| `data[].deployments[].isStarted`                | Boolean | Whether the quest is available to claim         |
| `data[].deployments[].isEnded`                  | Boolean | Whether the quest has ended                     |
| `data[].deployments[].requiredQuests`           | Array   | List of quests ids that must be completed first |

### Example Response

```json
{
  "data": [
    {
      "id": "mod-123abc",
      "name": "Community Onboarding",
      "description": "Get started with our community",
      "deployments": [
        {
          "id": "quest-456def",
          "title": "Join Our Community",
          "description": "Connect with us on social media",
          "tasks": [
            {
              "id": "task-789ghi",
              "name": "Join Discord Server",
              "type": "custom",
              "config": {},
              "source": {
                "type": "TEMPLATE",
                "templateId": "template-abc123"
              },
              "description": "Join our Discord community",
              "requiredWallets": [],
              "requiredAccounts": ["discord"],
              "validationConfig": {
                "automationId": null,
                "automationInputs": {}
              }
            }
          ],
          "metadata": {},
          "quest": {
            "id": "quest-456def",
            "metadata": {
              "moduleId": "mod-123abc"
            },
            "rewards": {
              "pointsReward": 100,
              "leaderboardId": "leaderboard-xyz789"
            },
            "requiredAccounts": ["discord"],
            "requiredWallets": []
          },
          "isClaimed": false,
          "isStarted": true,
          "isEnded": false,
          "requiredQuests": []
        }
      ]
    }
  ]
}
```

### Example Usage

```javascript
// Fetch modules without authentication
const response = await fetch('https://your-community.domino.page/api/modules');
const modules = await response.json();

// Fetch modules with authentication to get progress
const authenticatedResponse = await fetch('https://your-community.domino.page/api/modules', {
  headers: {
    'x-api-key': 'user-api-token-here'
  }
});
const modulesWithProgress = await authenticatedResponse.json();
```


---

# 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.domino.run/docs/getting-quest-modules.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.
