Write an object
At most 64 MiB. The length must be declared with Content-Length, or X-Declared-Length for a chunked body (else 411).
/v1/apps/{project}/r2/{bucket}/objects/{key}AuthorizationBearer token · headerrequiredA team API key, sbk_..., from Settings, API keys.
x-api-keyAPI key · headerrequiredThe same key, in a header of its own.
projectstringrequiredThe app's name, unique within the team. 3 to 51 characters (or 1), lowercase letters, digits and dashes, not starting or ending with a dash.
bucketstringrequiredThe R2 binding name from the app's config, for example FILES.
keystringrequiredThe object key, the rest of the path after /objects/. It spans path segments: each / in the key is a literal / in
the URL (assets/logo.png is /objects/assets/logo.png), and every segment is percent-encoded on its own. A key is 1 to
1024 bytes of UTF-8 with no control character, backslash, empty segment or . or .. segment; a percent-encoded dot,
slash or backslash in the path is refused (400 invalid, path: key). OpenAPI has no way to mark a path parameter as
spanning segments (allowReserved is formally for query parameters); a generator that does not read it as such needs a
rest-of-path label ({key+}) for this one parameter.
application/octet-streamstring<binary>Stored.
keystringsizeintegeretagstringThe request is malformed. path names the field when one is at fault; some refusals (a digest mismatch, a body that is not JSON) carry a message only.
errorstringrequiredA message for people. Do not parse it.
reasonstringrequiredinvaliderrorstringrequiredA message for people. Do not parse it.
reasonstringA stable, machine-readable cause, when there is one.
pathstringThe request field at fault.
needstringThe grant a 403 asks for, app:write for example.
retry_after_sintegerNo key, or an invalid, expired or revoked key (unknown or missing API token, invalid, expired or revoked API key). No reason.
errorstringrequiredA message for people. Do not parse it.
reasonstringA stable, machine-readable cause, when there is one.
pathstringThe request field at fault.
needstringThe grant a 403 asks for, app:write for example.
retry_after_sintegerThe key lacks a grant (reason: forbidden, need: "<resource>:<action>").
errorstringrequiredA message for people. Do not parse it.
reasonstringrequiredforbiddenneedstringrequiredThe grant, as <resource>:<action>, for example app:write.
No such app (message only), database (no-database), bucket (no-bucket) or object (no-object).
errorstringrequiredA message for people. Do not parse it.
reasonstringrequiredno-databaseerrorstringrequiredA message for people. Do not parse it.
reasonstringrequiredno-bucketerrorstringrequiredA message for people. Do not parse it.
reasonstringrequiredno-objecterrorstringrequiredA message for people. Do not parse it.
reasonstringA stable, machine-readable cause, when there is one.
pathstringThe request field at fault.
needstringThe grant a 403 asks for, app:write for example.
retry_after_sintegerA chunked upload did not declare its length (reason: length-required).
errorstringrequiredA message for people. Do not parse it.
reasonstringrequiredlength-requiredThe body is over the limit for this route (reason: too-large; some refusals carry a message only).
errorstringrequiredA message for people. Do not parse it.
reasonstringrequiredtoo-largeerrorstringrequiredA message for people. Do not parse it.
reasonstringA stable, machine-readable cause, when there is one.
pathstringThe request field at fault.
needstringThe grant a 403 asks for, app:write for example.
retry_after_sintegerData routes: too many requests in flight or an empty bucket (rate; note retry_after, without _s), or key-rate-limited. Honor Retry-After.
errorstringrequiredA message for people. Do not parse it.
reasonstringrequiredkey-rate-limitedretry_after_sintegerrequiredSeconds to wait; also the Retry-After header.
errorstringrequiredA message for people. Do not parse it.
reasonstringrequiredrateretry_afterintegerrequiredSeconds to wait; also the Retry-After header.
The host agent answered something the Cloud could not handle (reason: agent-error).
errorstringrequiredA message for people. Do not parse it.
reasonstringrequiredagent-errorThe app's host is not reachable (host-unavailable), is busy with the app's data (busy, Retry-After), or the audit log could not record the request (audit-unavailable). Retry shortly.
errorstringrequiredA message for people. Do not parse it.
reasonstringrequiredhost-unavailableerrorstringrequiredA message for people. Do not parse it.
reasonstringrequiredbusyretry_afterintegerrequiredSeconds to wait; also the Retry-After header.
errorstringrequiredA message for people. Do not parse it.
reasonstringrequiredaudit-unavailableThe host did not answer in time (reason: timeout). committed says whether a write may have been applied.
errorstringrequiredA message for people. Do not parse it.
reasonstringrequiredtimeoutcommittedstringrequirednounknownThe app's storage quota on its host is full (reason: quota-exceeded).
errorstringrequiredA message for people. Do not parse it.
reasonstringrequiredquota-exceeded