Media
Import media
Copies an image or video from a public https URL into your team’s media library. Attach it to posts by putting its id in mediaIds.
Importing a URL that’s already in your library returns that file instead of a copy.
POST
/
media
Import media
curl --request POST \
--url https://api.postploy.com/public/v1/media \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://example.com/spring-blend.jpg",
"fileName": "spring-blend.jpg"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: 'https://example.com/spring-blend.jpg', fileName: 'spring-blend.jpg'})
};
fetch('https://api.postploy.com/public/v1/media', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.postploy.com/public/v1/media"
payload = {
"url": "https://example.com/spring-blend.jpg",
"fileName": "spring-blend.jpg"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"data": {
"id": "7a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
"type": "image",
"fileName": "spring-blend.jpg",
"url": "https://cdn.example.com/spring-blend.jpg",
"thumbnailUrl": "https://cdn.example.com/spring-blend.jpg",
"mimeType": "image/jpeg",
"duration": null,
"altText": null
}
}{
"statusCode": 400,
"message": "Scheduled date and time must be in the future",
"errors": [
{
"message": "Scheduled date and time must be in the future",
"path": [
"posts",
0,
"scheduledAt"
],
"cause": "custom"
}
],
"timestamp": "2030-01-10T12:00:00.000Z",
"route": "/public/v1/posts"
}{
"statusCode": 401,
"message": "Invalid API key",
"errors": null,
"timestamp": "2030-01-10T12:00:00.000Z",
"route": "/public/v1/accounts"
}{
"statusCode": 123,
"message": "<string>",
"errors": [
{
"message": "<string>",
"path": [
"<string>"
],
"cause": "<string>",
"code": "<string>",
"platform": "<string>"
}
],
"timestamp": "2023-11-07T05:31:56Z",
"route": "<string>"
}{
"statusCode": 123,
"message": "<string>",
"errors": [
{
"message": "<string>",
"path": [
"<string>"
],
"cause": "<string>",
"code": "<string>",
"platform": "<string>"
}
],
"timestamp": "2023-11-07T05:31:56Z",
"route": "<string>"
}Authorizations
Body
application/json
⌘I
Import media
curl --request POST \
--url https://api.postploy.com/public/v1/media \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://example.com/spring-blend.jpg",
"fileName": "spring-blend.jpg"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: 'https://example.com/spring-blend.jpg', fileName: 'spring-blend.jpg'})
};
fetch('https://api.postploy.com/public/v1/media', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.postploy.com/public/v1/media"
payload = {
"url": "https://example.com/spring-blend.jpg",
"fileName": "spring-blend.jpg"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"data": {
"id": "7a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
"type": "image",
"fileName": "spring-blend.jpg",
"url": "https://cdn.example.com/spring-blend.jpg",
"thumbnailUrl": "https://cdn.example.com/spring-blend.jpg",
"mimeType": "image/jpeg",
"duration": null,
"altText": null
}
}{
"statusCode": 400,
"message": "Scheduled date and time must be in the future",
"errors": [
{
"message": "Scheduled date and time must be in the future",
"path": [
"posts",
0,
"scheduledAt"
],
"cause": "custom"
}
],
"timestamp": "2030-01-10T12:00:00.000Z",
"route": "/public/v1/posts"
}{
"statusCode": 401,
"message": "Invalid API key",
"errors": null,
"timestamp": "2030-01-10T12:00:00.000Z",
"route": "/public/v1/accounts"
}{
"statusCode": 123,
"message": "<string>",
"errors": [
{
"message": "<string>",
"path": [
"<string>"
],
"cause": "<string>",
"code": "<string>",
"platform": "<string>"
}
],
"timestamp": "2023-11-07T05:31:56Z",
"route": "<string>"
}{
"statusCode": 123,
"message": "<string>",
"errors": [
{
"message": "<string>",
"path": [
"<string>"
],
"cause": "<string>",
"code": "<string>",
"platform": "<string>"
}
],
"timestamp": "2023-11-07T05:31:56Z",
"route": "<string>"
}