Data models (DTOs)
Canonical request and response shapes returned by the API.
Keep these DTOs handy when typing clients or building SDKs. They reflect the canonical SyncPostly request and response shapes.
Media
type MediaDto = {
id: string;
mime_type: 'image/png' | 'image/jpeg' | 'video/mp4' | 'video/quicktime';
type: 'image' | 'video';
post_id: string | null;
status: 'pending' | 'uploaded';
object: {
isDeleted: boolean;
url: string | null;
size_bytes: number;
name: string | null;
};
};
type CreateUploadUrlResponse = {
media_id: string;
upload_url: string; // PUT /api/v1/media/upload/{id}
name: string;
};
type UploadResponse = {
success: true;
media_id: string;
url: string;
};
type DeleteResponse = { success: true };Posts
type PostStatus = 'draft' | 'processing' | 'scheduled' | 'posted' | 'failed';
type PostDto = {
id: string;
caption: string;
social_accounts: string[];
scheduled_at: string | null;
is_draft: boolean;
status: PostStatus;
media: string[]; // only uploaded media IDs
platform_configurations: Record<string, unknown> | null;
account_configurations: Record<string, unknown> | null;
processing_enabled: boolean;
};
type CreatePostPayload = {
caption: string;
social_accounts: string[];
scheduled_at?: string | null;
is_draft?: boolean | null;
media?: string[];
media_urls?: string[];
platform_configurations?: Record<string, unknown> | null;
account_configurations?: Record<string, unknown> | null;
processing_enabled?: boolean | null;
};
// PATCH accepts Partial<CreatePostPayload>Social accounts
type SocialAccountDto = {
id: string;
platform:
| 'twitter-x'
| 'instagram'
| 'linkedin'
| 'facebook-page'
| 'tiktok'
| 'youtube'
| 'bluesky'
| 'threads'
| 'pinterest';
username: string;
display_name: string | null;
};Post results
type PostResultDto = {
id: string;
post_id: string;
success: boolean;
social_account_id: string | null;
platform_data: {
id: string | null;
url: string | null;
username: string | null;
};
error: {
code: string;
message: string;
context?: Record<string, unknown> | null;
} | null;
};Pagination envelope
interface Paginated<T> {
data: T[];
meta: { offset: number; limit: number; total: number };
}