Skip to navigation

Upload a File

View as Markdown
Upload a file into a space and return the canonical file resource.

Authentication

AuthorizationBearer

Use Bearer <api-key>.

Headers

BCTRL-VersionenumOptional
Dated API version. Defaults to the release pinned when the API key was created.
Allowed values:
BCTRL-SpacestringOptional
Select one authorized Space by its opaque ID or unique name. Omission uses the operation default.
BCTRL-Subaccount-IdstringOptional
Optional effective subaccount context for organization API keys. Subaccount API keys are already scoped and cannot use this header to act as another subaccount.
Idempotency-KeystringOptional1-200 characters

Optional retry key for this billable operation. Reusing the same key with the same request replays its stable outcome; credential-bearing results may be freshly issued for the same principal. Reusing it with a different request returns 409.

Query parameters

spaceIdstringOptional

Filter by a prefixed space ID, or pass default to use the caller default space.

Request

This endpoint expects a multipart form containing a file.
filefileRequired
File bytes to upload.
filenamestringOptional<=255 characters
Optional display filename.
metadatastringOptional

Optional JSON object string with caller-owned file metadata.

pathstringOptional<=4096 characters
Optional relative destination path. Must not be absolute or contain . or .. path segments.

Response headers

BCTRL-Request-IdstringOptional
Current request identifier, also echoed in errors.
BCTRL-VersionstringOptional
Negotiated dated API version.
RateLimit-Limitinteger

Evaluated policy limit; zero when no finite policy was evaluated.

RateLimit-Remaininginteger

Remaining policy budget; zero when no finite policy was evaluated.

RateLimit-Resetinteger

Seconds until reset; zero when no finite policy was evaluated.

Response

Created
contentTypestring
createdAtdatetime
RFC 3339 timestamp with a UTC offset.
downloadUrlstring
filenamestring1-255 characters
idstring
Unique file identifier generated by BCTRL.
object"file"
pathstring
sizeBytesinteger>=0

Non-negative number of bytes.

sourceenum
Allowed values:
spaceIdstring
Unique space identifier generated by BCTRL.
updatedAtdatetime
RFC 3339 timestamp with a UTC offset.
canDeletebooleanOptional
expiresAtdatetimeOptional
RFC 3339 timestamp with a UTC offset.
metadataobject or nullOptional
runIdstringOptional
Unique run identifier generated by BCTRL.
runtimeIdstringOptional
Unique browser identifier generated by BCTRL.
typestringOptional1-64 characters

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
429
Too Many Requests Error
500
Internal Server Error
503
Service Unavailable Error