# API-Verified Quest (RESTFUL)

## Introduction

CARV allows the use of OpenAPI to verify whether a user has completed a quest.&#x20;

## Sequence Digram

<figure><img src="/files/7A6BxlcyOlGpFmlDYyTA" alt=""><figcaption></figcaption></figure>

## Specifications&#x20;

**Request**

The API used for verification must be an open API. \
You can choose to use either **email** or **wallet address** or **user ID of third-party platforms** as the identifier to verify a user. \
You can choose *optionally* to add custom headers to the request, such as an API key.\
We will also include **begin time** and **end time** (timestamp in milliseconds) for a quest in case this information is required for verification.&#x20;

So a GET Request will look like the followings:

{% code overflow="wrap" %}

```sh
# wallet address
curl https://<domain>/<serverpath>?address=<userAddress>&begin_time=<timestamp>&end_time=<timestamp>
```

{% endcode %}

OR

{% code overflow="wrap" %}

```sh
# email
curl https://<domain>/<serverpath>?email=<userEmail>&begin_time=<timestamp>&end_time=<timestamp>
```

{% endcode %}

OR

{% code overflow="wrap" %}

```sh
# Telegram id
curl https://<domain>/<serverpath>?telegram_id=<userTelegramId>&begin_time=<timestamp>&end_time=<timestamp>
```

{% endcode %}

OR

{% code overflow="wrap" %}

```sh
# Line id
curl https://<domain>/<serverpath>?line_id=<userTelegramId>&begin_time=<timestamp>&end_time=<timestamp>
```

{% endcode %}

#### Response Format

{% code overflow="wrap" %}

```json
{
    "result":{                    //required on success
        "isValid":<true | false>  //boolean: whether the user completed the quest.
    },
    "error":{                      //required on error, this field MUST NOT exist if there was no error triggered during invocation.
        "code":<error code>,       //number
        "message":"<error message>"
    }
}
```

{% endcode %}


---

# 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.carv.io/carv-ecosystem/carv-play/carv-intro/api-verified-quest-restful.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.
