Quick start
Authenticate, write, and query with the InfluxDB OSS v2 API:
Create an API token with write and read permissions for a bucket. For new installations, set up InfluxDB and create the initial admin token during the onboarding process.
Check the status of the InfluxDB server.
curl "http://localhost:8086/health"Write data to a bucket using the
/api/v2/writeendpoint and line protocol.curl --request POST \ "http://localhost:8086/api/v2/write?org=ORG&bucket=BUCKET&precision=s" \ --header "Authorization: Token YOUR_API_TOKEN" \ --header "Content-Type: text/plain; charset=utf-8" \ --data-raw "home,room=Kitchen temp=72.0 1640995200 home,room=Living\ Room temp=71.5 1640995200"If all data is written, the response is
204 No Content.Query data using the Flux
/api/v2/queryendpoint.curl --request POST \ "http://localhost:8086/api/v2/query?org=ORG" \ --header "Authorization: Token YOUR_API_TOKEN" \ --header "Content-Type: application/vnd.flux" \ --data 'from(bucket: "BUCKET") |> range(start: -1h) |> filter(fn: (r) => r._measurement == "home")'Alternatively, query with InfluxQL using the v1-compatible
/queryendpoint. Target a v1 DBRP mapping (database.retention_policy) that points to your bucket:curl --get "http://localhost:8086/query" \ --header "Authorization: Token YOUR_API_TOKEN" \ --data-urlencode "db=DATABASE" \ --data-urlencode "q=SELECT * FROM home WHERE time > now() - 1h"
For more information, see Get started with InfluxDB OSS v2.
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support.