Add, change, delete or share media of the user's media library.
Actions:
- `add`: save a file in the library from `media_url` (a public
https:// link to the file itself) or `media_file` (a file reference
supplied by the chat host). Optional `name`, `folder_id`,
`is_profile_photo` (images only). A file already in the library is
not stored twice: the answer then has `reused: true` and the
existing media. Images, GIFs, videos and PDFs, 100 MB max.
- `prepare_upload` / `complete_upload` / `abort_upload`: for a client
that uploads local bytes over HTTPS (Claude Code). `prepare_upload`
takes `file_name` (also docx, pptx, xlsx, mp3, wav, m4a), optional
`mime_type`, `content_hash` ("sha256:<hex>" of the whole file: a
duplicate is answered at once, no upload), `name`, `folder_id`,
`is_profile_photo`; send the bytes as `upload_request` says, then
`complete_upload` with `upload_id`. On a network refusal, follow
`if_upload_blocked`.
- `update`: `asset_id` with any of `name`, `folder_id` (move) or
`remove_from_folder=true`, `is_favorite`, `is_profile_photo` (an
image only), `client_visible` (shown in the client's space). Pass
`asset_ids` instead to move, favorite or share up to 100 media at
once (not rename nor profile photo).
- `delete`: `asset_id`. Posts already using the file keep it. Ask the
user before deleting.
- `send_to_client`: org admins of an agency. Copies `asset_ids` (50
max) from the user's library into the library of `member_user_id`
(from list_org_members), shared with that client.
- `set_default_client_visible`: `default_client_visible` true or
false: whether media added later are visible to the client by
default (the account's setting on the Media page).
`member_user_id` has two meanings: with `send_to_client` it is the
client who receives the media; with every other action it is the
member whose library you change (an upload started for a member is
completed or aborted with the same member_user_id).
To put a library media in a post, use attach_library_media_to_post.