Publishing API Documentation

Base URL: /api/publish

Authorization

All API endpoints require authentication using a Bearer token. Include your API token in the Authorization header of every request.

Header Format

Authorization: Bearer YOUR_API_TOKEN

Example Request

curl -X POST https://fedica.com/api/publish/post \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "Id": "post-123",
    "Posts": [...]
  }'

Important: Keep your API token secure and never expose it in client-side code or public repositories. Requests without a valid token will receive a 401 Unauthorized response.

POST

/post

Schedule a post to be published on one or multiple social media platforms.

Request Body

{
  "Id": "string",
  "PipelineId": 123,
  "DateTime": "2023-10-01T12:00:00Z",
  "Posts": [
    {
      "Accounts": [
        {
          "Platform": "Twitter",
          "AccountId": "account-123"
        }
      ],
      "Messages": ["Your post content here"],
      "MediaId": ["media-id-1", "media-id-2"]
    }
  ]
}

Request Fields

Id

Type: string

Used for editing existing posts. Do not provide when creating new posts.

PipelineId

Type: integer (optional)

The ID of a pre-configured publishing pipeline to use for this post. When not provided, the post can be either published immediately or published at specific date.

DateTime

Type: string (optional)

The scheduled date and time when the post should be published. Must be in ISO 8601 format with timezone information. If not provided, the post will be published immediately or according to the pipeline's schedule.

Posts *

Type: array of Post objects

Array of post configurations. Each post can target different accounts and contain different content. If the same post goes to multiple accounts, use only one post object but if you wish to customize the post for different platforms, use the different post objects one per platform

Accounts *

Type: array of Account objects

List of social media accounts where this post will be published.

Platform *

Type: string

Platform name (e.g., "Twitter", "LinkedIn", "Instagram"). Must match one of the supported platforms returned in the /accounts endpoint.

AccountId *

Type: string

UserName for the specific account on the platform, same as the one returned in /accounts.

Messages *

Type: array of strings

Array of message content strings. Multiple messages can be provided for platforms that support threads.

MediaId

Type: array of strings (default: empty array)

Array of media file IDs obtained from the media upload endpoints. Attach images, videos, or other media to your post.

Response

{
  "Success": true,
  "Error": null,
  "Id": "12345"
}

Success: Boolean indicating if the operation was successful

Error: Error message if operation failed, null otherwise

Id: Content ID of the scheduled post

GET

/pipelines

Retrieve a list of available publishing pipelines.

Request

No request body required.

Response

{
  "Success": true,
  "Error": null,
  "Pipelines": [
    {
      "Id": "pipeline-1",
      "Name": "Marketing Pipeline"
    }
  ]
}

Pipelines: Array of pipeline objects with Id and Name properties

GET

/accounts

Retrieve a list of connected social media accounts.

Request

No request body required.

Response

{
  "Success": true,
  "Error": null,
  "Accounts": [
    {
      "Platform": "Twitter",
      "AccountId": "account-123"
    }
  ]
}

Accounts: Array of connected account objects with Platform and AccountId properties

POST

/media/init

Initialize a media upload session. Call this endpoint before uploading media chunks.

Request

No request body required.

Response

{
  "Success": true,
  "Error": null,
  "Id": "file-abc123"
}

Id: File ID to use for subsequent upload and finalize operations

POST

/media/upload

Upload a chunk of media data. For large files, split the file into chunks and call this endpoint multiple times.

Request Body (Form Data)


Content-Type: multipart/form-data

chunkIndex: 0
fileId: file_abc123xyz
file: [binary data]
                                                     
Alternatively, this endpoint accepts json object with the file data in base64:

Request Body (Json)

{
  "chunkIndex": 0,
  "fileId": "file-abc123",
  "file": "base64-encoded-data"
}

Request Fields

chunkIndex *

Type: integer

Zero-based index of the current chunk. Start with 0 for the first chunk and increment for each subsequent chunk.

fileId *

Type: string

File ID obtained from the /media/init endpoint. This associates the chunk with the upload session.

file *

Type: string

Base64-encoded binary data of the file chunk.

Response

{
  "Success": true,
  "Error": null
}
POST

/media/finalize

Complete the media upload process and provide metadata about the uploaded file.

Request Body

{
  "fileId": "file-abc123",
  "metadata": {
    "altText": "Description for accessibility",
    "mimeType": "image/jpeg",
    "fileName": "photo.jpg",
    "size": 1048576,
    "width": 1920,
    "height": 1080,
    "aspectRatio": 1.777,
    "duration": 30.5,
    "frameRate": 30.0,
    "bitRate": 5000000.0
  }
}

Request Fields

fileId *

Type: string

File ID from the initialization step.

metadata *

Type: MediaMetaData object

Comprehensive metadata about the uploaded media file.

altText *

Type: string

Alternative text description for accessibility. Describes the content of images or videos for screen readers.

mimeType *

Type: string

MIME type of the file (e.g., "image/jpeg", "video/mp4", "image/png").

fileName *

Type: string

Original filename of the uploaded media.

size *

Type: long (integer)

File size in bytes.

width

Type: integer (optional)

Width in pixels (for images and videos).

height

Type: integer (optional)

Height in pixels (for images and videos).

aspectRatio

Type: double (optional)

Aspect ratio calculated as width/height (e.g., 1.777 for 16:9).

duration

Type: double (optional)

Duration in seconds (for video and audio files).

frameRate

Type: double (optional)

Video frame rate in frames per second (e.g., 30.0, 60.0).

bitRate

Type: double (optional)

Bitrate in bits per second (for video and audio files).

Response

{
  "Success": true,
  "Error": null
}

Supported Platforms

1 - Twitter
2 - LinkedIn
3 - Instagram
4 - Facebook
5 - Pinterest
6 - Tiktok
7 - Mastodon
8 - BlueSky
9 - MetaThreads
10 - Youtube
11 - Pixelfed
12 - Tumblr

Error Handling

All endpoints return a consistent error response format:

{
  "Success": false,
  "Error": "Error message describing what went wrong"
}

Common HTTP Status Codes:

  • 200 OK: Request successful
  • 400 Bad Request: Invalid request data
  • 500 Internal Server Error: Server error occurred

Complete Upload Workflow

1

Initialize Upload

Call POST /media/init to get a file ID

2

Upload Chunks

Call POST /media/upload for each chunk of your file

3

Finalize Upload

Call POST /media/finalize with metadata

4

Schedule Post

Use the media ID from step 3 in POST /post to publish