Update media by ID
/v1/media/{id}org.permission.kb.updateorg.user.media.writeThe API key or user must hold at least one of them. Legacy roles still work; prefer the others for new keys.
Updates a media object based on the unique media ID.
Media
Media are files your org stores in Kustomer for content rather than for a conversation, such as images embedded in knowledge base articles. You create a media record, upload the file to the temporary URL it returns, then reference the media ID where the file is used.
Media and attachments use the same upload flow, but they are kept apart: attachments belong to messages, notes and drafts, while media hold files used in your org's content, such as the knowledge base editor's images. A media ID only works with the media endpoints, and an attachment ID only with the attachment endpoints.
Uploading takes two steps. First, POST /v1/media with the file's name, contentType and contentLength (in bytes, up to 10,048,576) creates the record, with uploaded: false, and returns a short-lived upload policy in meta.upload. Then send a multipart/form-data POST to meta.upload.url, including every key in meta.upload.fields as a form field exactly as returned, and the file last under the name file. Don't send your Kustomer Authorization header to the upload URL. Upload straight away, because the policy expires.
Key fields
| Field | Meaning |
|---|---|
name |
The file name. Names with executable or script extensions, such as .exe, .bat, .msi or .ps1, are rejected. |
contentType, contentLength |
The MIME type and size in bytes you declared. Upload a file of exactly that size. |
uploaded |
Whether the file has been uploaded. |
redacted |
Set to true to redact the file. A redacted file has no download URL. |
Which endpoint to use
| To | Call |
|---|---|
| Create a media record and get an upload policy | POST /v1/media |
| Read one or several media records, or download the file | GET /v1/media/{id} |
| Rename or redact a file | PUT /v1/media/{id} |
GET /v1/media/{id} accepts a comma-separated list of IDs to read several records at once. Add redirect=true to get a 302 redirect to the file's URL. Unlike attachment URLs, a media file's URL doesn't expire, so you can use it as an image src in your content. A redacted file has no URL, so the request returns the record without redirecting. PUT changes only name and redacted, and returns 404 for an ID that doesn't exist. Pass the rev you last read to make sure you aren't overwriting someone else's change.
Path parameters
Resource ID.
"60254e3ec413ae00571e3c96"Query parameters
Expected resource revision for optimistic concurrency checks.
1Request body
application/jsonrequiredResponses
OK