---
title: Sources
description: Manage data sources configured in InfluxDB OSS v2.
url: https://docs.influxdata.com/influxdb/v2/api/sources/
estimated_tokens: 4013
product: InfluxDB OSS v2
version: v2
publisher: InfluxData
canonical: https://docs.influxdata.com/influxdb/v2/api/sources/
---

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

Manage data sources configured in InfluxDB OSS v2.

GET`/api/v2/sources`

### List all sources

#### Parameters

##### Query parameters

`org`string

The name of the organization.

##### Header parameters

`Zap-Trace-Span`string

OpenTracing span context

Example request[Ask AI about this](#)

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

#### Responses

200A list of sources

`links`object

`self`string \<uri\>

`sources`object[]

`default`boolean

`defaultRP`string

`id`string

`insecureSkipVerify`boolean

`languages`string[]

`links`object

`buckets`string

`health`string

`query`string

`self`string

`metaUrl`string \<uri\>

`name`string

`orgID`string

`password`string

`sharedSecret`string

`telegraf`string

`token`string

`type`string

Allowed:`v1`, `v2`, `self`

`url`string \<uri\>

`username`string

defaultUnexpected error

`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/sources`

### Create a source

#### Parameters

##### Header parameters

`Zap-Trace-Span`string

OpenTracing span context

#### Request bodyrequired

Source to create

Content-Type:`application/json`

`default`boolean

`defaultRP`string

`id`string

`insecureSkipVerify`boolean

`languages`string[]

`links`object

`buckets`string

`health`string

`query`string

`self`string

`metaUrl`string \<uri\>

`name`string

`orgID`string

`password`string

`sharedSecret`string

`telegraf`string

`token`string

`type`string

Allowed:`v1`, `v2`, `self`

`url`string \<uri\>

`username`string

Example request[Ask AI about this](#)

```sh
curl --request POST \
  "http://localhost:8086/api/v2/sources" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: application/json" \
  --data-raw '{
  "default": false,
  "defaultRP": "DEFAULTRP",
  "id": "ID",
  "insecureSkipVerify": false,
  "languages": [
    "flux"
  ],
  "links": {
    "buckets": "BUCKETS",
    "health": "HEALTH",
    "query": "QUERY",
    "self": "SELF"
  },
  "metaUrl": "METAURL",
  "name": "NAME",
  "orgID": "ORGID",
  "password": "PASSWORD",
  "sharedSecret": "SHAREDSECRET",
  "telegraf": "TELEGRAF",
  "token": "TOKEN",
  "type": "v1",
  "url": "URL",
  "username": "USERNAME"
}'
```

#### Responses

201Created Source

`default`boolean

`defaultRP`string

`id`string

`insecureSkipVerify`boolean

`languages`string[]

`links`object

`buckets`string

`health`string

`query`string

`self`string

`metaUrl`string \<uri\>

`name`string

`orgID`string

`password`string

`sharedSecret`string

`telegraf`string

`token`string

`type`string

Allowed:`v1`, `v2`, `self`

`url`string \<uri\>

`username`string

defaultUnexpected error

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

GET`/api/v2/sources/{sourceID}`

### Retrieve a source

#### Parameters

##### Path parameters

`sourceID`requiredstring

The source ID.

##### Header parameters

`Zap-Trace-Span`string

OpenTracing span context

Example request[Ask AI about this](#)

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

#### Responses

200A source

`default`boolean

`defaultRP`string

`id`string

`insecureSkipVerify`boolean

`languages`string[]

`links`object

`buckets`string

`health`string

`query`string

`self`string

`metaUrl`string \<uri\>

`name`string

`orgID`string

`password`string

`sharedSecret`string

`telegraf`string

`token`string

`type`string

Allowed:`v1`, `v2`, `self`

`url`string \<uri\>

`username`string

404Source not found

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

defaultUnexpected error

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

PATCH`/api/v2/sources/{sourceID}`

### Update a Source

#### Parameters

##### Path parameters

`sourceID`requiredstring

The source ID.

##### Header parameters

`Zap-Trace-Span`string

OpenTracing span context

#### Request bodyrequired

Source update

Content-Type:`application/json`

`default`boolean

`defaultRP`string

`id`string

`insecureSkipVerify`boolean

`languages`string[]

`links`object

`buckets`string

`health`string

`query`string

`self`string

`metaUrl`string \<uri\>

`name`string

`orgID`string

`password`string

`sharedSecret`string

`telegraf`string

`token`string

`type`string

Allowed:`v1`, `v2`, `self`

`url`string \<uri\>

`username`string

Example request[Ask AI about this](#)

```sh
curl --request PATCH \
  "http://localhost:8086/api/v2/sources/{sourceID}" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: application/json" \
  --data-raw '{
  "default": false,
  "defaultRP": "DEFAULTRP",
  "id": "ID",
  "insecureSkipVerify": false,
  "languages": [
    "flux"
  ],
  "links": {
    "buckets": "BUCKETS",
    "health": "HEALTH",
    "query": "QUERY",
    "self": "SELF"
  },
  "metaUrl": "METAURL",
  "name": "NAME",
  "orgID": "ORGID",
  "password": "PASSWORD",
  "sharedSecret": "SHAREDSECRET",
  "telegraf": "TELEGRAF",
  "token": "TOKEN",
  "type": "v1",
  "url": "URL",
  "username": "USERNAME"
}'
```

#### Responses

200Created Source

`default`boolean

`defaultRP`string

`id`string

`insecureSkipVerify`boolean

`languages`string[]

`links`object

`buckets`string

`health`string

`query`string

`self`string

`metaUrl`string \<uri\>

`name`string

`orgID`string

`password`string

`sharedSecret`string

`telegraf`string

`token`string

`type`string

Allowed:`v1`, `v2`, `self`

`url`string \<uri\>

`username`string

404Source not found

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

defaultUnexpected error

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

DELETE`/api/v2/sources/{sourceID}`

### Delete a source

#### Parameters

##### Path parameters

`sourceID`requiredstring

The source ID.

##### Header parameters

`Zap-Trace-Span`string

OpenTracing span context

Example request[Ask AI about this](#)

```sh
curl --request DELETE \
  "http://localhost:8086/api/v2/sources/{sourceID}" \
  --header "Authorization: Bearer INFLUX_TOKEN"
```

#### Responses

204Delete has been accepted

404View not found

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

defaultUnexpected error

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

GET`/api/v2/sources/{sourceID}/buckets`

### Get buckets in a source

#### Parameters

##### Path parameters

`sourceID`requiredstring

The source ID.

##### Query parameters

`org`string

The name of the organization.

##### Header parameters

`Zap-Trace-Span`string

OpenTracing span context

Example request[Ask AI about this](#)

```sh
curl --request GET \
  "http://localhost:8086/api/v2/sources/{sourceID}/buckets" \
  --header "Authorization: Bearer INFLUX_TOKEN"
```

#### Responses

200A source

`buckets`object[]

`createdAt`string \<date-time\>

`description`string

`id`string

`labels`object[]

`id`string

`name`string

`orgID`string

`properties`object

Key-value pairs associated with this label.
To remove a property, send an update with an empty value (`""`) for the key.

Example:`{"color":"ffb3b3","description":"this is a description"}`

`links`object

Example:`{"labels":"/api/v2/buckets/1/labels","members":"/api/v2/buckets/1/members","org":"/api/v2/orgs/2","owners":"/api/v2/buckets/1/owners","self":"/api/v2/buckets/1","write":"/api/v2/write?org=2\u0026bucket=1"}`

`labels`string \<uri\>

URI of resource.

`members`string \<uri\>

URI of resource.

`org`string \<uri\>

URI of resource.

`owners`string \<uri\>

URI of resource.

`self`string \<uri\>

URI of resource.

`write`string \<uri\>

URI of resource.

`name`requiredstring

`orgID`string

`retentionRules`requiredobject[]

Retention rules to expire or retain data.
The InfluxDB `/api/v2` API uses `RetentionRules` to configure the [retention period](/influxdb/v2/reference/glossary/#retention-period).

#### InfluxDB Cloud

* `retentionRules` is required.

#### InfluxDB OSS

* `retentionRules` isn’t required.

`everySeconds`requiredinteger \<int64\>

The duration in seconds for how long data will be kept in the database.
The default duration is 2592000 (30 days).
0 represents infinite retention.

Default:`2592000`

Example:`86400`

`shardGroupDurationSeconds`integer \<int64\>

The shard group duration.
The duration or interval (in seconds) that each shard group covers.

#### InfluxDB Cloud

* Does not use `shardGroupDurationsSeconds`.

#### InfluxDB OSS

* Default value depends on the[bucket retention period](/influxdb/v2/reference/internals/shards/#shard-group-duration).

`type`string

Allowed:`expire`

Default:`expire`

`rp`string

`schemaType`string

Allowed:`implicit`, `explicit`

`type`string

Allowed:`user`, `system`

Default:`user`

`updatedAt`string \<date-time\>

`links`object

URI pointers for additional paged results.

`next`string \<uri\>

URI of resource.

`prev`string \<uri\>

URI of resource.

`self`requiredstring \<uri\>

URI of resource.

404Source not found

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

defaultUnexpected error

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

GET`/api/v2/sources/{sourceID}/health`

### Get the health of a source

#### Parameters

##### Path parameters

`sourceID`requiredstring

The source ID.

##### Header parameters

`Zap-Trace-Span`string

OpenTracing span context

Example request[Ask AI about this](#)

```sh
curl --request GET \
  "http://localhost:8086/api/v2/sources/{sourceID}/health" \
  --header "Authorization: Bearer INFLUX_TOKEN"
```

#### Responses

200The source is healthy

`checks`object[]

`checks`object[]

`checks`object[]

`commit`string

`message`string

`name`requiredstring

`status`requiredstring

Allowed:`pass`, `fail`

`version`string

`commit`string

`message`string

`name`requiredstring

`status`requiredstring

Allowed:`pass`, `fail`

`version`string

`commit`string

`message`string

`name`requiredstring

`status`requiredstring

Allowed:`pass`, `fail`

`version`string

503The source is not healthy

`checks`object[]

`checks`object[]

`checks`object[]

`commit`string

`message`string

`name`requiredstring

`status`requiredstring

Allowed:`pass`, `fail`

`version`string

`commit`string

`message`string

`name`requiredstring

`status`requiredstring

Allowed:`pass`, `fail`

`version`string

`commit`string

`message`string

`name`requiredstring

`status`requiredstring

Allowed:`pass`, `fail`

`version`string

defaultUnexpected error

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