# Coordinate data processing tasks

Coordinate source processing task status. Only called when the task returns `reconcile_required: true`.

```text
POST https://moi.matrixorigin.cn/newmoi/semantic-models/{model_id}/source-jobs/reconcile
```

## Preparation before calling

First [query the data processing task](list-data-processing-jobs.md), and confirm that the task that returns `reconcile_required: true` exists in the knowledge base. Prepare a personal access token and target workspace ID that has access to the target workspace.

The example below uses:

- `$AI_STUDIO_API_KEY`: The actual personal access token, passed through the `X-API-Key` Header.
- `$WORKSPACE_ID`: Target workspace ID, passed through `X-Workspace-ID` Header.
- `$MODEL_ID`: ID of the knowledge base whose task status is to be reconciled.

## Request example

```bash
curl -X POST "https://moi.matrixorigin.cn/newmoi/semantic-models/$MODEL_ID/source-jobs/reconcile" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

## Path parameters

| Parameters | Type | Description |
| --- | --- | --- |
| `model_id` | integer | The ID of the knowledge base to reconcile the status of the task. |

## Successful response

Returns `200` on success. Reread the task list to confirm final status; this interface is not a universal entry point for retrying all sources.

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "updated": true
  }
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | `OK` on success. |
| `msg` | string | `OK` on success. |
| `data.updated` | boolean | `true` indicates that the service has executed task status convergence. |

## Error response

```json
{
  "code": "ErrNotFound",
  "msg": "resource not found",
  "data": null
}
```

### Common HTTP errors

```{list-table}
:header-rows: 1
:widths: 12 22 32 34

* - HTTP status code
  - error code
  - Common causes
  - Recommended actions
* - `400`
  - `ErrParamInvalid`
  - `model_id` is invalid.
  - Use the knowledge base ID from the response.
* - `401`
  - `ErrUnauthorized`
  - The API Key is invalid or has expired.
  - Check API Key.
* - `403`
  - `ErrForbidden`
  - The caller does not have permission to update the source task.
  - Check workspace and object authorization.
* - `404`
  - `ErrNotFound`
  - The knowledge base does not exist or is not visible.
  - Reconfirm `model_id`.
* - `500`
  - `ErrServer`
  - The service failed to converge on the source task state.
  - Keep the desensitized response information and try again.
```

## Follow-up operations

[Query data processing tasks](list-data-processing-jobs.md) Confirm the final status of the task.
