Sign inGet Started

bird assets uploads create

Usage

Contoh kode
bird assets uploads create [flags]

Description

Create a media-library upload session

Creates or recovers an upload session for a fixed file. Calculate its size and SHA-256 in code, supply a fresh client_reference, then follow the returned state and next steps. When upload is present, PUT the original bytes using it and call bird assets uploads complete. File bytes must stay outside tool arguments. Per region, new sessions are capped at 20 unexpired sessions per workspace, 100 per organization, and 500 MiB reserved per organization. E20021 means wait for capacity. Completed and cancelled sessions count until expiry; byte reservations remain until cleanup succeeds.

Build the request from flags, a JSON AssetUploadSessionCreate body via --body-file ("-" reads stdin), or both — a flag overrides the matching body field. Run --example to print a ready-to-edit body, or --dry-run to print the resolved request without sending it.

Procedure

Step 1 of 2 of "Upload a file to the media library". Next: bird assets uploads complete.

Examples

Contoh kode
# print the body shape (no credentials needed)
bird assets uploads create --example

# the body it prints:
Contoh kode
{
  "client_reference": "4ca4145c-782a-4d03-bc80-a27e3e431780",
  "file": {
    "content_type": "application/pdf",
    "filename": "invoice.pdf",
    "sha256": "4e2090a479f7ce6b17ad31f991988f12571bcafbd4a441cc4063644fc1400ae0",
    "size_bytes": 1024
  },
  "folder_id": "asf_01krdgeqcxet5s7t44vh8rt9mg"
}

Options

Request

NameDescription
--body-fileRead the JSON request body from this file; "-" reads stdin
--examplePrint a complete example request body, then exit
--dry-runPrint the resolved request without sending it, then exit
--idempotency-keyDeduplication key; a retry with the same key won't act twice

Options

NameDescription
--client-referenceCaller-generated UUID for this upload intent. Retries with identical input recover the same session while its receipt is retained. (required; or in --body-file)
--nameDisplay name. Omitted or blank names default to the sanitized filename.
--alt-textDefault alternative text for the asset.
--folder-idDestination folder in this workspace. Omit it to use the library root.
--response-schemaPrint the fields this command returns, then exit
NameDescription
bird assets uploads cancelCancel a media-library upload
bird assets uploads completeComplete a media-library upload
bird assets uploads getGet a media-library upload session
bird assets uploads prepareRefresh a media-library upload instruction