# API Points

You can send points for each user to ShareMint using our API.

These points are associated with referees and are used to reward affiliates.

You can send multiple points for each user. For example, you can send us a score of 100 for fighting, 120 for breeding, and 200 for forging. You can set a requirement that rewards are unlocked if a referee has a score of at least 100 across all three categories.

To add an API Points requirement, navigate to your project's settings page. In the *Affiliates* section, click on *Advanced Referee Requirements*, and choose *API Points* as the requirement type.

You will be asked to fill in the following fields:

* **Name** - the name of the key to store the points under. This must match the  name sent via API.
* **What is the minimum value required to be considered a referral?** - This is a numeric value threshold above which an affiliate is considered to be valid. You can leave this blank or set it to 0 if you'd like to allow any value.

In this example, a referee must have a breeding score of at least 5, and a forging score of at least 8:

<figure><img src="https://1420480999-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMDwkCYBwBH5pNPyOftDx%2Fuploads%2Flkr0e8TApn8j1uc5pOP1%2FCleanShot%202023-06-23%20at%2018.10.48%402x.png?alt=media&#x26;token=2ef05545-913e-4670-a8d7-7fd9508c2be7" alt=""><figcaption><p>API Points example</p></figcaption></figure>

### API

Send points using our API:

## To save points.

<mark style="color:green;">`POST`</mark> `https://sharemint.xyz/api/external/save-points`

One of `address`, `email`, or `projectUserId` must be provided, otherwise, the request will not be processed.

#### Headers

| Name                                           | Type   | Description      |
| ---------------------------------------------- | ------ | ---------------- |
| Content-Type<mark style="color:red;">\*</mark> | String | application/json |

#### Request Body

| Name                                        | Type   | Description                                                                                                                                                                                                 |
| ------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| slug<mark style="color:red;">\*</mark>      | String | Project slug                                                                                                                                                                                                |
| apiSecret<mark style="color:red;">\*</mark> | String | Find this on the admin tab of your project                                                                                                                                                                  |
| keyPoints<mark style="color:red;">\*</mark> | String | Key value pairs of points. Example: `{"breeds": 12, "quests": 44}`. The value is the number of points the user has amassed. This will override previous user scores. Keys not supplied are left unaffected. |
| address                                     | String | The address of the user to store the points for.                                                                                                                                                            |
| email                                       | String | The email of the user to store the points for.                                                                                                                                                              |
| projectUserId                               | String | The ShareMint id of the user  to store the points for.                                                                                                                                                      |

{% tabs %}
{% tab title="200: OK " %}

{% endtab %}

{% tab title="500: Internal Server Error " %}

{% endtab %}

{% tab title="400: Bad Request " %}

{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}

{% tab title="403: Forbidden " %}

{% endtab %}

{% tab title="404: Not Found " %}

{% endtab %}
{% endtabs %}
