# Zone

1. **Check Name Availability**

Checks the availability of a zone with the provided name.

* **GET** `/api/v1/white-label-logic/zones/availability/{zone_name}`

**Request Headers**

| **Name**      | **Description**                  |
| ------------- | -------------------------------- |
| Authorization | Required: Bearer {Authorization} |

This API endpoint allows users to check the availability of a specific Web3 zone name. By sending a GET request with the desired zone name as a parameter, the response will indicate whether the name is available or not. In the provided example response, the timestamp signifies the time of the request, and the data field indicates the availability status, where "false" suggests that the zone name is not available.

**Response**

**200 OK**

```json
{
  "timestamp": "string YYYY-MM-DDThh:mm:ss",
  "data": "boolean"
}
```

2. **Create Zone**

Creates a new zone based on the provided zone data.

* **POST** `/api/v1/white-label-logic/zones?mint=boolean`

This API endpoint allows users to create a new Web3 zone with specified details such as name, activation status, and records. The request body includes parameters like the desired subdomain name, its activation status, and an array of records containing information like record type, name, and value. Upon successful creation, the response provides a timestamp along with the unique identifier (UUID) of the newly created zone, its full domain name (including the assigned TLD), and an array of associated records with their respective UUIDs.

**Request Headers**

| **Name**      | **Description**                  |
| ------------- | -------------------------------- |
| Authorization | Required: Bearer {Authorization} |

**Query Parameters**

| **Parameter** | **Type** | **Description**                                                         |
| ------------- | -------- | ----------------------------------------------------------------------- |
| mint          | boolean  | **\[Optional]** Indicates whether to mint the zone. Default is `false`. |

**Request Body**

```json
{
    "name": "test.influencer",
    "status": "OK",
    "level": "TLD",
    "chain": "POLYGON",
    "description": "This is Test Amoy chain",
    "image": "https://picsum.photos/123/456",
    "url": "test.influencer",
    "records": [
        {
            "type": "SOA",
            "name": "test",
            "value": "10",
            "ttl": "1234"
        }
    ],
    "registrantUuid": "5bbbbc79-2ead-4039-9b9d-d565cbbfcb2c",
    "walletAddress": "0x204E7932A60A11c7001052169947f1e9D5CF1010",
    "registrationDate": "YYYY-MM-DDThh:mm:ss"
}
```

As uuid, we can use the following:

```json
"registrantUuid": "00023a69-7ac9-475f-bd85-360e9a05e2bc"
```

You can also create a new registrant using the create registrant endpoint under profile registry section.

```
For testing purpose, the only allowed chain is POLYGON. 
To track which chains can be used, please refer to the fetch chains endpoint.
```

**Response**

**201 Created**

```json
{
    "timestamp": "2024-05-29T10:42:03.191626",
    "data": {
        "uuid": "221e236d-3f40-4615-9b91-2cb2d0010e08",
        "status": "OK",
        "name": "test.metaverse",
        "asciiName": "test.metaverse",
        "chain": "ETH",
        "records": [
            {
                "uuid": "e00be808-8573-4583-82c9-d70c6df90b69",
                "type": "SOA",
                "name": "test",
                "value": "",
                "ttl": 1234,
                "serial": 2020080302,
                "refresh": 7200,
                "retry": 3600,
                "expire": 1209600,
                "mname": "test.metaverse.",
                "rname": "hostmaster.test.metaverse."
            }
        ],
        "registrar": {
            "name": "****",
            "city": "****",
            "country": "****",
            "email": "****"
        },
        "registrant": {
            "name": "****",
            "city": "****",
            "country": "****",
            "email": "****"
        },
        "registrationDate": "2024-07-10T08:30:00"
    }
}
```

In case an invalid TLD is passed, an error message is displayed to notify the user.

**Response**

**400 Bad Request**

```json
{
    "timestamp": "2024-06-05T12:22:11.703597",
    "message": "Invalid TLD."
}
```

3. **Fetch Zones of Logged User**

Fetches the zones associated with the current user.

* **GET** `/api/v1/white-label-logic/zones/self`

