Video Enhancer API
Submit a video that is already stored on the platform, or a file you uploaded, and receive an enhanced version at 1080p, 2K, or 4K. You can turn text sharpening on or off, and you can enhance the whole video or a clip of up to 10 minutes. Poll for the result, or pass a webhook_url to have the result sent to you when the task finishes.
Supported Video Sources
Pass a platform file URL, or the identity returned by the Upload API. Local upload requires a Starter plan or above.
Workflow
- Submit an enhancement task with the source video and a target resolution
- Poll the results until
statusisDONEorERROR, or receive the result at your webhook - When
statusisDONE, readoutput_url
Endpoints
| Method | Path | Description |
|---|---|---|
POST | /api/v2/video-enhancer | Submit an enhancement task |
GET | /api/v2/video-enhancer/results/{id} | Retrieve the task result |
All requests require:
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
x-wayinvideo-api-version: v2
Submit Enhancement Task
POST https://wayinvideo-api.wayin.ai/api/v2/video-enhancer
Request Body
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
video_url | string | Yes | — | Platform file URL, or the identity returned by the Upload API. |
target_res | string | Yes | — | Output resolution. Allowed values: 1080p, 2k, 4k. |
enable_text_hd | boolean | No | true | Sharpen on-screen text. When this field is omitted, the default is true. |
start_ms | integer | No | — | Clip start, in milliseconds. Omit both start_ms and end_ms to process the whole video, still subject to the 10-minute maximum. Sending only one of the two fields is rejected. |
end_ms | integer | No | — | Clip end, in milliseconds. Must be greater than start_ms and must not exceed the source duration. |
webhook_url | string | No | — | URL that receives the result when the task reaches DONE or ERROR. The URL must be registered first. See Webhook Callback. Omit it to rely on polling only. |
The processed range cannot be longer than 10 minutes. Billing uses that range, rounded up to the next whole second. Rates are on the Billing page.
Example Request
curl -X POST https://wayinvideo-api.wayin.ai/api/v2/video-enhancer \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "x-wayinvideo-api-version: v2" \
-d '{
"video_url": "EF_up_06wguq1afbwg1",
"target_res": "1080p",
"enable_text_hd": true,
"start_ms": 0,
"end_ms": 8000
}'
import requests
requests.post(
"https://wayinvideo-api.wayin.ai/api/v2/video-enhancer",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"x-wayinvideo-api-version": "v2",
},
json={
"video_url": "EF_up_06wguq1afbwg1",
"target_res": "1080p",
"enable_text_hd": True,
"start_ms": 0,
"end_ms": 8000,
},
)
await fetch('https://wayinvideo-api.wayin.ai/api/v2/video-enhancer', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'x-wayinvideo-api-version': 'v2',
'Content-Type': 'application/json',
},
body: JSON.stringify({
video_url: 'EF_up_06wguq1afbwg1',
target_res: '1080p',
enable_text_hd: true,
start_ms: 0,
end_ms: 8000,
}),
});
Response
A newly submitted task is usually PENDING (still queued) or IN_PROGRESS (already running).
{
"data": {
"id": "proj_01HQ2X8J3K4L5M6N7O8P9Q0R",
"status": "IN_PROGRESS"
}
}
| Field | Type | Description |
|---|---|---|
id | string | Project id. Pass it in the results path. |
status | string | PENDING (queued), IN_PROGRESS (running), DONE (finished), or ERROR (failed). |
output_url | string | URL of the enhanced video. Present only when status is DONE. |
Retrieve Enhancement Result
Poll with the id from the submit response until status is DONE or ERROR. When status is DONE, read output_url.
GET https://wayinvideo-api.wayin.ai/api/v2/video-enhancer/results/{id}
Example Request
curl -X GET https://wayinvideo-api.wayin.ai/api/v2/video-enhancer/results/proj_01HQ2X8J3K4L5M6N7O8P9Q0R \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "x-wayinvideo-api-version: v2"
Response
{
"data": {
"id": "proj_01HQ2X8J3K4L5M6N7O8P9Q0R",
"status": "DONE",
"output_url": "https://cdn.example.com/export/video_0_8000_1080p.mp4"
}
}
The fields match the submit response. output_url is included when the task is finished.
Webhook Callback
Pass webhook_url when you submit a task. When the task reaches DONE or ERROR, the platform sends one POST request with the result to that URL, so you do not need to poll. The results endpoint stays available and returns the same result.
Setup
- Register the URL: Send email to wayinvideo@wayin.ai to apply for this feature.
- Submit a task: Include the same
webhook_urlin the request body. If the URL is not registered, the request is rejected with HTTP500and themessagewebhook_url is not allowed. No task is created and no API Units are deducted. - Receive the callback: When the task finishes, the platform sends a
POSTrequest. Return HTTP200to confirm delivery. - Handle the result: When
result.statusisDONE, downloadresult.output_url. When it isERROR, treat the task as failed. You can confirm either result with the results endpoint.
Example Request
curl -X POST https://wayinvideo-api.wayin.ai/api/v2/video-enhancer \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "x-wayinvideo-api-version: v2" \
-d '{
"video_url": "EF_up_06wguq1afbwg1",
"target_res": "1080p",
"enable_text_hd": true,
"start_ms": 0,
"end_ms": 8000,
"webhook_url": "https://your-domain.com/wayin/webhook"
}'
The submit response is the same as a request without webhook_url.
Callback Request
POST https://your-domain.com/wayin/webhook
Content-Type: application/json
When the task succeeds:
{
"id": "whknt_06wh3k2m9p1qa",
"task_type": "video_enhancer_task",
"result": {
"id": "proj_01HQ2X8J3K4L5M6N7O8P9Q0R",
"status": "DONE",
"output_url": "https://cdn.example.com/export/video_0_8000_1080p.mp4?Expires=...&Signature=...&Key-Pair-Id=..."
}
}
When the task fails, output_url is not included:
{
"id": "whknt_06wh3k2m9p1qa",
"task_type": "video_enhancer_task",
"result": {
"id": "proj_01HQ2X8J3K4L5M6N7O8P9Q0R",
"status": "ERROR"
}
}
| Field | Type | Description |
|---|---|---|
id | string | Notification id. It stays the same across retries, so you can use it to deduplicate. |
task_type | string | Task type. Always video_enhancer_task for Video Enhancer. |
result | object | Same as data in the results response. |
result.id | string | Project id, the same as data.id in the submit response. |
result.status | string | DONE or ERROR. |
result.output_url | string | Present only when status is DONE. Signed download URL, valid for 24 hours. Download or copy the file in time; after it expires, call the results endpoint for a new URL. |
Delivery and Retries
- Success: Only HTTP
200counts as delivered.201,204, and3xxare treated as failures, and redirects are not followed. - Timeouts: 5 seconds to connect and 20 seconds to read. If your processing takes longer, return
200first and process the payload asynchronously. - Retries: After a failed delivery, the platform retries after about 30 seconds, then 1, 2, 4, 8, 16, and 30 minutes. That is 8 attempts in total, ending after about 1 hour. Each retry may be up to 30 seconds later than scheduled.
- Duplicates: In rare cases the same notification is delivered more than once. Handle callbacks idempotently by
idorresult.id. - Verification: Callbacks are not signed. To confirm a callback is genuine, call the results endpoint with
result.id.
Billing
Video Enhancer consumes API Units for the processed range, rounded up to the next whole second. A range shorter than 1 second is billed as 1 second.
| Target resolution | API Units |
|---|---|
| 1080p | 1 per second |
2K (2k) | 2 per second |
4K (4k) | 4 per second |
If the account does not have enough API Units, the task is not created and no units are deducted. See Billing and Status Codes.
Errors
Failed requests use the standard status codes and response formats. See Status Codes.