Documentation

Create Job

Create a VideoShorts job with the Swiftia API

Create a 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.

Prerequisites

Before creating a VideoShorts job, ensure you meet the following requirements:

Storage Requirements

Your organization must have sufficient storage space available. The API will validate storage availability before processing your request. If storage is insufficient, you'll receive a 403 Forbidden error with storage details.

Phone Verification

If phone verification is enabled for your organization, your phone number must be verified before creating jobs.

Sufficient Credits

You must have enough credits in your account to cover the estimated cost of processing the video.

Pricing

The VideoShorts function uses a credit-based pricing model with the following cost structure:

Base Processing Cost

  • Free Plan: $0.03 per processed minute ($1.80/hour)
  • Starter Plan: $0.03 per processed minute ($1.80/hour)
  • Pro Plan: $0.026 per processed minute ($1.56/hour)
  • Swift Plan: $0.023 per processed minute ($1.38/hour)

Additional Services

YouTube Video Processing

When processing YouTube videos, an additional cost applies:

  • Rate: $0.60 per GB of video data processed
  • Calculation: Based on actual file size downloaded from YouTube
  • Billing: Added to your total job cost automatically

Minimum Costs

  • Predefined Shorts: $0.30 minimum per job (when using custom segments)
  • Auto-Generated Shorts: $0.30 minimum per job (when using AI generation)

Cost Calculation Examples

File Upload (5-minute video, Pro Plan)

Processing: 5 minutes × $0.026 = $0.13
Total Cost: $0.13

YouTube Video (5-minute video, 1.2GB file, Pro Plan)

Processing: 5 minutes × $0.026 = $0.13
YouTube Processing: 1.2GB (estimated) × $0.60 = $0.72 
Total Cost: $0.85

the minimum youtube processing price is $0.1

Auto-Generated Shorts (2-minute video, Free Plan)

Processing: 50 minutes × $0.03 = $1.5
Minimum cost applies: $1.5
Total Cost: $1.5

Request Body

{
  "functionName": "VideoShorts",
  "name": "my job name", // optional job name
  // ------
  "youtubeVideoId": "YOUR_VIDEO_ID",  // Use this if providing a YouTube video ID
  // OR
  "fileUrl": "YOUR_VIDEO_FILE_URL", // Use this if providing a video file URL
  // ------
  "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.
  • name (string, optional): Job name.
  • youtubeVideoId (string, required if youtube video URL): The YouTube video ID or URL.
  • fileUrl (string, required if using a video file URL): The URL of the video file. Mutually exclusive with youtubeVideoId.
  • (UI Only) Uploaded Video File: The video file uploaded through the Swiftia Studio. Mutually exclusive with youtubeVideoId and fileUrl.
  • 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

Success Response

{
  "jobId": "NEWLY_CREATED_JOB_ID",
  "cost": 0.93,
  "costBreakDown": {
    "shortGen": 0.205,
    "youtubeProcessing": 0.72
  }
}

Response Parameters

  • jobId (string): The unique job identifier.
  • cost (number): The total estimated cost for this job.
  • costBreakDown (object): Detailed breakdown of costs:
    • shortGen (number): Base processing cost for video analysis and short generation.
    • youtubeProcessing (number): Additional cost for YouTube video acquisition (only present for YouTube videos).

Error Responses

Storage Limit Exceeded (403 Forbidden)

{
  "error": "fullStorage",
  "message": "Insufficient storage space. Please upgrade your plan or delete some files to create new jobs.",
  "storageInfo": {
    "usedSize": 950,
    "totalSize": 1000,
    "availableSize": 50
  }
}

Phone Verification Required (403 Forbidden)

{
  "error": "Phone verification required",
  "message": "Please verify your phone number before creating jobs",
  "phoneNumber": "+1234567890"
}

Insufficient Credits (403 Forbidden)

{
  "error": "noEnoughCredit",
  "message": "Insufficient credits to process this job"
}

Example Request (cURL - User-defined shorts)

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

Example Response

{
  "jobId": "cm3xg93fi0001zz233aduptb8"
}