# create\_batch

`imerit_ango.sdk.SDK.`

## create\_batch(project\_id, batch\_name)

Create a new batch within your project.

### Parameters

* **project\_id:** string
  * The unique identifier for the project. You can find the project ID in [the user interface](/sdk/sdk-documentation.md#project-ids) or retrieve it using the [`list_projects`](/sdk/sdk-documentation/project-level-sdk-functions/list_projects.md) function.
* **batch\_name:** string
  * Name of the batch to be created.
  * Example: `'My Batch 1'`

Returns:

* **output:** dict
  * A dictionary containing the result of the operation.
  * Including a `status` field indicating whether the request was successful and a `data` field containing the response payload with updated resources produced by the operation.

<details open>

<summary><strong>How to verify in Ango Hub?</strong></summary>

After successfully executing the `create_batch` function, you can validate the changes directly in Ango Hub.

Navigate to: **Projects → \[Your Project] → Settings → Batches**

* Confirm that the newly created batch appears in the batch list.

{% hint style="info" %}
Changes made via the SDK are reflected in Ango Hub in near real-time. If updates are not immediately visible, please refresh the page.
{% endhint %}

</details>

### Example

Create a batch:

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

```python
import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')

ango_sdk = SDK(api_key)

ango_sdk.create_batch(project_id=project_id, batch_name="My Batch Name")
```

{% endtab %}

{% tab title="curl" %}

```bash
curl -X POST "https://imeritapi.ango.ai/v2/batches/$PROJECT_ID" \
  -H "Content-Type: application/json" \
  -H "apikey: $ANGO_API_KEY" \
  -d '{
    "batches": [
      {
        "name": "My Batch Name"
      }
    ]
  }'
```

{% endtab %}
{% endtabs %}

Prevent creating duplicate batches:

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

```python
import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')

ango_sdk = SDK(api_key)

batch_name = "My Batch"

# Get available batch names from project
batches = ango_sdk.get_batches(project_id)

project_batch_name_list = []
for batch in batches:
    project_batch_name = batch['name']
    project_batch_name_list.append(project_batch_name)

# Create batch if it is not available on the project
if batch_name not in project_batch_name_list:
    ango_sdk.create_batch(project_id=project_id, batch_name=batch_name)
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**See also**

[assign\_batches](/sdk/sdk-documentation/project-level-sdk-functions/assign_batches.md), [get\_batches](/sdk/sdk-documentation/project-level-sdk-functions/get_batches.md)
{% endhint %}


---

# 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://docs.imerit.net/sdk/sdk-documentation/project-level-sdk-functions/create_batch.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.
