---
title: Backup
description: Back up InfluxDB OSS v2 data, including time series data and metadata, for use in restore operations.
url: https://docs.influxdata.com/influxdb/v2/api/backup/
estimated_tokens: 4828
product: InfluxDB OSS v2
version: v2
---

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

Back up InfluxDB OSS v2 data, including time series data and metadata, for use in restore operations.

GET `/api/v2/backup/kv`

### Download snapshot of metadata stored in the server's embedded KV store. Don't use with InfluxDB versions greater than InfluxDB 2.1.x.

Retrieves a snapshot of metadata stored in the server’s embedded KV store. InfluxDB versions greater than 2.1.x don’t include metadata stored in embedded SQL; avoid using this endpoint with versions greater than 2.1.x.

#### Parameters

##### Header parameters

`Zap-Trace-Span` string

OpenTracing span context

Example request [Ask AI about this](#)

```sh
curl --request GET \
  "http://localhost:8086/api/v2/backup/kv" \
  --header "Authorization: Bearer INFLUX_TOKEN"
```

#### Responses

200 Success. The response contains a snapshot of KV metadata.

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.

GET `/api/v2/backup/metadata`

### Download snapshot of all metadata in the server

#### Parameters

##### Header parameters

`Zap-Trace-Span` string

OpenTracing span context

`Accept-Encoding` string

Indicates the content encoding (usually a compression algorithm) that the client can understand.

Allowed values: `gzip` , `identity`

Default: `identity`

Example request [Ask AI about this](#)

```sh
curl --request GET \
  "http://localhost:8086/api/v2/backup/metadata" \
  --header "Authorization: Bearer INFLUX_TOKEN"
```

#### Responses

200 Snapshot of metadata

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.

GET `/api/v2/backup/shards/{shardID}`

### Download snapshot of all TSM data in a shard

#### Parameters

##### Path parameters

`shardID` required integer <int64>

The shard ID.

##### Query parameters

`since` string <date-time>

The earliest time [RFC3339 date/time format](/influxdb/v2/reference/glossary/#rfc3339-timestamp) to include in the snapshot.

##### Header parameters

`Zap-Trace-Span` string

OpenTracing span context

`Accept-Encoding` string

Indicates the content encoding (usually a compression algorithm) that the client can understand.

Allowed values: `gzip` , `identity`

Default: `identity`

`Gzip-Compression-Level` string

The gzip compression level to use when compressing the response.

Allowed values: `none` , `default` , `speedy` , `full`

Example request [Ask AI about this](#)

```sh
curl --request GET \
  "http://localhost:8086/api/v2/backup/shards/{shardID}" \
  --header "Authorization: Bearer INFLUX_TOKEN"
```

#### Responses

200 TSM snapshot.

404 Shard not found.

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

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.
