> For the complete documentation index, see [llms.txt](https://docs.visualyze.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.visualyze.ai/visualyze-document-ai/api/dataset.md).

# Dataset

### Create

## Used to create dataset.

<mark style="color:green;">`POST`</mark> `URL:{{base_url}}/api/{{version}}/dataset/create`

#### Headers

| Name                                            | Type              | Description |
| ----------------------------------------------- | ----------------- | ----------- |
| Authorization<mark style="color:red;">\*</mark> | API key           |             |
| Content-Type<mark style="color:red;">\*</mark>  | Application/jsonn |             |

#### Request Body

| Name                                          | Type      | Description                 |
| --------------------------------------------- | --------- | --------------------------- |
| file<mark style="color:red;">\*</mark>        | form-data | Zip file.                   |
| name<mark style="color:red;">\*</mark>        | form-data | Name of the dataset.        |
| task\_type<mark style="color:red;">\*</mark>  | form-data | Type of dataset.            |
| description<mark style="color:red;">\*</mark> | form-data | Description of the dataset. |

{% tabs %}
{% tab title="200: OK Created dataset." %}

```javascript
{
    "data": {
        "dataset_id": "String"
    },
    "message": "created successfully",
    "status": 200
}
```

{% endtab %}

{% tab title="400: Bad Request Message field can be used to identify the issue." %}

```javascript
{
    "data": {},
    "message": "String",
    "status": 400
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="401: Unauthorized Invalid API key." %}

```javascript
{
    "data": {},
    "message": "ERROR: Unauthorized",
    "status": 401
}
```

{% endtab %}
{% endtabs %}

### View

## Used to list datasets.

<mark style="color:blue;">`GET`</mark> `URL:{{base_url}}/api/{{version}}/dataset/view`

#### Headers

| Name                                            | Type              | Description |
| ----------------------------------------------- | ----------------- | ----------- |
| Authorization<mark style="color:red;">\*</mark> | API key           |             |
| Content-Type<mark style="color:red;">\*</mark>  | Application/jsonn |             |

{% tabs %}
{% tab title="200: OK Returns details of all datasets." %}

```javascript
{
    "data": {
        "datasets": "List of datasets"
    },
    "message": "string",
    "status": 200
}
```

{% endtab %}

{% tab title="400: Bad Request Message field can be used to identify the issue." %}

```javascript
{
    "data": {},
    "message": "String",
    "status": 400
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="401: Unauthorized Invalid API key." %}

```javascript
{
    "data": {},
    "message": "ERROR: Unauthorized",
    "status": 401
}
```

{% endtab %}
{% endtabs %}

### View

## Used to get details of a particular dataset.

<mark style="color:blue;">`GET`</mark> `URL:{{base_url}}/api/{{version}}/dataset/:id/view`

#### Path Parameters

| Name | Type   | Description                 |
| ---- | ------ | --------------------------- |
| id   | String | Id of a particular dataset. |

#### Headers

| Name                                            | Type              | Description |
| ----------------------------------------------- | ----------------- | ----------- |
| Authorization<mark style="color:red;">\*</mark> | API key           |             |
| Content-Type<mark style="color:red;">\*</mark>  | Application/jsonn |             |

{% tabs %}
{% tab title="200: OK Returns details of a particular dataset." %}

```javascript
{
    "data": {
        "dataset_details": "dict"
    },
    "message": "string",
    "status": 200
}
```

{% endtab %}

{% tab title="400: Bad Request Message field can be used to identify the issue." %}

```javascript
{
    "data": {},
    "message": "String",
    "status": 400
}
```

{% endtab %}

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

```javascript
{
    "data": {},
    "message": "ERROR: Unauthorized",
    "status": 401
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

### Upload

## &#x20;Used to upload data item for upgrading dataset.

<mark style="color:green;">`POST`</mark> `URL:{{base_url}}/api/{{version}}/dataset/:id/upload`

#### Path Parameters

| Name                                 | Type   | Description        |
| ------------------------------------ | ------ | ------------------ |
| id<mark style="color:red;">\*</mark> | String | Id of the dataset. |

#### Headers

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

#### Request Body

| Name         | Type      | Description                                                                                                                                            |
| ------------ | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| file         | form-data | <p>In the case of FORM and DOC models, file must be a document with extension png, jpeg and pdf.<br>In the case of NER model, file must be a json.</p> |
| label\_file  | form-data | Json file. Used in FORM and DOC models.                                                                                                                |
| ocr\_file    | form-data | Json file. Used in FORM and DOC models.                                                                                                                |
| fields\_json | form-data | Json file. Used in FORM models.                                                                                                                        |

{% tabs %}
{% tab title="200: OK Uploaded data item to the server." %}

```javascript
{
    "data": {},
    "message": "data uploaded to storage folder",
    "status": 200
}
```

{% endtab %}

{% tab title="401: Unauthorized Invalid API key." %}

```javascript
{
    "data": {},
    "message": "ERROR: Unauthorized",
    "status": 401
}
```

{% endtab %}

{% tab title="400: Bad Request Message field can be used to identify the issue." %}

```javascript
{
    "data": {},
    "message": "String",
    "status": 400
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Upload API is used to upload single data item at a time.
{% endhint %}

### Update

## Used to update dataset using uploaded data.

<mark style="color:green;">`POST`</mark> `URL:{{base_url}}/api/{{version}}/dataset/:id/upload`

#### Path Parameters

| Name                                 | Type   | Description        |
| ------------------------------------ | ------ | ------------------ |
| id<mark style="color:red;">\*</mark> | String | Id of the dataset. |

#### Headers

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

{% tabs %}
{% tab title="200: OK Updated dataset using uploaded data. Dataset is ready for upgrade." %}

```javascript

{
    "data": {
        "dataset_id": "string"
    },
    "message": "dataset updated successfully!!!ready for upgrade",
    "status": 200
}
```

{% endtab %}

{% tab title="400: Bad Request Message field can be used to identify the issue." %}

```javascript
{
    "data": {},
    "message": "String",
    "status": 400
}
```

{% endtab %}

{% tab title="401: Unauthorized Invalid API key." %}

```javascript
{
    "data": {},
    "message": "ERROR: Unauthorized",
    "status": 401
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

### Bulk Update

## Used to update dataset using zip file which contains multiple data items.

<mark style="color:green;">`POST`</mark> `URL:{{base_url}}/api/{{version}}/dataset/:id/bulkupdate`

#### Path Parameters

| Name                                 | Type   | Description    |
| ------------------------------------ | ------ | -------------- |
| id<mark style="color:red;">\*</mark> | String | Id of dataset. |

#### Headers

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

{% tabs %}
{% tab title="200: OK Updated dataset using zip file." %}

```javascript
{
    "data": {
        "dataset_id": "string"
    },
    "message": "uploaded zip file to staging folder.dataset is ready for upgrade",
    "status": 200
}
```

{% endtab %}

{% tab title="401: Unauthorized Invalid API key." %}

```javascript
{
    "data": {},
    "message": "ERROR: Unauthorized",
    "status": 401
}
```

{% endtab %}

{% tab title="400: Bad Request Message field can be used to identify the issue." %}

```javascript
{
    "data": {},
    "message": "String",
    "status": 400
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Used to upload and update multiple data items.
{% endhint %}

### Upgrade

## Used to upgrade dataset which is already updated.

<mark style="color:green;">`POST`</mark> `URL:{{base_url}}/api/{{version}}/model/:id/dataset/upgrade`

#### Path Parameters

| Name                                  | Type   | Description    |
| ------------------------------------- | ------ | -------------- |
| id <mark style="color:red;">\*</mark> | String | Id of dataset. |

#### Headers

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

{% tabs %}
{% tab title="200: OK Dataset is upgraded." %}

```javascript
{
    "data": {
        "dataset_id": "string"
    },
    "message": "successfully upgraded",
    "status": 200
}
```

{% endtab %}

{% tab title="400: Bad Request Message field can be used to identify the issue." %}

```javascript
{
    "data": {},
    "message": "String",
    "status": 400
}
```

{% endtab %}

{% tab title="401: Unauthorized Invalid API key." %}

```javascript
{
    "data": {},
    "message": "ERROR: Unauthorized",
    "status": 401
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}
