VideoShorts - Create Job

VideoShorts - Create a VideoShorts job with the Swiftia API

The Swiftia API's VideoShorts function allows you to generate short-form videos from longer YouTube videos. You can either let Swiftia's AI automatically identify suitable segments for shorts or define your own shorts by specifying start and end times.

Endpoint:

POST /api/jobs

Functionality

This endpoint creates an asynchronous job. After you submit the request, Swiftia processes the video in the background. You can then use the Get Job endpoint to check the job status and retrieve the results.

Request Body

{
  "functionName": "VideoShorts",
  "youtubeVideoId": "YOUR_VIDEO_ID", // youtube video url/id
  "options": { // Optional. Provides control over short generation.
    "predefinedShorts": [ // Optional.  Define specific shorts.
      {
        "title": "Short Title 1",
        "start": 0.22, // Start time in seconds
        "end": 251.0  // End time in seconds
      },
      // ... more predefined shorts
    ]
  },
  "webhook": "YOUR_WEBHOOK_URL" // Optional webhook URL for notifications.
}

Request Parameters

  • functionName (string, required): Must be VideoShorts.
  • youtubeVideoId (string, required): The YouTube video ID or URL.
  • options (object, optional): Additional options.
    • predefinedShorts (array, optional): An array of objects defining user-specified shorts. If omitted, Swiftia's AI automatically generates shorts with a maximum duration of 1 minute 30 seconds. If predefinedShorts is provided, the following applies:
      • Maximum Duration: Each user-defined short can have a maximum duration of 5 minutes (300 seconds).
      • title (string): The title of the short.
      • start (number): The start time in seconds.
      • end (number): The end time in seconds.
  • webhook (string, optional): A URL for job completion notifications, POST request that contain the generated content of the job

Response

{
  "jobId": "NEWLY_CREATED_JOB_ID"
}

Response Parameters:

  • jobId (string): The unique job identifier.

Example Request (cURL - User-defined shorts):

curl --request POST ... (same as before)

Example Response:

{
  "jobId": "cm3xg93fi0001zz233aduptb8"
}