Replace a media file
curl --request PUT \
--url https://beta.creatorcore.co/api/v2/media/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--header 'X-CreatorCore-Organization-Id: <api-key>' \
--form file=@example-fileconst form = new FormData();
form.append('file', '<string>');
const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'X-CreatorCore-Organization-Id': '<api-key>'}
};
options.body = form;
fetch('https://beta.creatorcore.co/api/v2/media/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://beta.creatorcore.co/api/v2/media/{id}"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {
"Authorization": "Bearer <token>",
"X-CreatorCore-Organization-Id": "<api-key>"
}
response = requests.put(url, files=files, headers=headers)
print(response.text){
"success": true,
"media": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"purpose": "branding_logo",
"visibility": "org",
"url": "<string>",
"publicUrl": "<string>",
"fallbackUrl": "<string>",
"contentType": "<string>",
"sizeBytes": 123,
"originalFilename": "<string>",
"sha256": "<string>",
"cacheControl": "<string>",
"context": {},
"createdAt": "<string>",
"updatedAt": "<string>"
}
}{
"success": false,
"error": "<string>",
"code": "file_too_large",
"maxBytes": 4000000,
"directUpload": "/api/v2/media/uploads"
}Media
Replace a media file
Replaces the stored file for an existing media asset via multipart upload. The asset keeps its id and URL, and metadata is unchanged. For files up to 4MB (4,000,000 bytes); a bigger file gets 413 file_too_large. Cached copies of the old file can keep being served for up to the edge cache window (about an hour).
PUT
/
api
/
v2
/
media
/
{id}
Replace a media file
curl --request PUT \
--url https://beta.creatorcore.co/api/v2/media/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--header 'X-CreatorCore-Organization-Id: <api-key>' \
--form file=@example-fileconst form = new FormData();
form.append('file', '<string>');
const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'X-CreatorCore-Organization-Id': '<api-key>'}
};
options.body = form;
fetch('https://beta.creatorcore.co/api/v2/media/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://beta.creatorcore.co/api/v2/media/{id}"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {
"Authorization": "Bearer <token>",
"X-CreatorCore-Organization-Id": "<api-key>"
}
response = requests.put(url, files=files, headers=headers)
print(response.text){
"success": true,
"media": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"purpose": "branding_logo",
"visibility": "org",
"url": "<string>",
"publicUrl": "<string>",
"fallbackUrl": "<string>",
"contentType": "<string>",
"sizeBytes": 123,
"originalFilename": "<string>",
"sha256": "<string>",
"cacheControl": "<string>",
"context": {},
"createdAt": "<string>",
"updatedAt": "<string>"
}
}{
"success": false,
"error": "<string>",
"code": "file_too_large",
"maxBytes": 4000000,
"directUpload": "/api/v2/media/uploads"
}Authorizations
Was this page helpful?