---
title: "Update import tasks for an instance"
method: PUT
path: "/instances/{instance_id}/import_tasks"
tags: ["Private"]
---

# Update import tasks for an instance

`PUT /instances/{instance_id}/import_tasks`

## Request

- Base URL: `https://api.beta.ons.gov.uk/v1`
- URL: `https://api.beta.ons.gov.uk/v1/instances/{instance_id}/import_tasks`
- Auth: API key in header `Authorization`

The instance import process involves multiple tasks. This endpoint updates the state of an import task.

## Path parameters

- `instance_id` string, required

## Headers

- `If-Match` string

## Request body

- ImportTasks
  - `build_hierarchies` object[]
    - `code_list_id` string: The ID of the codelist that this hierarchy represents
    - `dimension_name` string: The name of the dimension the hierarchy represents
    - `state` string: The state of the import observations task
  - `build_search_indexes` object[]
    - `dimension_name` string: The name of the dimension the search index represents
    - `state` string: The state of the import observations task
  - `import_observations` object
    - `state` string: The state of the import observations task
    - `total_inserted_observations` integer: The number of inserted observations in this instance

## Response `200`

Updated the state of the import task

## Other responses

- `400`: Failed to process the request due to invalid request
- `401`: The token provided is unauthorised to carry out this operation
- `404`: InstanceId does not match any instances
- `409`: Failed to process the request due to a conflict
- `500`: Failed to process the request due to an internal error

## Changes

- **2025-02-18** `f5f36bf68ba9`: 2 info
  - the endpoint scheme security `Authorization` was added to the API
  - the endpoint scheme security `InternalAPIKey` was removed from the API

[Operation history](https://skmtc.dev/office-of-national-statistics/apis/explore-our-data/changes/instances/:instance_id/import_tasks/put.md)

---

[API](https://skmtc.dev/office-of-national-statistics/apis/explore-our-data.md) - [All operations](https://skmtc.dev/office-of-national-statistics/apis/explore-our-data/llms.txt) - [OpenAPI document](https://skmtc.dev/office-of-national-statistics/apis/explore-our-data/revisions/c24bb51d5217?raw)
