---
title: Restore
description: Restore InfluxDB OSS v2 data from a backup, including time series data and metadata.
url: https://docs.influxdata.com/influxdb/v2/api/restore/
estimated_tokens: 8444
product: InfluxDB OSS v2
version: v2
---

[Download InfluxDB API Spec](/openapi/influxdb-oss-v2-api.yml)

Restore InfluxDB OSS v2 data from a backup, including time series data and metadata.

POST `/api/v2/restore/bucket/{bucketID}`

### Overwrite storage metadata for a bucket with shard info from a backup.

#### Parameters

##### Path parameters

`bucketID` required string

The bucket ID.

##### Header parameters

`Zap-Trace-Span` string

OpenTracing span context

`Content-Type` string

Allowed values: `application/octet-stream`

Default: `application/octet-stream`

#### Request body required

Database info serialized as protobuf.

Content-Type: `application/json`

Example request [Ask AI about this](#)

```sh
curl --request POST \
  "http://localhost:8086/api/v2/restore/bucket/{bucketID}" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: text/plain" \
  --data-raw 'measurement,tag=value field=1.0'
```

#### Responses

200 ID mappings for shards in bucket.

default Non 2XX error response from server.

`code` required string

code is the machine-readable error code.

Allowed: `internal error` , `not implemented` , `not found` , `conflict` , `invalid` , `unprocessable entity` , `empty value` , `unavailable` , `forbidden` , `too many requests` , `unauthorized` , `method not allowed` , `request too large` , `unsupported media type`

`err` string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message` string

Human-readable message.

`op` string

Describes the logical code operation when the error occurred. Useful for debugging.

POST `/api/v2/restore/bucketMetadata`

### Create a new bucket pre-seeded with shard info from a backup.

#### Parameters

##### Header parameters

`Zap-Trace-Span` string

OpenTracing span context

#### Request body required

Metadata manifest for a bucket.

Content-Type: `application/json`

`bucketID` required string

`bucketName` required string

`defaultRetentionPolicy` required string

`description` string

`organizationID` required string

`organizationName` required string

`retentionPolicies` required string

Example request [Ask AI about this](#)

```sh
curl --request POST \
  "http://localhost:8086/api/v2/restore/bucketMetadata" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: application/json" \
  --data-raw '{
  "bucketID": "BUCKETID",
  "bucketName": "BUCKETNAME",
  "defaultRetentionPolicy": "DEFAULTRETENTIONPOLICY",
  "description": "DESCRIPTION",
  "organizationID": "ORGANIZATIONID",
  "organizationName": "ORGANIZATIONNAME",
  "retentionPolicies": []
}'
```

#### Responses

201 ID mappings for shards in new bucket.

`id` required string

New ID of the restored bucket

`name` required string

`shardMappings` required string

default Non 2XX error response from server.

`code` required string

code is the machine-readable error code.

Allowed: `internal error` , `not implemented` , `not found` , `conflict` , `invalid` , `unprocessable entity` , `empty value` , `unavailable` , `forbidden` , `too many requests` , `unauthorized` , `method not allowed` , `request too large` , `unsupported media type`

`err` string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message` string

Human-readable message.

`op` string

Describes the logical code operation when the error occurred. Useful for debugging.

POST `/api/v2/restore/kv`

### Overwrite the embedded KV store on the server with a backed-up snapshot.

#### Parameters

##### Header parameters

`Zap-Trace-Span` string

OpenTracing span context

`Content-Encoding` string

The value tells InfluxDB what compression is applied to the line protocol in the request payload. To make an API request with a gzip payload, send `Content-Encoding: gzip` as a request header.

Allowed values: `gzip` , `identity`

Default: `identity`

`Content-Type` string

Allowed values: `application/octet-stream`

Default: `application/octet-stream`

#### Request body required

Full KV snapshot.

Content-Type: `application/json`

Example request [Ask AI about this](#)

```sh
curl --request POST \
  "http://localhost:8086/api/v2/restore/kv" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: text/plain" \
  --data-raw 'measurement,tag=value field=1.0'
```

#### Responses

200 KV store successfully overwritten.

`token` string

token is the root token for the instance after restore (this is overwritten during the restore)

204 KV store successfully overwritten.

default Non 2XX error response from server.

`code` required string

code is the machine-readable error code.

Allowed: `internal error` , `not implemented` , `not found` , `conflict` , `invalid` , `unprocessable entity` , `empty value` , `unavailable` , `forbidden` , `too many requests` , `unauthorized` , `method not allowed` , `request too large` , `unsupported media type`

`err` string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message` string

Human-readable message.

`op` string

Describes the logical code operation when the error occurred. Useful for debugging.

POST `/api/v2/restore/shards/{shardID}`

### Restore a TSM snapshot into a shard.

#### Parameters

##### Path parameters

`shardID` required string

The shard ID.

##### Header parameters

`Zap-Trace-Span` string

OpenTracing span context

`Content-Encoding` string

The value tells InfluxDB what compression is applied to the line protocol in the request payload. To make an API request with a gzip payload, send `Content-Encoding: gzip` as a request header.

Allowed values: `gzip` , `identity`

Default: `identity`

`Content-Type` string

Allowed values: `application/octet-stream`

Default: `application/octet-stream`

#### Request body required

TSM snapshot.

Content-Type: `application/json`

Example request [Ask AI about this](#)

```sh
curl --request POST \
  "http://localhost:8086/api/v2/restore/shards/{shardID}" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: text/plain" \
  --data-raw 'measurement,tag=value field=1.0'
```

#### Responses

204 TSM snapshot successfully restored.

default Non 2XX error response from server.

`code` required string

code is the machine-readable error code.

Allowed: `internal error` , `not implemented` , `not found` , `conflict` , `invalid` , `unprocessable entity` , `empty value` , `unavailable` , `forbidden` , `too many requests` , `unauthorized` , `method not allowed` , `request too large` , `unsupported media type`

`err` string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message` string

Human-readable message.

`op` string

Describes the logical code operation when the error occurred. Useful for debugging.

POST `/api/v2/restore/sql`

### Overwrite the embedded SQL store on the server with a backed-up snapshot.

#### Parameters

##### Header parameters

`Zap-Trace-Span` string

OpenTracing span context

`Content-Encoding` string

The value tells InfluxDB what compression is applied to the line protocol in the request payload. To make an API request with a gzip-compressed payload, send `Content-Encoding: gzip` as a request header.

Allowed values: `gzip` , `identity`

Default: `identity`

`Content-Type` string

Allowed values: `application/octet-stream`

Default: `application/octet-stream`

#### Request body required

Full SQL snapshot.

Content-Type: `application/json`

Example request [Ask AI about this](#)

```sh
curl --request POST \
  "http://localhost:8086/api/v2/restore/sql" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: text/plain" \
  --data-raw 'measurement,tag=value field=1.0'
```

#### Responses

204 SQL store successfully overwritten.

default Non 2XX error response from server.

`code` required string

code is the machine-readable error code.

Allowed: `internal error` , `not implemented` , `not found` , `conflict` , `invalid` , `unprocessable entity` , `empty value` , `unavailable` , `forbidden` , `too many requests` , `unauthorized` , `method not allowed` , `request too large` , `unsupported media type`

`err` string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message` string

Human-readable message.

`op` string

Describes the logical code operation when the error occurred. Useful for debugging.
