Rendering - Render Video

Rendering - Render Video

This endpoint initiates the rendering process for a specific short generated by the VideoShorts function. Rendering creates the final video output (MP4) with captions, styles, and watermarks applied.

Endpoint:

POST /api/render

Request Body

{
  "jobId": "YOUR_JOB_ID",
  "target": "SHORT_ID", // ID of the short to render
  "preset": "VIRAL", // Optional preset style
  "options": { // Optional rendering options
    "maxWordsInPage": 5,
    "waterMark": {
      "waterMarkUrl": "YOUR_WATERMARK_URL",
      "left": "calc(50% - 200px)",
      "bottom": "80%",
      "blendMode": "normal",
      "opacity": "0.9",
      "width": "400px"
    },
    "style": [
      {
        "property": "color",
        "value": "#ffffffed",
        "active": {
          "value": "#ff00cdff",
          "duration": 0.3
        },
        "past": {
          "value": "#ffffffed",
          "duration": 0.7
        }
      }
    ]
  }
}

Request Parameters

  • jobId (string, required): The ID of the completed VideoShorts job. This is the same jobId you received when creating the job. It is used to identify the specific job whose results you want to render.

  • target (string, required): The ID of the short to render. This ID corresponds to the id field within the shorts array in the Get Job response. It identifies the specific short video within the job's results that you want to render.

  • preset (string, optional): A predefined style preset to apply to the captions. Provides a quick way to apply pre-configured styles. If omitted, the default style is used. Available presets are: "DEFAULT", "GRAPES", "VIRAL", "BLURRY", "FAST", "DEEP DIVER", "GLOW VIOLET", "70S RADIATION", "BILL GREEN", "ETHEREAL UNDERLINE".

  • options (object, optional): Additional rendering options for fine-grained customization.

    • maxWordsInPage (integer, optional): Controls the maximum number of words displayed on each caption page in the rendered video. Helps to control the reading pace for viewers.

    • waterMark (object, optional): Allows customization of the watermark. If omitted, the default Swiftia watermark (for free tier users) or the user's uploaded watermark (for paid tier users) is used.

      • Watermark Behavior: The watermark behavior depends on your Swiftia subscription tier:
        • Free Tier: A default Swiftia watermark is applied to rendered videos. You cannot customize or remove this watermark. The waterMarkUrl parameter is not applicable for free tier users. Any waterMark options provided in the request will be ignored.
        • Paid Tiers: You can customize the watermark by providing the waterMarkUrl parameter with a URL to your own watermark image. You can also customize the position, size, opacity, and blend mode of the watermark using the options within the waterMark object. If you do not provide the waterMark object, your default uploaded watermark (configured in your account settings) will be used.
      • waterMarkUrl (string, required if waterMark is present, paid tiers only): The URL of a custom watermark image. Allows paid users to replace the default Swiftia watermark with their own branding.
      • left (string, required if waterMark is present): CSS value for the horizontal position of the watermark (e.g., "10px", "50%", "calc(100% - 50px)").
      • bottom (string, required if waterMark is present): CSS value for the vertical position of the watermark from the bottom edge of the video (e.g., "20px", "10%", etc.).
      • blendMode (string, optional): CSS mix-blend-mode value for the watermark (e.g., "multiply", "screen", etc.). Controls how the watermark blends with the underlying video. Defaults to "normal".
      • opacity (string, required if waterMark is present): Opacity of the watermark (0.0 - 1.0). Allows control over the watermark's visibility.
      • width (string, required if waterMark is present): Width of the watermark. The height is scaled proportionally.
    • style (array, optional): An array of style objects for detailed caption styling. Each object allows you to customize individual CSS properties and their behavior during the video.

      • property (string, required): The CSS property to modify (e.g., "color", "font-size", "text-shadow", etc.). Supports a wide range of CSS properties for flexible styling.
      • value (string, required): The default value for the CSS property. This is the base style applied to the captions.
      • active (object, optional): Defines the style applied when a word is being spoken in the video. This allows for dynamic highlighting of the current word.
        • value (string, required): The value for the CSS property in the active state.
        • duration (number, optional): The duration of the transition to the active state in seconds. Provides smooth animation.
      • past (object, optional): Defines the style applied after a word has been spoken. This allows for visual distinction between spoken and upcoming words.
        • value (string, required): The value for the CSS property in the past state.
        • duration (number, optional): The duration of the transition to the past state in seconds. Provides smooth animation.

Response

{
  "renderId": "NEWLY_CREATED_RENDER_ID"
}

Response Parameters:

  • renderId (string): The unique identifier for the render job. Use this ID with the GET /api/render/[renderId] endpoint to retrieve the render status and, upon completion, the URL of the rendered video.

Example

You're right to call me out on that! I should have included the example instead of the placeholder. My apologies. Here's the cURL example and response for the /api/render endpoint (POST request):

Example Request (cURL):

curl --request POST \
  --url https://app.swiftia.io/api/render \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "jobId": "cm3xgztna0001p2j74vvf8i72",
    "target": "SHORT_ID",  // Replace with the actual short ID
    "preset": "VIRAL",
    "options": {
      "maxWordsInPage": 5,
      "waterMark": {
        "waterMarkUrl": "https://your-watermark-url.com/logo.png",
        "left": "10px",
        "bottom": "20px",
        "opacity": "0.8",
        "width": "100px"
      },
      "style": [
        {
          "property": "color",
          "value": "#ffffff",
          "active": {
            "value": "#00ff00",
            "duration": 0.2
          },
          "past": {
            "value": "#888888",
            "duration": 0.5
          }
        }
      ]
    }
  }'

Example Response:

{
  "renderId": "y9x9kjinh2"  // Example renderId
}