Upload Header Media
POST
/platform/v1/templates/header-media
const url = 'https://example.com/platform/v1/templates/header-media';const form = new FormData();form.append('file', 'example');form.append('mime_type', 'example');
const options = {method: 'POST'};
options.body = form;
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/templates/header-media \ --header 'Content-Type: multipart/form-data' \ --form file=example \ --form mime_type=exampleResumable upload of a header media binary → returns header_handle.
Two body shapes (mutually exclusive — branch on Content-Type):
multipart/form-data— fieldsfile+mime_type.application/json— body{mime_type, source_url}(SSRF-guarded fetch).
The returned header_handle goes into components[].example .header_handle = [<handle>] of a subsequent POST /templates (or
PATCH).
Errors: * unsupported MIME / oversize / SSRF blocked → 422 or 413. * APP credentials unset in env → 503. * Meta network / non-2xx → 502.
Request Body
Section titled “Request Body ”Responses
Section titled “ Responses ”Successful Response
Media type application/json
PlatformTemplateHeaderMediaUrlResponse
Response — returns ONLY the Meta-side header_handle. NEVER echoes
the APP token, the URL, or any internal state.
object
header_handle
required
Header Handle
string
Example generated
{ "header_handle": "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" } ]}