Image Upload
XenonFlare provides a unified API for uploading and cross-platform publishing of images to Instagram, LinkedIn, TikTok, and Pinterest.
Endpoint
POST /api/v1/media/images
If you are using chunked uploads, the POST /api/v1/media/images endpoint is used to finalize the upload by providing the fileId instead of the file itself.
Headers
X-API-Key: Your API keyAuthorization:Bearer <API_KEY>(Alternative toX-API-Key)Content-Type:multipart/form-data
Request Body (multipart/form-data)
| Field | Type | Required | Description |
|---|---|---|---|
file | File | Yes* | The image file to upload. |
fileId | string | Yes* | The unique ID from a chunked upload. Required if file is missing. |
title | string | No | Internal title for the image. |
description | string | No | Internal description for the image. |
platforms | string[] | Yes | JSON array of platforms (e.g., ["instagram", "tiktok"]). |
scheduledAt | string | No | ISO 8601 date string for scheduled publishing. |
isDraft | boolean | No | If true, the image will be saved as a draft and not scheduled. |
* Either file or fileId must be provided.
Configuration
Platform-specific settings must be provided as Nested Objects. Use the platform name as the key (e.g., instagram, tiktok) and provide a JSON string containing the parameters.
Instagram Specific Fields
| Flat Key | Nested Key | Type | Description |
|---|---|---|---|
instagramCaption | caption | string | Caption for the Instagram post |
instagramAutoPublish | autoPublish | boolean | Whether to auto-publish the post |
selectedInstagramAccounts | accounts | array | List of Instagram account IDs |
Note: For nested config, send a JSON string in the field instagram.
TikTok Specific Fields
| Flat Key | Nested Key | Type | Description |
|---|---|---|---|
tiktokCaption | caption | string | Caption for the TikTok |
tiktokPrivacy | privacy | select | Privacy status Options: PUBLIC_TO_EVERYONE, MUTUAL_FOLLOW_FRIENDS, SELF_ONLY |
tiktokAutoPublish | autoPublish | boolean | Whether to auto-publish the TikTok |
selectedTiktokAccounts | accounts | array | List of TikTok account IDs |
tiktokDisableComment | disableComment | boolean | Disable comments |
tiktokDisableDuet | disableDuet | boolean | Disable duet |
tiktokDisableStitch | disableStitch | boolean | Disable stitch |
Note: For nested config, send a JSON string in the field tiktok.
LinkedIn Specific Fields
| Flat Key | Nested Key | Type | Description |
|---|---|---|---|
linkedinComment | comment | string | Comment for the LinkedIn post |
linkedinAutoPublish | autoPublish | boolean | Whether to auto-publish the post |
selectedLinkedinAccounts | accounts | array | List of LinkedIn account IDs |
Note: For nested config, send a JSON string in the field linkedin.
Pinterest Specific Fields
| Flat Key | Nested Key | Type | Description |
|---|---|---|---|
pinterestTitle | title | string | Title for the Pinterest pin |
pinterestDescription | description | string | Description for the Pinterest pin |
pinterestAutoPublish | autoPublish | boolean | Whether to auto-publish the pin |
selectedPinterestAccounts | accounts | array | List 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/api/v1/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"
}
]
}