> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qobra.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Update data in Qobra

> Create and update the records of a data table, and users with their groups and managers, from a system Qobra has no connector for.

When Qobra has no [connector](https://docs.qobra.co/integration_documentation/introductions/inbound_integration.md) for one of your systems, update Qobra from it with the public API: the records of a data table, and your users with their groups and managers. These endpoints are part of the v1 API, which stays maintained for them.

Before you start, a Qobra admin creates an API key in **Settings** > **API**. Send the key in the `X-API-Key` header of each request. See [Authentication](https://docs.qobra.co/api_reference/v2/introduction.md#authentication).

## Update the records of a data table

### Create a data table for the API

Records sent through the API go to a data table connected to **API Connection**.

**1. Create the table**

On the **Data tables** page, click **Add table**. Pick **API Connection** as the **Integration**, name the table, choose the **User matching type** used to match the user fields of your records to Qobra users, then click **Add**.

**2. Add its fields**

In the table's **Table settings**, add every field you will send with **Add field**. Each field shows its API key under its name: it is the `field-api-key` you use in the payload.

![The Table settings page of Partner deals, a data table fed by API Connection, with its fields and their API keys and the Add field button highlighted](https://mintlify.s3.us-west-1.amazonaws.com/qobra/api_reference/images/settings_add_table.png)

**3. Find the keys of the table**

Open the **...** menu of **Table settings** and click **Edit**. The **Edit data table** dialog shows the **Table key**, the `data_table_key` of the endpoint URL, and the **ID key**, the field that identifies each record.

![The Edit data table dialog of Partner deals with its table name, table key, ID key, name field and user matching type](https://mintlify.s3.us-west-1.amazonaws.com/qobra/api_reference/images/settings_edit_table.png)

### Send the records

Send the records to [Upsert records bulk](https://docs.qobra.co/api_reference/v1/endpoints/data_tables/ingest_records.md), with the key of the data table and the API key of each field. A record with an existing ID is updated, a new ID creates a record.

## Update users

| To | Endpoint | Import |
| - | - | - |
| Create or update users and their user attributes | [Upsert users bulk](https://docs.qobra.co/api_reference/v1/endpoints/users/upsert_bulk_user.md) | Yes |
| Update the group of each user | [Upsert group attributions bulk](https://docs.qobra.co/api_reference/v1/endpoints/users/upsert_bulk_user_group.md) | Yes |
| Update the manager of each user | [Upsert manager attributions bulk](https://docs.qobra.co/api_reference/v1/endpoints/users/upsert_bulk_user_manager.md) | Yes |
| Archive users | [Archive users bulk](https://docs.qobra.co/api_reference/v1/endpoints/users/archive_users.md) | No: the users are archived during the request |

Group and manager attributions need the users they reference to exist already. Update your users first, wait for their import to finish, then update the group and manager attributions.

### Send user attributes

To send custom columns of your users, such as a business unit or a hire date, a Qobra admin first creates them as user attributes in **Settings** > **User attributes** with **New attribute**.

![Settings > User attributes listing the user attributes of the company, with the New attribute button highlighted](https://mintlify.s3.us-west-1.amazonaws.com/qobra/api_reference/images/custom_user_attributes.png)

Each attribute gets an API key, generated from its name, that you can change. Send the attribute's value under that key in [Upsert users bulk](https://docs.qobra.co/api_reference/v1/endpoints/users/upsert_bulk_user.md); [Fetch users](https://docs.qobra.co/api_reference/v1/endpoints/users/fetch_users.md) returns it under the same key.

## Follow the imports

Every update of records, users, groups or managers is asynchronous: the call creates an import and returns its `import_id`. A `200` means the import was created, not that the data was applied. Call [Fetch import](https://docs.qobra.co/api_reference/v1/endpoints/imports/fetch_import.md) until its `status` is `finished`, then read its `error` flag to know whether records or users were skipped.

A call takes up to 200 items. To send more, split them across several calls, and pass `debounce` to merge the calls into one import. See [Upsert users bulk](https://docs.qobra.co/api_reference/v1/endpoints/users/upsert_bulk_user.md).

### Check the imports in Qobra

Qobra admins also see these imports in Qobra, with the payloads you sent:

* the imports of records, in the update history of the **Data tables** page;
* the imports of users, groups and managers, in the update history of the **Users** page, with **API** as their source.

Click an import to see the records it processed: added, edited, removed and skipped.

![The Update history of data tables with an import received via API expanded: 41 records of Partner deals processed](https://mintlify.s3.us-west-1.amazonaws.com/qobra/api_reference/images/import_history.png)

When an update does not show up in Qobra:

* **The import is not in the update history**: the call was refused. Check the API key and the response of the call.

* **The import has an error**: click it to read the records that were not imported, with the reason.

  ![An import with an error in the update history, expanded to show the integration and the error message](https://mintlify.s3.us-west-1.amazonaws.com/qobra/api_reference/images/import_history_error_details.png)

* **The import succeeded but the data did not change**: the keys in your payload do not match the API keys of the table and its fields in Qobra.
