Upload an image (jpg, png, gif, webp, up to 20 MB) to your Media Library and get back a public URL to use in other APIs, e.g. LinkedIn media_urls
Uploads an image to your Media Library and returns a public URL. The file is stored in your account's Media Library (it also appears in Dashboard → Media Library) and the URL can be passed straight to other APIs — for example media_urls on the LinkedIn publish endpoint.
Cost: 1 credit per successful upload. Failed uploads are not charged.
The Media Library is available to accounts that have added credits at least once (same rule as the dashboard). Other accounts get 403.
POST https://eranol.com/api/v1/media/upload
Headers: x-api-key: <your key>. Send the body as multipart/form-data — do not set Content-Type manually if your HTTP client builds the multipart boundary for you.
| Field | Type | Required | Notes |
|---|---|---|---|
file | file | Yes | The image. Extensions: jpg, jpeg, png, gif, webp. Max 20 MB |
The file type is decided by the file name's extension, so name the file correctly (photo.png, not photo).
curl -X POST https://eranol.com/api/v1/media/upload \
-H "x-api-key: YOUR_API_KEY" \
-F "file=@./photo.jpg"
const form = new FormData()
form.append('file', fileInput.files[0])
const res = await fetch('https://eranol.com/api/v1/media/upload', {
method: 'POST',
headers: { 'x-api-key': 'YOUR_API_KEY' },
body: form,
})
const { url } = await res.json()
{
"success": true,
"id": "a1b2c3d4-...",
"url": "https://.../media-library/<user_id>/<uuid>-photo.jpg",
"file_name": "photo.jpg",
"content_type": "image/jpeg",
"size_bytes": 482113
}
Files uploaded here are in your Media Library, so the returned url is accepted by the LinkedIn publish endpoint:
{
"text": "Our new dashboard is live.",
"media_urls": ["https://.../media-library/<user_id>/<uuid>-photo.jpg"]
}
LinkedIn accepts JPG, PNG and GIF images (up to 9 per post, ideally under 5 MB each). webp can be uploaded and stored but is not accepted by LinkedIn — convert it with the Convert to JPG API first.
| Status | Meaning |
|---|---|
400 | No file field, empty file, or unsupported extension |
401 | Missing or invalid API key |
402 | Insufficient credits (1 credit required) |
403 | The Media Library isn't unlocked for this account yet — add credits first |
413 | Image is larger than 20 MB |
500 | Storage error — try again or contact support |