Skip to main content

Image Upload

XenonFlare provides dedicated endpoints for uploading videos and images. Choosing the correct endpoint ensures optimized processing and validation for your media type. For deleting multiple images, see Bulk Operations.

Endpoint

POST /media/images

Chunked Uploads

If you are using chunked uploads, the POST /media/images endpoint is used to finalize the upload by providing the fileId instead of the file itself.

Headers

  • X-API-Key: Your API key
  • Authorization: Bearer <API_KEY> (Alternative to X-API-Key)
  • Content-Type: multipart/form-data

Request Body (multipart/form-data)

FieldTypeRequiredDescription
fileFileYes*The image file to upload.
fileIdstringYes*The unique ID from a chunked upload. Required if file is missing.
titlestringNoInternal title for the image.
descriptionstringNoInternal description for the image.
platformsstring[]YesJSON array of platforms (e.g., ["instagram", "tiktok"]).
scheduledAtstringNoISO 8601 date string for scheduled publishing.

* Either file or fileId must be provided.

Configuration

Platform-specific settings must be provided as Nested JSON Objects. Use the platform name as the key (e.g., instagram, tiktok) and provide a JSON string containing the parameters for that platform.

How to Select Accounts

For each platform, you can specify which connected accounts to use by adding an accounts array to the nested JSON object.

  • Instagram, TikTok, LinkedIn, Pinterest: Use accounts (array of platform-specific account IDs).
  • Profiles: Use profileId (string) to target a pre-defined group of accounts.

You can get these IDs from the Channels API or the Posting Profiles API.

Instagram Specific Fields

Nested KeyTypeDescription
captionstringCaption for the Instagram post
autoPublishbooleanWhether to auto-publish the post
accountsarrayList of Instagram account IDs

Note: For nested config, send a JSON string in the field instagram.

TikTok Specific Fields

Nested KeyTypeDescription
captionstringCaption for the TikTok
privacyselectPrivacy status
Options: PUBLIC_TO_EVERYONE, MUTUAL_FOLLOW_FRIENDS, SELF_ONLY
autoPublishbooleanWhether to auto-publish the TikTok
accountsarrayList of TikTok account IDs
disableCommentbooleanDisable comments
disableDuetbooleanDisable duet
disableStitchbooleanDisable stitch

Note: For nested config, send a JSON string in the field tiktok.

LinkedIn Specific Fields

Nested KeyTypeDescription
commentstringComment for the LinkedIn post
autoPublishbooleanWhether to auto-publish the post
accountsarrayList of LinkedIn account IDs

Note: For nested config, send a JSON string in the field linkedin.

Pinterest Specific Fields

Nested KeyTypeDescription
titlestringTitle for the Pinterest pin
descriptionstringDescription for the Pinterest pin
autoPublishbooleanWhether to auto-publish the pin
accountsarrayList of Pinterest account IDs

Note: For nested config, send a JSON string in the field pinterest.

Example Request

curl -X POST https://api.xenonflare.com/media/images \
-H "X-API-Key: YOUR_API_KEY" \
-F "file=@/path/to/image.jpg" \
-F "platforms=[\"instagram\", \"pinterest\"]" \
-F "instagram={\"caption\": \"Stunning view! #nature\", \"autoPublish\": true, \"accounts\": [\"YOUR_INSTAGRAM_BUSINESS_ID\"]}" \
-F "pinterest={\"title\": \"Nature Photography\", \"description\": \"Beautiful landscape photo.\", \"autoPublish\": true, \"accounts\": [\"YOUR_PINTEREST_ID\"]}"

Response

{
"success": true,
"message": "Upload successful",
"data": [
{
"id": "65cbde...",
"title": "Untitled Image",
"status": "scheduled",
"platforms": ["instagram", "pinterest"],
"createdAt": "2024-02-13T10:00:00.000Z"
}
]
}