Rendering

Rendering videos with the Swiftia API

The Swiftia API provides endpoints to render videos, typically after a job like VideoShorts has completed. Rendering generates the final video output, such as an MP4 file, with applied captions, styles, and watermarks.

Initiate Render

Send a POST request to /api/render to start the rendering process.

Request:

POST /api/render

Request Body:

{
  "id": "YOUR_JOB_ID",
  "target": 1, // Index of the short to render (starts from 0)
  "preset": "VIRAL", // Optional preset style (e.g., "DEFAULT", "GRAPES", "VIRAL", etc.)
  "options": { // Optional rendering options
    "maxWordsInPage": 5,
    "waterMark": {
      "waterMarkUrl": "YOUR_WATERMARK_URL", // URL of the watermark image
      "left": "calc(50% - 200px)", // CSS value for left position
      "bottom": "80%", // CSS value for bottom position
      "blendMode": "normal", // CSS mix-blend-mode value
      "opacity": "0.9", // Watermark opacity (0.0 - 1.0)
      "width": "400px" // Watermark width
    },
    "style": [
      {
        "property": "color",
        "value": "#ffffffed",
        "active": {
          "value": "#ff00cdff",
          "duration": 0.3
        },
        "past": {
          "value": "#ffffffed",
          "duration": 0.7
        }
      },
      // ... other style properties
    ]
  }
}

Response:

{
  "renderId": "NEWLY_CREATED_RENDER_ID"
}

Get Render Status/Result

Send a GET request to /api/render/{renderId} to retrieve the render status or the final result.

Request:

GET /api/render/{renderId}

Response (In Progress):

{
  "type": "progress",
  "progress": 0.204 // Progress percentage (0.0 - 1.0)
}

Response (Completed):

{
  "type": "done",
  "url": "https://example.com/rendered_video.mp4", // URL of the rendered video
  "size": 14396911 // Size of the rendered video in bytes
}

Response (Failed):

{
  "status": 500, // Or other relevant error code
  "message": "An error occurred during rendering.",
  "code": "RENDERING_ERROR" // Example error code
}