palbaseDocs

Palbase Storage · API

PUT/storage/buckets/{bucket}/objects/{path}

Write an object

Stores the body at the path, replacing what is there (If-None-Match: * only creates). The type is sniffed from the bytes, not taken from Content-Type (which is used when the bytes cannot tell, as for HEIC); the bucket's ceiling and types are enforced while the bytes stream. A picture gets its dimensions, a placeholder (thumbhash) and the bucket's renditions, made inside the upload. owner_id makes the object a user's: it goes when they are deleted. Emits file.uploaded.

Called by your server, with the project's secret key.

Path

bucketstring · requiredThe bucket's name: a lowercase letter, then lowercase letters, digits and -, 2 to 63 characters.
pathstring · requiredThe object's path as ONE percent-encoded segment: a/b.jpg is a%2Fb.jpg. Segments are separated by /, none empty, . or ..; 1 to 1024 bytes of UTF-8.

Query

owner_idstring · optionalThe user the object belongs to; it is deleted with them. Absent: the project's.

Headers

If-None-Match"*" · optional* to create only: an object already at the path is refused with 412.
X-Checksum-Sha256string · optionalThe bytes' sha256, hex: bytes that do not match are refused and nothing is kept.
curl
curl -X PUT "https://<your-ref>.palbase.studio/storage/buckets/<bucket>/objects/<path>" \
  -H "apikey: $PALBASE_SECRET_KEY" \
  -H "content-type: */*" \
  --data-binary @file

Responses

200The object, replaced

201The object, created

400The request is malformed: a field, a path or a parameter is wrong

401No key, or not a key of this project (the edge's answer)

403Not the project's secret key; or, on a credential-less route, a private object or a link that is not valid for it

404No such bucket, object or variant

412If-None-Match: * and an object is already at the path

413The object is larger than the bucket, or the link, takes

415The bucket, or the link, does not take the object's content type (sniffed from its bytes)

422A picture this storage cannot decode, or an Idempotency-Key sent with a different request

429The project's request rate, or its storage quota for the period, is used up — or, slowed for its month's traffic, it has as many downloads under way as are paced at once; Retry-After says when to try again

503The platform could not answer now; retrying is safe (Retry-After)

defaultAn error: the envelope names it (`error`) and explains it (`error_description`).

Operation PutObject of storage's contract.