Upload and process media
Create an upload, send bytes directly, complete the asset, and wait for media readiness.
Request an upload URL with file metadata, upload the file using the returned headers, then call the media complete endpoint. Reference the media ID in posts only after processing has produced a ready asset or a clear failure result.
What this means in practice
Request an upload URL with file metadata, upload the file using the returned headers, then call the media complete endpoint. Reference the media ID in posts only after processing has produced a ready asset or a clear failure result.
Use the documented brand and account boundaries consistently across the scheduler, REST API, SDK, MCP tools, SSE consumers, and webhooks. That makes the same social operation explainable to an operator and reproducible by an integration.
Implementation checklist
Validate the user's file selection before requesting an upload URL.
Send file_name, kind, content_type, size_bytes, and optional source_url.
Upload bytes to upload_url without routing large files through your application server.
Call /complete and observe processing state for thumbnails, variants, or transcoding.
Use the media library resource until the user deletes it.
Example request
This example uses a server-side API key and an explicit brand selection. Replace placeholder values and keep credentials out of browser bundles, client logs, and source control.
curl --request POST \
--url 'https://postapi.app9.co/v1/media/create-upload-url' \
--header 'Authorization: Bearer APP9_POST_API_KEY' \
--header 'X-App9-Post-Brand: BRAND_ID' \
--header 'Content-Type: application/json' \
--data '{
"file_name": "launch-video.mp4",
"kind": "video",
"content_type": "video/mp4",
"size_bytes": 18432000
}'Operational details
Incomplete uploads are temporary; completed media remains in the brand library until deletion.
Server validation checks file signatures in addition to the declared MIME type.
Provider validation still runs when the media is attached to specific target accounts.
Common mistakes to avoid
- Do not trust a filename extension as proof of media type.
- Do not attach an uploading or failed asset to a post and assume dispatch will wait indefinitely.
- Do not expose storage object keys or private credentials in the client.