> For the complete documentation index, see [llms.txt](https://docs.getlynx.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.getlynx.io/clevver-api/public-methods/batches.md).

# Batches

## Get active batch jobs.

<mark style="color:blue;">`GET`</mark> `https://clevver.org/api/batches`

The process of storing files on the blockchain can take some time and is an asynchronous process. This request will return a list of actively running batch storage jobs.

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

```json
{
  "status": "success",
  "data": [
    {
      "id": "5c893d75-2a8b-4712-b56f-89377ac97681",
      "status": "processing",
      "progress": 10.3,
      "created_at": "2023-11-01 13:53:12"
    },
    {
      "id": "0adc8bf2-ec4a-415e-8074-cba50dd9e0b4",
      "status": "processing",
      "progress": 97,
      "created_at": "2023-11-01 13:48:12"
    },
  ]
}
```

{% endtab %}
{% endtabs %}

## Create a new batch

<mark style="color:green;">`POST`</mark> `https://clevver.org/api/batches`

In order to store files on Clevver, you must first create a batch. Files can then be attached to the batch and later started by calling the start method.

{% tabs %}
{% tab title="201: Created " %}

```json
{
  "status": "success",
  "data": {
      "id": "5c893d75-2a8b-4712-b56f-89377ac97681",
      "status": "created",
      "progress": 0,
      "created_at": "2023-11-01 13:53:12",
      "message": "Batch created successfully"
  }
}
```

{% endtab %}
{% endtabs %}

## Start a storage job

<mark style="color:green;">`POST`</mark> `https://clevver.org/api/batches/{batch_id}/start`

Once a storage job has been created and files have been attached to it, you can then start the job. Starting the job will begin the process of storing the files onto the blockchain.

#### Path Parameters

| Name                                        | Type   | Description         |
| ------------------------------------------- | ------ | ------------------- |
| batch\_id<mark style="color:red;">\*</mark> | String | The id of the batch |

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

```json
{
  "status": "success",
  "data": {
      "id": "5c893d75-2a8b-4712-b56f-89377ac97681",
      "status": "processing",
      "progress": 0,
      "created_at": "2023-11-01 13:53:12",
      "message": "Batch job started"
  }
}
```

{% endtab %}
{% endtabs %}

## Get a storage job

<mark style="color:blue;">`GET`</mark> `https://clevver.org/api/batches/{batch_id}`

You can query individual batches to check their status and/or progress.

#### Path Parameters

| Name                                        | Type    | Description         |
| ------------------------------------------- | ------- | ------------------- |
| batch\_id<mark style="color:red;">\*</mark> | Strring | The id of the batch |

{% tabs %}
{% tab title="200: OK The requested batch object" %}

```json
{
  "status": "success",
  "data": {
      "id": "5c893d75-2a8b-4712-b56f-89377ac97681",
      "status": "delivered",
      "progress": 100,
      "created_at": "2023-11-01 13:53:12",
  }
}
```

{% endtab %}
{% endtabs %}

## Upload and attach a file to a batch

<mark style="color:green;">`POST`</mark> `https://clevver.org/api/batches/{batch_id}/files`

In order to store files on the block chain they must first be attached to a batch.

#### Path Parameters

| Name                                        | Type   | Description         |
| ------------------------------------------- | ------ | ------------------- |
| batch\_id<mark style="color:red;">\*</mark> | String | The id of the batch |

#### Request Body

| Name                                   | Type | Description             |
| -------------------------------------- | ---- | ----------------------- |
| file<mark style="color:red;">\*</mark> | File | The file being uploaded |

{% tabs %}
{% tab title="200: OK The requested batch object" %}

```json
{
{
    "message": "Asset successfully uploaded",
    "status": "success",
    "data": {
        "id": "d37dffe9-60d5-4df4-ae0c-93bf42ac2137",
        "status": "created",
        "file": {
            "url": "/uploads/digital_asset/file/d37dffe9-60d5-4df4-ae0c-93bf42ac2137/myphoto.png",
            "thumb": {
                "url": "/uploads/digital_asset/file/d37dffe9-60d5-4df4-ae0c-93bf42ac2137/thumb_myphoto.png"
            }
        },
        "file_size": 1752887,
        "estimated_cost": null,
        "created_at": "2024-01-24T05:32:50.692Z",
        "updated_at": "2024-01-24T05:32:50.692Z",
        "txid": null,
        "task_id": null,
        "serialized_metadata": "{}",
        "should_be_cached": true,
        "stored_on": null,
        "short_slug": null,
        "checksum": "f604699904334d333b17b872b1183d22f604699904334d333b17b872b1183d22",
        "user_id": 2,
        "name": "myphoto.png",
        "archived": false,
        "duplicate": false,
        "tag_list": []
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.getlynx.io/clevver-api/public-methods/batches.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
