# XP

## Overview

The XP API provides endpoints for managing experience points (XP) within the Ethos network. It allows users to retrieve their XP history and perform various XP-earning actions such as daily check-ins through the browser extension.

## Endpoints

### Extension Daily Check-in

```
POST /api/v1/xp/extension-daily-checkin
```

**Description**: Allows users to check in daily via the browser extension to earn XP.

**Authentication Required**: No (Uses cryptographic signature verification)

#### Parameters

**Body Parameters**

| Name             | Type   | Required | Description                                                                                       |
| ---------------- | ------ | -------- | ------------------------------------------------------------------------------------------------- |
| `twitterHandle`  | string | Yes      | The Twitter handle of the user checking in (without the @ symbol)                                 |
| `timestamp`      | number | Yes      | Current timestamp in milliseconds                                                                 |
| `installationId` | string | Yes      | Unique identifier for the extension installation                                                  |
| `signature`      | string | Yes      | HMAC-SHA256 signature of `twitterHandle:timestamp:installationId` using installationId as the key |

#### Responses

**Success Response**

**Code**: 200 OK

```json
{
  "ok": true,
  "data": {
    "success": true
  }
}
```

**Error Response**

**Code**: 400 Bad Request

```json
{
  "ok": false,
  "error": "Already checked in today",
  "code": "ALREADY_CHECKED_IN"
}
```

**Possible error codes**:

* `ALREADY_CHECKED_IN`: User has already checked in today
* `TWITTER_USER_NOT_FOUND`: The provided Twitter handle does not exist or is not registered with Ethos

**Code**: 401 Unauthorized

```json
{
  "ok": false,
  "error": "Invalid signature",
  "code": "INVALID_SIGNATURE"
}
```

**Possible error codes**:

* `INVALID_SIGNATURE`: The provided signature is invalid
* `UNAUTHORIZED`: The timestamp is too old (more than 5 minutes)

#### Example

**Request**

```bash
http POST https://api.ethos.network/api/v1/xp/extension-daily-checkin \
  twitterHandle=ethosuser \
  timestamp=1627318400000 \
  installationId=abcd1234 \
  signature=HMAChdjhdwueGFRkSjdksleiFEIRekjsfndk
```

#### Notes

* Users can only check in once per day (based on UTC date).
* The XP awarded is typically 100 points, but may be adjusted by a multiplier based on the user's score.
* The request must include a valid signature generated by the extension to prevent abuse.
* Timestamp must be within the last 5 minutes to prevent replay attacks.


---

# 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://developers.ethos.network/api-documentation/api-v1-deprecated/xp.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.
