> For the complete documentation index, see [llms.txt](https://docs.xp-protocol.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xp-protocol.io/products/xp-protocol/features/claims.md).

# Claims

The score-updating process requires a trusted party to initiate a score update for a specific user. This can be done manually through the dashboard, or by any number of integration operators.

On the other hand, if we have score updates that we want users themselves to execute for participating in certain events/IRL attendance, we have XP Claims.

XP Claims are user-serviceable score updates. This means that a claim can be executed by a user directly without the need for backend verification.

XP Claims can be executed by linking to a claim via the **Discover** website endpoint below

```javascript
https://discover.xp-protocol.io/xpclaim/<CLAIM ID HERE>
```

\
Creating a Claim
----------------

A claim can be created via the XP Dashboard or directly from our REST API.

1. <https://dashboard.xp-protocol.io>
2. Below is an example of a call directly to the REST API

```javascript
 
   import Web3 from 'web3';
      
      let expireDateUnix = Math.floor(date.getTime() / 1000);

      const signature = await web3.eth.personal.sign(
        timestamp,/// in seconds
         <xp owner wallet address> //This wallet must be an owner of the XP Instance
      );

      let claimData = {
        claimData: {
          xpProjectId: <projectId>,
          description: <claimDescription>,
          name: <claimName>,
          points: <points>,
          updateIdFormat: "singleUse",//only supports singleUse on v1
          xpAction: <action-name>,//name the action that will be fired when triggered.
          xpExpire: expireDateUnix.toString(),//unix time in seconds of expiration
          xpScoreType: <score type>, //what scoretype to attribute points to
          discoverable: <boolean>, // allow people to be able to discover this via discover app,
        },
        verification: {
          signature,
          message: timestamp,//timestamp must match signature
          address: <xp owner wallet address>,
        },
      };

      let createClaimResponse = await fetch(
        "https://api.xp-protocol.io/create-claim",
        {
          method: "POST",
          headers: {
            "Content-Type": "application/json",
          },
          body: JSON.stringify(claimData),
        }
      );

```

If the call is successful it should response with the following unique identifier.

```javascript


{ status: "created", claimId: "fe269616-e113-4d6b-8711-e816bfcabfa3" }


```

## Querying Claims By Project ID

Claims can be queried by project id to be used for display purposes.

{% hint style="info" %}
Only "Discoverable" claims will be returned in this query.
{% endhint %}

Below is an example of a query.

```javascript
 let getClaims = await fetch(
        "https://api.xp-protocol.io/get-claims",
        {
          method: "POST",
          headers: {
            "Content-Type": "application/json",
          },
          body: JSON.stringify({xpProjectId:<xp project id here>}),
        }
      );
```

## Query A Single Claim

```javascript
let getClaim = await fetch(
        "https://api.xp-protocol.io/get-claim",
        {
          method: "POST",
          headers: {
            "Content-Type": "application/json",
          },
          body: JSON.stringify({claimId: <claim id here>}),
        }
      );
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.xp-protocol.io/products/xp-protocol/features/claims.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