This API endpoint retrieves Web3 zones owned by the logged-in user. The response includes metadata such as timestamp, page information (size, page number, total elements, total pages), and an array of data objects representing individual web3 zones. Each data object contains details about a specific zone, including its unique identifier (UUID), status, name, ASCII name, blockchain chain, contract address, token ID, registrar information (name, contact details, wallet address), user information (email, wallet address), registration date, expiration date, and grace end date.

**Request Headers**

| **Name**      | **Description**                                |
| ------------- | ---------------------------------------------- |
| Authorization | The authorization token for accessing the API. |

**Query Parameters**

| **Parameter** | **Type** | **Description**                                                      |
| ------------- | -------- | -------------------------------------------------------------------- |
| page          | integer  | \[Optional] The page number for pagination. Default value is 0.      |
| pageSize      | integer  | \[Optional] The page size for pagination. Default value is 25.       |
| sortBy        | string   | \[Optional] The field to sort the zones by. Default value is "name". |

**Response**

**200 OK**

```json
{
    "timestamp": "2024-05-29T11:48:30.950392",
    "size": 3,
    "page": 1,
    "totalElements": 14,
    "totalPages": 5,
    "data": [
        {
            "uuid": "8d60672c-3df9-4e74-8a41-55bc25fb7037",
            "status": "OK",
            "name": "l",
            "asciiName": "l",
            "chain": "ETH",
            "registry": {},
            "registrar": {
                "name": "****",
                "city": "****",
                "country": "****",
                "email": "****"
            },
            "registrant": {
                "name": "****",
                "city": "****",
                "country": "****",
                "email": "****"
            },
            "registrationDate": "2024-05-29T09:40:28"
        },
        {
            "uuid": "8ae4306a-a5ca-4b02-a5e8-151c612c0766",
            "status": "OK",
            "name": "lively",
            "asciiName": "lively",
            "chain": "ETH",
            "registry": {},
            "registrar": {
                "name": "****",
                "city": "****",
                "country": "****",
                "email": "****"
            },
            "registrant": {
                "name": "****",
                "city": "****",
                "country": "****",
                "email": "****"
            },
            "registrationDate": "2024-05-29T07:23:45"
        },
        {
            "uuid": "73d9818a-2c63-4130-b336-239c0aa3eb77",
            "status": "OK",
            "name": "reputation",
            "asciiName": "reputation",
            "chain": "ETH",
            "registry": {},
            "registrar": {
                "name": "****",
                "city": "****",
                "country": "****",
                "email": "****"
            },
            "registrant": {
                "name": "****",
                "city": "****",
                "country": "****",
                "email": "****"
            },
            "registrationDate": "2024-05-29T08:54:42"
        }
    ]
}
```

4. **Update Zone Status**

Updates zone status by uuid given the new status.

* **PATCH** `/api/v1/white-label-logic/zones/{uuid}?status={new_status}`

This API endpoint updates the status of a specific Web3 zone identified by its UUID. Users can specify the new status for the zone in the request query parameter.

**Response**

```json
{
    "timestamp": "2024-05-29T12:03:55.485707",
    "data": {
        "uuid": "f785778c-0e3b-4a7b-b911-b6b0d301b52f",
        "status": "INACTIVE",
        "name": "cederico.metaverse",
        "asciiName": "cederico.metaverse",
        "records": [
            {
                "uuid": "bdeb6b4e-3f82-470e-a9d8-ac85ca94d659",
                "type": "A",
                "name": "cederico.metaverse.",
                "value": "34.22.218.54",
                "ttl": 60
            },
            {
                "uuid": "6f359dbd-6db5-4171-97e8-692af82e644c",
                "type": "CNAME",
                "name": "www.cederico.metaverse.",
                "value": "cname.vercel-dns.com.",
                "ttl": 60
            },
            {
                "uuid": "855e525a-8281-4b48-bd94-ab588a2559b8",
                "type": "SOA",
                "name": "cederico.metaverse.",
                "value": "",
                "ttl": 3600,
                "serial": 2020080302,
                "refresh": 7200,
                "retry": 3600,
                "expire": 1209600,
                "mname": "cederico.metaverse.",
                "rname": "hostmaster.cederico.metaverse."
            },
            {
                "uuid": "757e2cbc-739e-4316-a8ac-4e06d2430692",
                "type": "NS",
                "name": "@",
                "value": "ns2.noto.network.",
                "ttl": 21600
            },
            {
                "uuid": "7872476b-7c15-438f-b3d7-5c4f9e1874af",
                "type": "TXT",
                "name": "cederico.metaverse.",
                "value": "\"https://dot.cards/federicocost1\"",
                "ttl": 60
            },
            {
                "uuid": "848f7382-fcc8-4355-ac73-d75c0b54216c",
                "type": "NS",
                "name": "@",
                "value": "ns1.noto.network.",
                "ttl": 21600
            }
        ],
        "registrar": {
            "name": "Freename",
            "street": "Samstagernstrasse 41",
            "city": "Wollerau",
            "postalCode": "8832",
            "country": "Switzerland",
            "phone": "",
            "email": "info@freename.io",
            "web": "https://freename.io",
            "walletAddress": "0xA1E885789C85FEFc76CC30236608B4A19A77e988"
        },
        "registrant": {
            "name": "Freename",
            "street": "Samstagernstrasse 41",
            "city": "Wollerau",
            "postalCode": "8832",
            "country": "Switzerland",
            "phone": "",
            "email": "info@freename.io",
            "web": "https://freename.io",
            "walletAddress": "0xA1E885789C85FEFc76CC30236608B4A19A77e988"
        }
    }
}
```

