Skip to main content
CoreWeave AI Object Storage supports conditional requests on reads and writes. A conditional request attaches an HTTP precondition header to an S3 API call. The operation proceeds only if the precondition holds. Otherwise, the server returns an error and doesn’t modify or transfer the object. Use conditional requests to skip unnecessary downloads when objects haven’t changed, and to prevent accidental overwrites when multiple writers might update the same object.

About ETags

An ETag (entity tag) is a content fingerprint that the server returns for every object. The response of PutObject, HeadObject, and GetObject calls includes the ETag. When an object’s content changes, its ETag changes. Use HeadObject to retrieve the current ETag without downloading the object. The server returns ETags as quoted hex strings, for example "1b2cf535f27731c97434645a985325". Include the quotes when you pass an ETag to a precondition header.

Conditional reads

Conditional reads let you skip a GetObject download when the object hasn’t changed since the last time you read it. Pass the ETag you last received as the If-None-Match value. If the object hasn’t changed, the server returns 304 Not Modified and transfers no data. If the object has changed, the download proceeds. Use If-Match to download only when the object matches a specific ETag, or to detect that the object changed since you last read it.
Replace [BUCKET-NAME], [OBJECT-KEY], [LAST-KNOWN-ETAG], and [LOCAL-OUTPUT-PATH] with the appropriate values.
aws s3api get-object \
  --bucket [BUCKET-NAME] \
  --key [OBJECT-KEY] \
  --if-none-match '"[LAST-KNOWN-ETAG]"' \
  --endpoint-url https://cwobject.com \
  [LOCAL-OUTPUT-PATH]
If the ETag matches (the object hasn’t changed), the command returns an error that wraps the 304 Not Modified response.

Conditional writes

Conditional writes prevent accidental overwrites by requiring that a precondition holds before PutObject, CompleteMultipartUpload, CopyObject, or RenameObject modifies an object. If the precondition fails, the server returns 412 Precondition Failed and doesn’t modify the object. RenameObject supports a richer set of conditional headers, including separate source and destination preconditions and time-based conditions. See RenameObject conditionals for details. Conditional writes support two patterns:
PatternHeaderValueBehavior
Safe createIf-None-Match*Write only if no object exists at the key.
Compare-and-swapIf-MatchETag valueWrite only if the object’s current ETag matches.
For full header constraints, see Conditional writes in the S3 API reference.

Safe create

Use If-None-Match: * to write an object only if no object already exists at that key. This prevents overwriting existing data even when multiple writers race for the same key. If two concurrent requests use If-None-Match: * for the same key, one succeeds and the other returns 409 ConditionalRequestConflict. Retry the request on 409.
Replace [BUCKET-NAME], [OBJECT-KEY], and [LOCAL-FILE-PATH] with the appropriate values.
aws s3api put-object \
  --bucket [BUCKET-NAME] \
  --key [OBJECT-KEY] \
  --body [LOCAL-FILE-PATH] \
  --if-none-match '*' \
  --endpoint-url https://cwobject.com

Compare-and-swap

Use If-Match with the current ETag to write an object only if it hasn’t changed since you last read it. This detects concurrent updates that occur between your read and write. The workflow is:
  1. Call HeadObject to retrieve the current ETag.
  2. Perform your local computation or modification.
  3. Call PutObject with If-Match set to the ETag from step 1.
If another writer modifies the object between step 1 and step 3, the server returns 412 Precondition Failed. Retry from step 1 to read the updated object.
Replace [BUCKET-NAME], [OBJECT-KEY], and [LOCAL-FILE-PATH] with the appropriate values.
# Step 1: Get the current ETag
ETAG=$(aws s3api head-object \
  --bucket [BUCKET-NAME] \
  --key [OBJECT-KEY] \
  --endpoint-url https://cwobject.com \
  --query ETag --output text)

# Step 2: Write only if the ETag still matches
aws s3api put-object \
  --bucket [BUCKET-NAME] \
  --key [OBJECT-KEY] \
  --body [LOCAL-FILE-PATH] \
  --if-match "$ETAG" \
  --endpoint-url https://cwobject.com

RenameObject conditionals

RenameObject supports a richer set of conditional headers, including separate preconditions for the source and destination objects, and time-based conditions. For the full list of supported headers and usage examples, see Preconditions and safeguards in the rename objects guide.
Last modified on May 29, 2026