{
    "openapi": "3.1.0",
    "info": {
        "title": "OmniMediaApi",
        "version": "1.0.0",
        "description": "Download photos and videos from public Instagram, TikTok, Threads, Facebook (videos), X, Pinterest and Douyin posts. Send a post link, get direct CDN links. Send your own User-Agent; ones containing \"python\" are blocked."
    },
    "servers": [
        {
            "url": "https://omnimediaapi.com"
        }
    ],
    "security": [
        {
            "ApiKey": []
        }
    ],
    "paths": {
        "/v1/download": {
            "post": {
                "operationId": "download",
                "summary": "Get the photos and videos of a post",
                "description": "Counts one download only when media is returned. The same link with the same key within 10 minutes is not counted again.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "url"
                                ],
                                "properties": {
                                    "url": {
                                        "type": "string",
                                        "format": "uri",
                                        "example": "https://www.instagram.com/p/XXXXXXXXXXX/"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Media found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/DownloadResult"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "VALIDATION_ERROR: missing or unsupported link",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "UNAUTHORIZED: missing, wrong or revoked key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "ACCOUNT_SUSPENDED",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "MEDIA_UNAVAILABLE: deleted, private or region-blocked post. Do not retry.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "424": {
                        "description": "PROVIDER_UNAVAILABLE: retry once after 30-60 s",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "RATE_LIMITED or QUOTA_EXCEEDED: wait Retry-After seconds",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "SERVICE_UNAVAILABLE: retry after Retry-After seconds",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/me": {
            "get": {
                "operationId": "account",
                "summary": "Plan and downloads left. Free to call.",
                "responses": {
                    "200": {
                        "description": "Account usage",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Account"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "ApiKey": {
                "type": "apiKey",
                "in": "header",
                "name": "X-API-Key"
            }
        },
        "schemas": {
            "Media": {
                "type": "object",
                "properties": {
                    "type": {
                        "type": "string",
                        "enum": [
                            "image",
                            "video",
                            "audio"
                        ]
                    },
                    "url": {
                        "type": "string",
                        "format": "uri",
                        "description": "Direct CDN link. Expires within hours."
                    },
                    "quality": {
                        "type": "string"
                    },
                    "width": {
                        "type": "integer"
                    },
                    "height": {
                        "type": "integer"
                    },
                    "formats": {
                        "type": "array",
                        "description": "Present instead of url on some X items.",
                        "items": {
                            "type": "object"
                        }
                    }
                }
            },
            "DownloadResult": {
                "type": "object",
                "properties": {
                    "success": {
                        "type": "boolean",
                        "const": true
                    },
                    "data": {
                        "type": "object",
                        "properties": {
                            "platform": {
                                "type": "string",
                                "enum": [
                                    "instagram",
                                    "tiktok",
                                    "threads",
                                    "facebook",
                                    "x",
                                    "pinterest",
                                    "douyin"
                                ]
                            },
                            "type": {
                                "type": "string"
                            },
                            "title": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "thumbnail": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "description": "Cover image, not one of the post's own photos."
                            },
                            "media": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/Media"
                                }
                            }
                        }
                    },
                    "meta": {
                        "type": "object",
                        "properties": {
                            "request_id": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "latency_ms": {
                                "type": "integer"
                            },
                            "charged": {
                                "type": "boolean"
                            },
                            "remaining": {
                                "type": "integer"
                            }
                        }
                    }
                }
            },
            "Account": {
                "type": "object",
                "properties": {
                    "success": {
                        "type": "boolean"
                    },
                    "data": {
                        "type": "object",
                        "properties": {
                            "plan": {
                                "type": "string"
                            },
                            "plan_expires_at": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            },
                            "monthly_limit": {
                                "type": "integer"
                            },
                            "used_this_month": {
                                "type": "integer"
                            },
                            "credits": {
                                "type": "integer"
                            },
                            "remaining": {
                                "type": "integer"
                            },
                            "requests_per_minute": {
                                "type": "integer"
                            },
                            "resets_at": {
                                "type": "string",
                                "format": "date-time"
                            },
                            "resets_in_seconds": {
                                "type": "integer"
                            }
                        }
                    }
                }
            },
            "Error": {
                "type": "object",
                "properties": {
                    "success": {
                        "type": "boolean",
                        "const": false
                    },
                    "error": {
                        "type": "object",
                        "properties": {
                            "code": {
                                "type": "string"
                            },
                            "message": {
                                "type": "string"
                            }
                        }
                    }
                }
            }
        }
    }
}