6. **Trigger Minting Process**

* **POST** `/api/v1/white-label-logic/zones/minting`

This API endpoint allows users to trigger the minting process for a specific zone identified by the name. The user needs to send a POST request with the zone name and provide details such as the destination blockchain chain where the minting will occur.

**Request Body:**

```json
{
  "mintDetail": [
    {
      "blockchain": "POLYGON",
      "name": "test.influencer"
    }
  ]
  "walletAddress": "0xEAeDb...E754fEDB6621"
}
```

In the request body, the user specifies the destination blockchain where they want to mint the domain, as well as the name and wallet address.

```
Note that the only allowed chain, for now, is POLYGON.
Later releases will include more options.
```

Upon successful triggering of the minting process, the response will confirm the initiation of the minting process and provide relevant details.

**Response**

```json
{
    "timestamp": "2024-05-29T13:36:46.158456",
    "data": [
        {
            "blockchain": "polygon",
            "name": "test.influencer"
        }
    ]
}
```

In the response, the timestamp indicates the time of the response and the chain field specifies the blockchain where the minting will occur.

This updated endpoint allows user to trigger the minting process themselves, providing flexibility in specifying the destination blockchain for minting provided that the assigned TLDs is on the chosen chain.

7. **Check Minting Status**

* **GET** `/api/v1/white-label-logic/minting/{zoneName}`

This API endpoint allows users to check the status of the minting process for a specific zone identified by its name. By sending a GET request with the zone name as a parameter, the response will indicate the current status of the minting process.

**Request Headers**

<table data-header-hidden><thead><tr><th width="189"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td><strong>Description</strong></td></tr><tr><td>Bearer Token</td><td>[<strong>Required</strong>] The authorization token for accessing the API.</td></tr></tbody></table>

**Response**

```json
{
    "timestamp": "2024-06-05T14:58:29.051037",
    "data": {
        "zoneName": "test.influencer",
        "status": "PENDING"
    }
}
```

If the status is in `PENDING`, the transaction hash is not displayed. Once the transaction is `COMPLETE`, the transaction hash is also provided.

```
{
    "timestamp": "2024-06-05T14:59:34.473077",
    "data": {
        "zoneName": "v***.influencer",
        "status": "COMPLETE",
        "transactionHash": "0xd72495d373...94d5cc62123g9fcba6e9c04zff3"
    }
}
```

8. **Fetch Available Chains**

**GET** `/api/v1/white-label-logic/chains`

This endpoint retrieves a list of available blockchain networks supported by the system. It provides information about the different chains that users can interact with through the platform.

**Request Headers**

<table data-header-hidden><thead><tr><th width="189"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td><strong>Description</strong></td></tr><tr><td>Bearer Token</td><td>[<strong>Required</strong>] The authorization token for accessing the API.</td></tr></tbody></table>

**Response**

```json
{
    "timestamp": "2024-06-12T11:23:15.614809",
    "data": [
        "POLYGON"
    ]
}
```


---

# 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://freename-1.gitbook.io/freename-apis/web3-white-label-apis/white-label-controller/zone.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.
