# 🔌 API Tasks

This documentation provides detailed instructions on how to create and manage custom API tasks within a project using the Tide platform.&#x20;

## API Task creation

### Step 1: Fill API task form

To create a task, you must navigate to [Tide Campaign Builder](https://www.tideprotocol.xyz/projects/create-campaign), "*Task Step*".

Select "*API*" in the task selector and choose "*Verify execution of a task on given API*".

<figure><img src="/files/EwAJerE0Ro25Jfy72Lb3" alt=""><figcaption><p>Tasks selector</p></figcaption></figure>

**Fill out the form with the following info:**

1. **API Endpoint:** The URL of the endpoint that will be called to check the task status.
2. **Request Headers (optional):** Any headers that are required for the endpoint request, if there are any.
3. **Website URL:** The URL that points to the website where the task actions need to be performed.
4. **Description:** a detailed description to explain to the users what they should do to be eligible to complete the task.

### Step 2: Validation Requirements

Once the form is filled out, the task will indicate the validation status:

<div><figure><img src="/files/YmE0lgwgxxA3rh5DfLcN" alt=""><figcaption><p>The endpoint is under review</p></figcaption></figure> <figure><img src="/files/JnE8eC01CT8votzPf3sS" alt=""><figcaption><p>The endpoint is not valid</p></figcaption></figure> <figure><img src="/files/vOk95aH1koRbppgSpxuw" alt=""><figcaption><p>The endpoint is valid</p></figcaption></figure></div>

The endpoint and headers must be validated by Tide before the task can be displayed in the campaign.

For an endpoint to be validated, it must meet the following criteria:

1. **User Address Query Parameter:**
   * The endpoint must accept a query parameter named `userAddress` (do not add this parameter in the endpoint field).
   * The `userAddress` must be the lowercase EVM address of the user attempting to complete the task. This address is the same one used by the user to connect to the Tide platform.
2. **JSON Response Format:**
   * The endpoint must return a JSON response with the following structure:

     ```json
     {
       "eligible": boolean
     }
     ```
   * A value of `true` indicates that the user can complete the task.
   * A value of `false` indicates that the user cannot complete the task.
3. If the endpoint meets these criteria, the task will be displayed in the Tide campaign. Otherwise, the task will not be displayed.

### Step 3: Task completion

When the endpoint returns a successful result (`eligible: true`), the user’s task status is set to "completed".

By following the steps outlined in this documentation, projects can successfully create and manage API tasks on their own. Ensure that your endpoint, headers, and website URL are correctly submitted and validated and that the endpoint response adheres to the required format.

&#x20;This will allow for seamless integration and task management within your Tide campaign.

For any further assistance or questions, please contact the Tide support team.


---

# 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://fiveelementslabs.gitbook.io/tide/projects/campaigns/create-a-campaign/api-tasks.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.
