{
"openapi": "3.1.2",
"info": {
"title": "Media2URL Developer Platform REST API",
"version": "1.0.0",
"description": "Official REST API for Media2URL external developers and authenticated automation clients. Provides direct Cloudflare R2 presigned file uploads with temporary-to-final object promotion, transactional quota reservations, asset management, version history, duplicate detection, and remote URL imports.",
"contact": {
"name": "Media2URL Developer Platform",
"url": "https://media2url.com/contact",
"email": "[email protected]"
},
"license": {
"name": "Proprietary",
"url": "https://media2url.com/terms"
}
},
"servers": [
{
"url": "https://api.media2url.com/v1",
"description": "Production API v1"
}
],
"security": [
{
"BearerAuth": []
}
],
"paths": {
"/usage": {
"get": {
"operationId": "getUsage",
"summary": "Retrieve Account & API Usage",
"description": "Returns authoritative usage metrics for storage, bandwidth, and monthly upload counts.",
"security": [
{
"BearerAuth": [
"usage:read"
]
}
],
"responses": {
"200": {
"description": "Authoritative usage metrics",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UsageResponse"
}
}
}
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
}
},
"/uploads/presign": {
"post": {
"operationId": "presignUpload",
"summary": "Request Direct R2 Upload URL",
"description": "Validates file metadata against account quotas, atomically reserves storage capacity, and generates a short-lived presigned PUT URL targeting a temporary R2 key.",
"security": [
{
"BearerAuth": [
"uploads:write"
]
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PresignUploadRequest"
}
}
}
},
"responses": {
"201": {
"description": "Temporary upload URL generated",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PresignUploadResponse"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
}
},
"/uploads/finalize": {
"post": {
"operationId": "finalizeUpload",
"summary": "Finalize Upload & Promote Asset",
"description": "Atomically consumes the upload session, validates temporary R2 object size, content type, magic bytes, and blocked fingerprints, promotes the validated bytes into a non-presigned final key, commits quota, and returns the canonical asset links.",
"security": [
{
"BearerAuth": [
"uploads:write"
]
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"required": false,
"schema": {
"type": "string",
"maxLength": 128
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FinalizeUploadRequest"
}
}
}
},
"responses": {
"201": {
"description": "Asset created and promoted",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AssetResource"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"409": {
"$ref": "#/components/responses/Conflict"
},
"410": {
"$ref": "#/components/responses/Gone"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
}
},
"/uploads/check-duplicate": {
"post": {
"operationId": "checkDuplicate",
"summary": "Check for Duplicate Asset",
"description": "Searches within the authenticated account's scope for an existing asset matching the given SHA-256 checksum and optional byte size.",
"security": [
{
"BearerAuth": [
"assets:read"
]
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CheckDuplicateRequest"
}
}
}
},
"responses": {
"200": {
"description": "Duplicate detection result",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CheckDuplicateResponse"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
}
}
}
},
"/assets": {
"get": {
"operationId": "listAssets",
"summary": "List Assets",
"description": "Returns a cursor-paginated list of assets owned by the authenticated account.",
"security": [
{
"BearerAuth": [
"assets:read"
]
}
],
"parameters": [
{
"name": "limit",
"in": "query",
"schema": {
"type": "integer",
"default": 20,
"maximum": 100
}
},
{
"name": "cursor"
}
]
}
}
},
"_note": "Response truncated for documentation purposes"
}
curl --location --request GET 'https://zylalabs.com/api/14137/media2url+cloud+media+ingestion+api/34981/check+api+and+edge+storage+health' --header 'Authorization: Bearer YOUR_API_KEY'
注册后,每个开发者都会被分配一个个人 API 访问密钥,这是一个唯一的字母和数字组合,用于访问我们的 API 端点。要使用 Media2URL 云媒体摄取 API 进行身份验证,只需在 Authorization 标头中包含您的 bearer token。
| 标头 | 描述 |
|---|---|
授权
|
必需
应为 Bearer access_key. 订阅后,请查看上方的"您的 API 访问密钥"。
|
每个端点返回JSON数据 例如“检查API和边缘存储健康”端点提供操作状态和API规范 而“列出托管媒体资产”端点返回媒体文件的分页列表 包括它们的ID 文件名 MIME类型 大小和公共URL
关键字段包括“id”(文件标识符)、“filename”(文件名称)、“mimeType”(文件类型)、“sizeBytes”(文件大小,以字节为单位)和“publicUrl”(永久 CDN 链接)。这些字段有助于有效识别和访问媒体资产
参数因端点而异 例如 "列出托管媒体资产" 端点支持像 "游标" 这样用于浏览结果的分页参数 "初始化预签名 R2 媒体上传" 端点可能需要文件元数据如文件类型和大小以生成上传 URL
响应数据以JSON格式构造,通常包含一个"ok"状态字段表示成功,然后是相关的数据字段。例如,"获取媒体资产元数据"接口返回特定文件的元数据,包括其ID、文件名、MIME类型和公共URL
该数据来源于用户上传到Media2URL平台的媒体资产 每个媒体资产都经过处理并存储在Cloudflare R2中 确保可靠的访问和管理 API通过在上传和检索过程中进行自动检查来维护数据的准确性
典型的用例包括为网站管理媒体资产 生成快速内容交付的CDN链接 和将媒体上传集成到应用程序中 开发人员可以自动化媒体处理 确保对各种文件类型的高效访问
用户可以通过将返回的数据集成到他们的应用程序中来展示媒体、管理资产或创建共享链接。例如,“publicUrl”字段可以用于将图像或视频直接嵌入网页或应用程序中
在处理部分或空结果时,请检查分页响应中的"nextCursor"字段。如果它为null,则没有更多结果。实施逻辑以优雅地管理空响应,例如显示一条消息指示没有可用的媒体资产