Endpoint
POST https://api.ugc.inc/media/update-tag
Overview
Update tags on one or more media items. Works for both user-uploaded media and social audio. Supports bulk updates with different tags for each item in a single request.Request Body
Bulk Update (Recommended)
array
required
Single Update (Deprecated)
string
The ID of the media item to update (deprecated - use
updates array instead)string
The new tag value (deprecated - use
updates array instead)Response
array
curl -X POST https://api.ugc.inc/media/update-tag \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"updates": [
{ "id": "media_abc123", "tag": "featured" },
{ "id": "media_def456", "tag": "archive" },
{ "id": "media_ghi789", "tag": "featured/videos" }
]
}'
import requests
response = requests.post(
'https://api.ugc.inc/media/update-tag',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'updates': [
{'id': 'media_abc123', 'tag': 'featured'},
{'id': 'media_def456', 'tag': 'archive'},
{'id': 'media_ghi789', 'tag': 'featured/videos'}
]
}
)
data = response.json()
for result in data['data']['results']:
if result['success']:
print(f"Updated {result['id']} to: {result['media']['tag']}")
else:
print(f"Failed to update {result['id']}: {result['error']}")
const response = await fetch('https://api.ugc.inc/media/update-tag', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
updates: [
{ id: 'media_abc123', tag: 'featured' },
{ id: 'media_def456', tag: 'archive' },
{ id: 'media_ghi789', tag: 'featured/videos' }
]
})
});
const data = await response.json();
for (const result of data.data.results) {
if (result.success) {
console.log(`Updated ${result.id} to: ${result.media.tag}`);
} else {
console.log(`Failed to update ${result.id}: ${result.error}`);
}
}
import { UGCClient } from 'ugcinc';
const client = new UGCClient({
apiKey: 'YOUR_API_KEY'
});
const response = await client.media.updateTags({
updates: [
{ id: 'media_abc123', tag: 'featured' },
{ id: 'media_def456', tag: 'archive' },
{ id: 'media_ghi789', tag: 'featured/videos' }
]
});
if (response.ok) {
for (const result of response.data.results) {
if (result.success) {
console.log(`Updated ${result.id} to: ${result.media?.tag}`);
}
}
}
{
"ok": true,
"code": 200,
"data": {
"results": [
{
"id": "media_abc123",
"success": true,
"media": {
"id": "media_abc123",
"org_id": "org_xyz789",
"name": "video.mp4",
"tag": "featured",
"type": "video",
"url": "https://api.ugc.inc/media/file/media_abc123",
"created_at": "2024-01-15T10:30:00.000Z",
"media_type": "user_media"
}
},
{
"id": "media_def456",
"success": true,
"media": {
"id": "media_def456",
"org_id": "org_xyz789",
"name": "image.jpg",
"tag": "archive",
"type": "image",
"url": "https://api.ugc.inc/media/file/media_def456",
"created_at": "2024-01-14T09:00:00.000Z",
"media_type": "user_media"
}
}
]
},
"message": "Successfully updated 2 media item(s)"
}
{
"ok": true,
"code": 207,
"data": {
"results": [
{
"id": "media_abc123",
"success": true,
"media": {
"id": "media_abc123",
"tag": "featured",
"..."
}
},
{
"id": "media_invalid",
"success": false,
"error": "Media not found"
}
]
},
"message": "Partially updated: 1/2 succeeded"
}
{
"ok": false,
"code": 400,
"data": {
"results": [
{
"id": "media_invalid1",
"success": false,
"error": "Media not found"
},
{
"id": "media_invalid2",
"success": false,
"error": "Media not found"
}
]
},
"message": "All updates failed"
}
