# Import member field values

> Source: https://elaichi.ai/docs/api-reference/members/member/importmemberattributes/

`POST /member/attributes/upsert`

Resource: **Member** · API: **Members**

## Request body

- **`rows`** _(array<object>)_
  - **`email`** _(string)_
    Matched case-insensitively against org members.
  - **`user_id`** _(string)_
    User id (`usr_…`), instead of `email`.
  - **`attributes`** _(object)_
    Field key → value; `null` clears it. Each key must be defined (`GET /member-attribute`, else 400 `attribute_unknown`) and not filled by SCIM (409 `attribute_scim_managed`). Text is trimmed, 1-256 characters and may not contain `{{`; a list holds 1-50 such items; `"3"` / `"true"` are accepted for number and boolean fields. A bad value is 400 `attribute_invalid` (`details.key`); one member's values together are at most 16 KB (400 `attribute_too_large`).

## Response body

- **`updated`** _(integer)_
- **`unchanged`** _(integer)_
- **`failed`** _(integer)_
- **`errors`** _(array<object>)_
  - **`index`** _(integer)_
    Position in `rows`.
  - **`code`** _(string)_
  - **`message`** _(string)_
  - **`key`** _(string)_
    The field the row failed on, when it was one field.

## Code examples

### curl

```bash
curl -X POST 'https://api.elaichi.ai/member/attributes/upsert' \
  -H 'Authorization: Bearer $ELAICHI_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"rows":[]}'
```

### JavaScript

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

const response = await fetch('https://api.elaichi.ai/member/attributes/upsert', {
  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/member/attributes/upsert"
headers = {
    "Authorization": f"Bearer {os.environ['ELAICHI_API_TOKEN']}",
    "Content-Type": "application/json",
}
payload = {
    "rows": []
}

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