> For the complete documentation index, see [llms.txt](https://developers.pipelinersales.com/api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.pipelinersales.com/api-docs/core-api-concepts/bulk-create-update-delete.md).

# Bulk Create, Update, Delete

It is recommended to use Bulk Create, Update, Delete methods when working with a lot of data at once.

| Operation Name | Endpoint        |
| -------------- | --------------- |
| Create, Update | .\*batch-modify |
| Delete         | \*.batch-delete |

### Bulk Create, Update

Coevera API supports creating, updating records in one `*.batch-modify`request

1. When the `ID` is specified in an object, it works as **an update method**
2. When the `ID` is not specified in an object, it works as **a create method**

**Snippet**

```
POST /entities/{{Entity-name}}/batch-modify
[
    {"id": "123", "name": "update"}, 
    {"name": "create"}
]
```

### Using Rollback for Bulk operations

Rollback is [API parameter](/api-docs/core-api-concepts/api-parameters.md)**,** that can help you to rollback data that has failed for some reason (eg. data became invalid).

**Example**

In this example, we are going to bulk update Accounts, with the rollback method turned on.

**Rollback = 0**

If at least one object in a request is invalid, any operation isn´t executed (all data are rollbacked)

```
POST {{baseUrl}}/entities/Accounts/batch-modify?rollback-method=0
[
    {
        "id": "0bc376a4-c579-413a-9221-e86e4a134766",
        "name": "Account - Updated"
    },
    {
        "name": "Account - Created"
    }
]
```

```json
{
    "code": 40000,
    "name": "ERROR_ENTITY_VALIDATION",
    "message": "\n[owner_id] Relation Account.owner_id=00000000-0000-0000-0000-000000011a3d to Client doesn't exist!",
    "entity_id": "0bc376a4-c579-413a-9221-e86e4a134766",
    "entity_name": "Account",
    "entity_errors": [],
    "field_errors": [
        {
            "field_id": "5b67c561-0136-0c86-9dc0-0b4c9acb42f5",
            "field_name": "owner_id",
            "name": "ERROR_FIELD_VALIDATION",
            "code": 40002,
            "errors": [
                {
                    "code": 120,
                    "name": "ERROR_RELATIONS_DOESNT_EXIST",
                    "message": "[owner_id] Relation Account.owner_id=00000000-0000-0000-0000-000000011a3d to Client doesn't exist!",
                    "field_id": "5b67c561-0136-0c86-9dc0-0b4c9acb42f5",
                    "field_name": "owner_id"
                }
            ]
        }
    ],
    "step_checklist_errors": [],
    "entity_index": null,
    "http_status": 422,
    "success": false
}
```

**Rollback=1**

If an object in a request is invalid, it is not saved but other valid records are saved successfully. If the error occurs it is then returned in a response

```
POST {{baseUrl}}/entities/Accounts/batch-modify?rollback-method=1
[
    {
        "id": "0bc376a4-c579-413a-9221-e86e4a134766",
        "name": "Account - Updated"
    },
    {
        "name": "Account - Created",
        "owner_id": "00000000-0000-0000-0000-000000011a7d"
    }
]
```

```json
{
    "success": false,
    "data": [
        {
            "code": 40000,
            "name": "ERROR_ENTITY_VALIDATION",
            "message": "\n[owner_id] Relation Account.owner_id=00000000-0000-0000-0000-000000011a3d to Client doesn't exist!"
        },
        "f75fc63f-8c6f-499e-b9d2-ff16bcefdd83"
    ]
}
```


---

# 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:

```
GET https://developers.pipelinersales.com/api-docs/core-api-concepts/bulk-create-update-delete.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.
