# Quick Start

Welcome to the Zelus Labs API Quick Start Guide! By following the steps below, you can easily integrate the Zelus Labs API into your application.

### Easy-Access References:

* [Swagger Documentation](https://sandbox.api.labs.zelus.io/docs)
* Sandbox API base URL: `https://sandbox.api.labs.zelus.io`

## 1. Obtain an API Key

Your API requests will be authenticated using an API key. Any request that doesn’t include an API key will return an error.

To get an API key, [contact us](mailto:kyle@zelus.io) - we'll also set up a direct support channel via slack, discord, or email so that you can get the help that you need in live time!

## 2. Verify the API Key

Once you've obtained the API key, ensure its validity by checking the [status](https://docs.labs.zelus.io/zelus-labs-api/reference/account/getaccount) of the client's account and seeing the available [contracts](https://docs.labs.zelus.io/zelus-labs-api/reference/account/getaccountcontracts) to work with.

{% tabs %}
{% tab title="CURL" %}

```bash
curl -X GET 'https://sandbox.api.labs.zelus.io/v1/account' \
     -H "x-api-key: YOUR_API_KEY"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://sandbox.api.labs.zelus.io/v1/account"
headers = {
    "x-api-key": "YOUR_API_KEY"
}

response = requests.get(url, headers=headers)
account_status = response.json()['result']['account']
print(account_status)
```

{% endtab %}

{% tab title="NodeJS" %}

```javascript
const axios = require('axios');

const url = "https://sandbox.api.labs.zelus.io/v1/account";
const headers = {
    "x-api-key": "YOUR_API_KEY"
};

axios.get(url, { headers: headers }).then(response => {
    const accountStatus = response.data.result.account;
    console.log(accountStatus);
}).catch(error => {
    console.error('Error:', error.response.data);
});
```

{% endtab %}
{% endtabs %}

### 2.2. Get the contract to work with

{% tabs %}
{% tab title="CURL" %}

```bash
curl -X GET 'https://sandbox.api.labs.zelus.io/v1/account/contracts' \
     -H "x-api-key: YOUR_API_KEY"
```

{% endtab %}
{% endtabs %}

The result should be like this:

```json
{
  "result":{
    "contracts":[
      {
        "id" : "contract_63b848e9-b316-48a3-adfd-065403ab88ae",
        "name" : "Smooth Collectibles (Dev) (SMOOTH)"
      }
    ]
  }
}
```

We will use SMOOTH contract's id (`contract_63b848e9-b316-48a3-adfd-065403ab88ae`) as a working one in later examples. While running those examples on your account, please use a SMOOTH contract's Id allocated for your account.

## 3. Create Wallets

Now, you need to register some user wallets in the system using the `registerWallet` API method.

### 3.1 Create a Wallet with an Email Address, Wallet1

Calling [postWalletCreate](https://docs.labs.zelus.io/zelus-labs-api/reference/wallet/postwalletcreate) with an email address will create a new wallet, and return the wallet address and wallet ID. If a wallet with this email already exists, it will be returned to you. For the sake of example, we will call this "Wallet1".

{% tabs %}
{% tab title="CURL" %}

```bash
curl -X POST "https://sandbox.api.labs.zelus.io/v1/wallet/create" \
     -H "x-api-key: <YOUR_API_KEY>" \
     -H "Content-Type: application/json" \
     -d '{"ignoreAddress": false, "email": "email@example.com"}'
```

{% endtab %}
{% endtabs %}

Expected result should be like this:

```json
{
  "result": {
    "walletId":"wallet_60afcf25-2c1f-4b90-9fea-6174fd416040",
    "walletAddress":"0x0097f04ac9b2af2fb40c2c30a65023a78eaff5d6"
  }
}
```

### 3.2 Create a Wallet with a Phone Number, Wallet2

Use the same [postWalletCreate](https://docs.labs.zelus.io/zelus-labs-api/reference/wallet/postwalletcreate) API method but with a mobile number as the parameter. For the sake of example, we will call this wallet, "Wallet2".

{% tabs %}
{% tab title="CURL" %}

```bash
curl -X POST "https://sandbox.api.labs.zelus.io/v1/wallet/create" \
     -H "x-api-key: <YOUR_API_KEY>" \
     -H "Content-Type: application/json" \
     -d '{"ignoreAddress": false,  "phone": "+12223334444"}'
```

{% endtab %}
{% endtabs %}

Expected result should be like this:

```json
{
  "result": {
    "walletId":"wallet_6e27df5e-4432-493d-ab26-b76d6c7cf18f",
    "walletAddress":"0xf32df5c3cc6f71401a0a39b49c2c07cdd01d0818"
  }
}
```

### 3.3 Create another empty wallet, Wallet3

Use the same [postWalletCreate](https://docs.labs.zelus.io/zelus-labs-api/reference/wallet/postwalletcreate) API method for empty wallet. We will call this wallet "Wallet3" later.

{% tabs %}
{% tab title="CURL" %}

```bash
curl -X POST "https://sandbox.api.labs.zelus.io/v1/wallet/create" \
     -H "x-api-key: <YOUR_API_KEY>" \
     -H "Content-Type: application/json" \
     -d '{"ignoreAddress": false,  "email": "empty@example.com"}'
```

{% endtab %}
{% endtabs %}

Expected result should be like this:

```json
{
  "result": {
    "walletId":"wallet_922b90ea-e74e-473f-87c3-fead9b4d6506",
    "walletAddress":"0x039ea35b704890e43aa0faefc76b62405caf4656"
  }
}
```

## 4. Mint NFT Tokens

Once the wallets are registered, you can mint NFT tokens to Wallet1 and Wallet2 using the [nftMint](https://docs.labs.zelus.io/zelus-labs-api/reference/nft/postnftmint) API method.

### 4.1. Mint an NFT for Wallet1

{% tabs %}
{% tab title="CURL" %}

```bash
curl -X POST 'https://sandbox.api.labs.zelus.io/v1/nft/mint' \
     -H "x-api-key: YOUR_API_KEY" \
     -H "Content-Type: application/json" \
-d '{
  "contractId": "contract_63b848e9-b316-48a3-adfd-065403ab88ae",
  "nftTokenId": "1",
  "quantity": 1,
  "walletId": "wallet_60afcf25-2c1f-4b90-9fea-6174fd416040"
}'
```

{% endtab %}
{% endtabs %}

Expected result should be like this:

```json
{
  "result":{
    "id" : "task_2f42a55d-7f87-4d56-ab90-eb4cf271d8ae", 
    "status" : "finished"
  }
}
```

### 4.2. Mint an NFT for Wallet2

{% tabs %}
{% tab title="CURL" %}

```bash
curl -X POST 'https://sandbox.api.labs.zelus.io/v1/nft/mint' \
     -H "x-api-key: YOUR_API_KEY" \
     -H "Content-Type: application/json" \
-d '{
  "contractId": "contract_63b848e9-b316-48a3-adfd-065403ab88ae",
  "nftTokenId": "2",
  "quantity": 1,
  "phone": "+12223334444"
}'
```

{% endtab %}
{% endtabs %}

Expected result should be like this:

```json
{
  "result":{
    "id" : "task_d39a93ea-e96d-4556-9147-a3bf42b422c2",
    "status":"pending"
  }
}
```

## 5. Check if a Specific NFT is in a user's wallet

Verify if the NFT tokens have been minted successfully for Wallet1 and Wallet2. To do this let's [get balance](https://docs.labs.zelus.io/zelus-labs-api/reference/wallet/getwalletnftbalance) for those wallets and their NFT tokens.

### 5.1. Check NFTs for Wallet1

{% tabs %}
{% tab title="CURL" %}

```bash
curl -X GET "https://sandbox.api.labs.zelus.io/v1/wallet/nft/balance?contractId=contract_63b848e9-b316-48a3-adfd-065403ab88ae&nftTokenId=1&email=email%40example.com" \
     -H "x-api-key: YOUR_API_KEY"
```

{% endtab %}
{% endtabs %}

Expected result should be like this:

```json
{
  "result": {
    "value" : 1,
    "transactionStatus" : "finished"
  }
}
```

### 5.2. Check NFTs for Wallet2

{% tabs %}
{% tab title="CURL" %}

```bash
curl -X GET "https://sandbox.api.labs.zelus.io/v1/wallet/nft/balance?contractId=contract_63b848e9-b316-48a3-adfd-065403ab88ae&nftTokenId=2&phone=%2B12223334444" \
     -H "x-api-key: YOUR_API_KEY"
```

{% endtab %}
{% endtabs %}

Expected result should be like this:

```json
{
  "result": {
    "value" : 1,
    "transactionStatus" : "finished"
  }
}
```

### 5.3. Check NFTs for Wallet3

{% tabs %}
{% tab title="CURL" %}

```bash
curl -X GET "https://sandbox.api.labs.zelus.io/v1/wallet/nft/balance?contractId=contract_63b848e9-b316-48a3-adfd-065403ab88ae&nftTokenId=1&email=empty%40example.com" \
     -H "x-api-key: YOUR_API_KEY"
```

{% endtab %}
{% endtabs %}

Expected result should be like this:

```json
{
  "result": {
    "value" : 0
  }
}
```

## 6. Get all NFTs in a User's wallet

Ensure that Wallet1 has tokens and Wallet3 doesn't have any tokens. To do this let's [get all nfts](https://docs.labs.zelus.io/zelus-labs-api/reference/wallet/getwalletnftlist) for those wallets.

### 6.1 For Wallet1

{% tabs %}
{% tab title="CURL" %}

```bash
curl -X GET 'https://sandbox.api.labs.zelus.io/v1/wallet/nft/list?email=email@example.com' \
     -H "x-api-key: YOUR_API_KEY"
```

{% endtab %}
{% endtabs %}

Expected result would be:

```json
{
  "result": [
    {
      "contract": "0x509ac6e18fe97f7d96fce1a2ac3c7e6c4b9dde6d",
      "nftTokenId": "1",
      "blockchain": "polygon"
    },
    {
      "contract": "0x509ac6e18fe97f7d96fce1a2ac3c7e6c4b9dde6d",
      "nftTokenId": "2",
      "blockchain": "polygon"
    }
  ]
}
```

### 6.2 For Wallet3

Repeat the process using the `Wallet3` credentials and confirm that the response indicates no minted tokens.

## Conclusion

This enhanced quick start guide provides a comprehensive step-by-step approach to seamlessly integrate with the Alpha API. Ensure all API requests include the necessary authorization headers, and that you handle responses appropriately, checking for errors or necessary information.
