---
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: 2054
product: InfluxDB OSS v2
version: v2
publisher: InfluxData
canonical: https://docs.influxdata.com/influxdb/v2/api/restore/
---

[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`requiredstring

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 bodyrequired

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

200ID mappings for shards in bucket.

defaultNon 2XX error response from server.

`code`requiredstring

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 bodyrequired

Metadata manifest for a bucket.

Content-Type:`application/json`

`bucketID`requiredstring

`bucketName`requiredstring

`defaultRetentionPolicy`requiredstring

`description`string

`organizationID`requiredstring

`organizationName`requiredstring

`retentionPolicies`requiredstring

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

201ID mappings for shards in new bucket.

`id`requiredstring

New ID of the restored bucket

`name`requiredstring

`shardMappings`requiredstring

defaultNon 2XX error response from server.

`code`requiredstring

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 bodyrequired

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

200KV store successfully overwritten.

`token`string

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

204KV store successfully overwritten.

defaultNon 2XX error response from server.

`code`requiredstring

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`requiredstring

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 bodyrequired

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

204TSM snapshot successfully restored.

defaultNon 2XX error response from server.

`code`requiredstring

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 bodyrequired

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

204SQL store successfully overwritten.

defaultNon 2XX error response from server.

`code`requiredstring

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.
