# Insert rows

> Source: https://elaichi.ai/docs/api-reference/collections/collection/insertcollectionrows/

`POST /collection/{id}/rows`

Resource: **Collection** · API: **Collections**

## Path parameters

- **`id`** _(string, required)_
  Resource id

## Request body

- **`rows`** _(array<object>)_
- **`typecast`** _(boolean)_

## Response body

- **`inserted`** _(integer)_
- **`updated`** _(integer)_
- **`unchanged`** _(integer)_
- **`deleted`** _(integer)_
- **`row_ids`** _(array<string>)_
- **`replayed`** _(boolean)_
- **`stats`** _(unknown)_

## Code examples

### curl

```bash
curl -X POST 'https://api.elaichi.ai/collection/<id>/rows' \
  -H 'Authorization: Bearer $ELAICHI_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"rows":[],"typecast":true}'
```

### JavaScript

```javascript
const body = {
  "rows": [],
  "typecast": true
};

const response = await fetch('https://api.elaichi.ai/collection/<id>/rows', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer ' + process.env.ELAICHI_API_TOKEN,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import os
import requests

url = "https://api.elaichi.ai/collection/<id>/rows"
headers = {
    "Authorization": f"Bearer {os.environ['ELAICHI_API_TOKEN']}",
    "Content-Type": "application/json",
}
payload = {
    "rows": [],
    "typecast": True
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())
```
