Add a cover, screenshot or clip, and get where to upload it
curl --request POST \
--url https://patch.gg/api/v1/projects/{owner}/{slug}/media \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"content_type": "image/png",
"sha256": "<string>",
"size": 123,
"alt": "<string>",
"width": 8192,
"height": 8192
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
content_type: 'image/png',
sha256: '<string>',
size: 123,
alt: '<string>',
width: 8192,
height: 8192
})
};
fetch('https://patch.gg/api/v1/projects/{owner}/{slug}/media', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://patch.gg/api/v1/projects/{owner}/{slug}/media"
payload = {
"content_type": "image/png",
"sha256": "<string>",
"size": 123,
"alt": "<string>",
"width": 8192,
"height": 8192
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"media": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kind": "cover",
"status": "pending",
"url": "<string>",
"content_type": "<string>",
"sha256": "<string>",
"size": 123,
"width": 123,
"height": 123,
"alt": "<string>",
"position": 123,
"created_at": "<string>"
},
"upload": {
"method": "PUT",
"url": "<string>",
"headers": {},
"expires_at": "<string>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}Media
Add a cover, screenshot or clip, and get where to upload it
Send its kind, type, SHA-256 and size. Upload the bytes to the returned URL with exactly its headers, then complete it. A cover replaces the project’s cover once it’s ready. Images (PNG, JPEG, WebP, GIF) are at most 10 MB; clips (MP4, WebM) at most 200 MB.
POST
/
projects
/
{owner}
/
{slug}
/
media
Add a cover, screenshot or clip, and get where to upload it
curl --request POST \
--url https://patch.gg/api/v1/projects/{owner}/{slug}/media \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"content_type": "image/png",
"sha256": "<string>",
"size": 123,
"alt": "<string>",
"width": 8192,
"height": 8192
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
content_type: 'image/png',
sha256: '<string>',
size: 123,
alt: '<string>',
width: 8192,
height: 8192
})
};
fetch('https://patch.gg/api/v1/projects/{owner}/{slug}/media', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://patch.gg/api/v1/projects/{owner}/{slug}/media"
payload = {
"content_type": "image/png",
"sha256": "<string>",
"size": 123,
"alt": "<string>",
"width": 8192,
"height": 8192
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"media": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kind": "cover",
"status": "pending",
"url": "<string>",
"content_type": "<string>",
"sha256": "<string>",
"size": 123,
"width": 123,
"height": 123,
"alt": "<string>",
"position": 123,
"created_at": "<string>"
},
"upload": {
"method": "PUT",
"url": "<string>",
"headers": {},
"expires_at": "<string>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}Authorizations
An API key (pch_...) or the token from pch login.
Body
application/json