# Checking claim status

### Overview

The Check Quest Claim endpoint allows you to verify whether a specific user has claimed a particular quest. This is useful for:

* Preventing duplicate quest completions
* Validating eligibility for rewards
* Tracking user progress through quest journeys

### How It Works

The endpoint accepts a quest ID and user identifiers, then:

1. Locates the user based on the provided identifiers
2. Checks if that user has claimed the specified quest
3. Returns the claim status and relevant user/quest details

### API Reference

```
POST /api/quests/check-claim
```

#### Request Parameters

| Parameter | Type   | Description                                |
| --------- | ------ | ------------------------------------------ |
| `questId` | String | **Required**. The ID of the quest to check |

{% hint style="info" %}
You can find the `questId` in the sharing panel of the quest editor.
{% endhint %}

You must also include **at least one** of the following user identifiers:

| Parameter     | Type   | Description                           |
| ------------- | ------ | ------------------------------------- |
| `externalId`  | String | User's ID in your external system     |
| `discordId`   | String | User's Discord ID                     |
| `twitterId`   | String | User's Twitter/X ID                   |
| `telegramId`  | String | User's Telegram ID                    |
| `zealyUserId` | String | User's Zealy ID                       |
| `wallet`      | Object | User's wallet information (see below) |

The `wallet` object can include:

```json
{
  "walletAddress": "0x123...",
  "type": "ethereum",
  "network": "mainnet",
  "provider": "metamask"
}
```

#### Response

**User Found, Quest Exists**

```json
{
  "claimed": true, // or false
  "user": {
    "id": "user-id",
    "externalId": "external-id-if-exists"
  },
  "quest": {
    "id": "quest-id",
    "title": "Quest Title"
  }
}
```

**User Found, Quest Not Found**

```json
{
  "claimed": false,
  "reason": "Quest not found",
  "user": {
    "id": "user-id",
    "externalId": "external-id-if-exists"
  }
}
```

**User Not Found**

```json
{
  "claimed": false,
  "reason": "User not found"
}
```

#### Example Request

{% hint style="info" %}
Replace `your-community` in the URL with your community slug. You can find your community slug in your community URL - it's the part before `.domino.page`. For example, if your community URL is `my-community.domino.page`, your slug is `my-community`.
{% endhint %}

```javascript
const response = await fetch('https://your-community.domino.page/api/quests/check-claim', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'your-domino-api-key'
  },
  body: JSON.stringify({
    questId: 'quest-123',
    externalId: 'user-456'
  })
});

const data = await response.json();
const hasClaimed = data.claimed;
```

### Usage Examples

#### Checking Before Showing Quest Content

```javascript
// Check if user has already claimed this quest
const checkResponse = await checkQuestClaim({ 
  questId: 'quest-123', 
  externalId: 'user-456' 
});

if (checkResponse.claimed) {
  // Show "already completed" message
  showCompletedMessage();
} else {
  // Show quest content
  showQuestContent();
}
```
