Upload Media
POST
/platform/v1/media
const url = 'https://example.com/platform/v1/media';const options = {method: 'POST', headers: {'X-API-Key': 'example'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/platform/v1/media \ --header 'X-API-Key: example'Upload a media binary to Meta and return its media_id.
Two content types are accepted on the same path:
multipart/form-data— form fieldschannel_id+file.application/json—{channel_id, url, mime_type}(url-source; SSRF-guarded BEFORE any fetch).
Parameters
Section titled “ Parameters ”Header Parameters
Section titled “Header Parameters ” X-API-Key
required
X-Api-Key
string
Responses
Section titled “ Responses ”Successful Response
Media type application/json
PlatformMediaUploadResponse
Response for POST /platform/v1/media (both variants).
object
channel_id
required
Channel Id
integer
media_id
required
Media Id
string
Example generated
{ "channel_id": 1, "media_id": "example"}Validation Error
Media type application/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationErrorobject
ctx
Context
object
input
Input
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
Example generated
{ "detail": [ { "ctx": {}, "input": "example", "loc": [ "example" ], "msg": "example", "type": "example" } ]}