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 bucket.
Use this endpoint to send data in line protocol format to InfluxDB.
InfluxDB 3 Cloud Serverless 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: Data from the batch was rejected and not written. The response body indicates if a partial write occurred.
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 Serverless.
- Use the
/writeendpoint for InfluxDB v1 parameter compatibility. - Use
/api/v2/writeendpoint for InfluxDB v2 parameter compatibility.
Rate limits
Write rate limits apply. For more information, see limits and adjustable quotas.
Related guides
Parameters
Query parameters
org
required
stringAn organization name or ID.
InfluxDB 3 Cloud Serverless writes data to the bucket in the organization associated with the authorization (API token);
doesn’t use the org parameter or orgID parameter.
orgID
stringAn organization ID.
InfluxDB 3 Cloud Serverless writes data to the bucket in the organization associated with the authorization (API token);
doesn’t use the org parameter or orgID parameter.
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 3 Cloud Serverless
- Returns only
application/jsonfor format and limit errors. - Returns only
text/htmlfor some quota limit errors.
Related guides
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.
Related guides
application/jsoncurl --request POST \
"https://us-east-1-1.aws.cloud2.influxdata.com/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
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
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 this organization and bucket.
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
stringThe request payload is too large. InfluxDB rejected the batch and did not write any data.
InfluxDB returns this error if the payload exceeds the 50MB size limit or all data is outside the retention window.
code
required
stringinvalidmessage
required
stringToo many requests.
InfluxDB Cloud
- Returns this error if a read or write request exceeds your plan’s adjustable service quotas or if a delete request exceeds the maximum global limit.
- For rate limits that reset automatically, returns a
Retry-Afterheader that describes when to try the write again. - For limits that can’t reset (for example, cardinality limit), doesn’t return a
Retry-Afterheader.
Rates (data-in (writes), queries (reads), and deletes) accrue within a fixed five-minute window. Once a rate limit is exceeded, InfluxDB returns an error response until the current five-minute window resets.
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
stringService unavailable.
- Returns this error if the server is temporarily unavailable to accept writes.
- Returns a
Retry-Afterheader that describes when to try the write again.
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 bucket.
Use this endpoint for InfluxDB v1 parameter compatibility when sending data in line protocol format to InfluxDB.
InfluxDB 3 Cloud Serverless 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: 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 Serverless.
- Use the
/writeendpoint for InfluxDB v1 parameter compatibility. - Use
/api/v2/writeendpoint for InfluxDB v2 parameter compatibility.
Rate limits
Write rate limits apply. For more information, see limits and adjustable quotas.
Related guides
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://us-east-1-1.aws.cloud2.influxdata.com/write?db=DB" \
--header "Authorization: Bearer INFLUX_TOKEN" \
--header "Content-Type: text/plain" \
--data-raw 'measurement,tag=value field=1.0'Responses
code
required
stringinternal error
, not found
, conflict
, invalid
, empty value
, unavailableerr
stringline
integer <int32>message
stringop
stringAll data in the batch is rejected and not written.
The response body contains details about the rejected 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
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
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 Serverless and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support.