Write data
/api/v2/write endpoint or the v1-compatible /write endpoint with line protocol./api/v2/writeWrite data using the InfluxDB v2 HTTP API
Writes data to a database.
Use this endpoint to send data in line protocol format to InfluxDB.
InfluxDB 3 Cloud Dedicated does the following when you send a write request:
Validates the request.
If successful, attempts to ingest data from the request body; otherwise, responds with an error status.
Ingests or rejects data in the batch and returns one of the following HTTP status codes:
204 No Content: All data in the batch is ingested.400 Bad Request: Some (when partial writes are configured for the cluster) or all of the data has been rejected. Data that has not been rejected is ingested and queryable.
The response body contains error details about rejected points, up to 100 points.
Writes are synchronous–the response status indicates the final status of the write and all ingested data is queryable.
To ensure that InfluxDB handles writes in the order you request them, wait for the response before you send the next request.
Write endpoints
The /write and /api/v2/write endpoints are functionally equivalent for writing data to InfluxDB Cloud Dedicated.
- Use the
/writeendpoint for InfluxDB v1 parameter compatibility. - Use the
/api/v2/writeendpoint for InfluxDB v2 parameter compatibility.
Parameters
Query parameters
org
required
stringIgnored. An organization name or ID.
InfluxDB ignores this parameter; authorizes the request using the specified database token and writes data to the specified cluster database.
orgID
stringIgnored. An organization ID.
InfluxDB ignores this parameter; authorizes the request using the specified database token and writes data to the specified cluster database.
bucket
required
stringprecision
stringHeader parameters
Zap-Trace-Span
stringContent-Encoding
stringContent-Encoding: gzip header.gzip
, identityidentityContent-Type
stringContent-Type: text/plain; charset=utf-8.text/plain
, text/plain; charset=utf-8text/plain; charset=utf-8Content-Length
integermax body configuration option,
the server responds with status code 413.Accept
stringThe content type that the client can understand. Writes only return a response body if they fail–for example, due to a formatting problem or quota limit.
InfluxDB Cloud
- Returns only
application/jsonfor format and limit errors. - Returns only
text/htmlfor some quota limit errors.
application/jsonapplication/jsonRequest body required
In the request body, provide data in line protocol format.
To send compressed data, do the following:
- Use gzip to compress the line protocol data.
- In your request, send the compressed data and the
Content-Encoding: gzipheader.
application/jsoncurl --request POST \
"https://cluster-id.a.influxdb.io/api/v2/write?org=ORG&bucket=BUCKET" \
--header "Authorization: Bearer INFLUX_TOKEN" \
--header "Content-Type: text/plain" \
--data-raw 'airSensors,sensor_id=TLM0201 temperature=73.97038159354763,humidity=35.23103248356096,co=0.48445310567793615 1630424257000000000'Responses
code
required
stringinternal error
, not found
, conflict
, invalid
, empty value
, unavailableerr
stringline
integer <int32>message
stringop
stringcode
required
stringinternal error
, not found
, conflict
, invalid
, empty value
, unavailableerr
stringline
integer <int32>message
stringop
stringUnauthorized. The error may indicate one of the following:
- The
Authorization: Tokenheader is missing or malformed. - The API token value is missing from the header.
- The token doesn’t have sufficient permissions to write to or query the database.
code
stringunauthorized.unauthorizedmessage
stringNot found. A requested resource was not found. The response body contains the requested resource type and the name value (if you passed it)–for example:
"organization name \"my-org\" not found""organization not found": indicates you passed an ID that did not match an organization.
code
required
stringinternal 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 typeerr
stringmessage
stringop
stringcode
required
stringinternal 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 typeerr
stringmessage
stringop
stringService unavailable.
- Returns this error if the server is temporarily unavailable to accept writes due to concurrent request limits or insufficient healthy ingesters.
code
required
stringinternal 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 typeerr
stringmessage
stringop
string/writeWrite data using the InfluxDB v1 HTTP API
Writes data to a database.
Use this endpoint for InfluxDB v1 parameter compatibility when sending data in line protocol format to InfluxDB.
InfluxDB 3 Cloud Dedicated does the following when you send a write request:
Validates the request.
If successful, attempts to ingest data from the request body; otherwise, responds with an error status.
Ingests or rejects data in the batch and returns one of the following HTTP status codes:
204 No Content: all data in the batch is ingested201 Created(If the cluster is configured to allow partial writes): some points in the batch are ingested and queryable, and some points are rejected400 Bad Request: all data is rejected
The response body contains error details about rejected points, up to 100 points.
Writes are synchronous–the response status indicates the final status of the write and all ingested data is queryable.
To ensure that InfluxDB handles writes in the order you request them, wait for the response before you send the next request.
Write endpoints
The /write and /api/v2/write endpoints are functionally equivalent for writing data to InfluxDB Cloud Dedicated.
- Use the
/writeendpoint for InfluxDB v1 parameter compatibility. - Use the
/api/v2/writeendpoint for InfluxDB v2 parameter compatibility.
Parameters
Query parameters
u
stringp
stringdb
required
stringrp
stringprecision
stringHeader parameters
Zap-Trace-Span
stringContent-Encoding
stringgzip
, identityidentityRequest body required
application/jsoncurl --request POST \
"https://cluster-id.a.influxdb.io/write?db=DB" \
--header "Authorization: Bearer INFLUX_TOKEN" \
--header "Content-Type: text/plain" \
--data-raw 'measurement,tag=value field=1.0'Responses
Data from the batch was rejected and not written. The response body indicates if a partial write occurred or all data was rejected. If a partial write occurred, then some points from the batch are written and queryable.
The response body contains details about the rejected points, up to 100 points.
code
required
stringinternal error
, not found
, conflict
, invalid
, empty value
, unavailableerr
stringline
integer <int32>message
stringop
stringcode
required
stringinternal 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 typeerr
stringmessage
stringop
stringcode
required
stringinternal 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 typeerr
stringmessage
stringop
stringcode
required
stringinvalidmessage
required
stringUnprocessable Entity.
The request contained data outside the database’s retention period. InfluxDB rejected the batch and wrote no data.
The response body contains details about the rejected points.
code
required
stringinternal 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 typeerr
stringmessage
stringop
stringWas 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 Cloud Dedicated and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support.