Video API Quickstart

In this example, we’ll be using one of our popular video models, Apollo.

Before we proceed, you need to create an API keyarrow-up-right.

This key will be used to authenticate your requests to the Topaz Labs API.

chevron-rightHow do I get my API key?hashtag

In order to get access to the API, you'll need to log intoarrow-up-right your Topaz Labs account and create your unique API key. If you don't have an account, please follow the link herearrow-up-right to register.

  1. Log into your Topaz Labs account from our websitearrow-up-right

  2. Navigate to the API Keys section in your account portal, enter a name, and click Create

  3. Copy your API key (displayed at the top of the screen) and store it in a safe place

circle-exclamation

Now, proceed with the below steps.

1

Create Video Request

Create a video request—just include some details about the source video, output parameters, and desired enhancements.

circle-info

Visit out API Referencearrow-up-right page for up-to-date functionality. This endpoint is free to use.

curl --request POST \
     --url https://api.topazlabs.com/video/ \
     --header 'X-API-Key: Your-API-Key' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
     {
          "source": {
               "resolution": {
                    "width": 800,
                    "height": 448
               },
               "container": "mp4",
               "size": 477010,
               "duration": 4,
               "frameRate": 24,
               "frameCount": 97
          },
          "output": {
               "resolution": {
                    "width": 800,
                    "height": 448
               },
               "audioCodec": "AAC",
               "audioTransfer": "Copy",
               "frameRate": 24,
               "dynamicCompressionLevel": "High",
               "container": "mp4"
          },
          "filters": [ {
               "model": "apo-8",
               "slowmo": 1,
               "fps": 60,
               "duplicate": true,
               "duplicateThreshold": 0.1
               } ]
     }'
2

Accept & Upload Video Request

After submitting the video request, you can choose to continue by calling this endpoint.

curl --request PATCH \
     --url https://api.topazlabs.com/video/[your-requestID]/accept \
     --header 'X-API-Key: Your-API-Key' \
     --header 'accept: application/json'

Once this endpoint is called, you will receive a set of URL(s). You may use the following code snippet to upload the video to that link from your local device.

circle-info

In this example, we will upload the entire video file to a single URL due to its small file size.

S3_UPLOAD_URL=[https://...]

curl --verbose --request PUT \
     --upload-file "Your-Video-File" \
     --header "Content-Type: video/mp4" \
     "$S3_UPLOAD_URL"

Once uploaded, you'll receive some information about your upload, including your eTag number. This will be useful for the next step.

3

Complete Video Upload

After you have finished uploading your video segments, you may use the following request to confirm that all of your video segments have been received. Once this endpoint is called, you video will begin processing with its enhancements.

curl --request PATCH \
     --url https://api.topazlabs.com/video/[your-requestID]/complete-upload \
     --header 'X-API-Key: Your-API-Key' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '{
       "uploadResults": [
         {
           "partNum": 1,
           "eTag": "your-eTag"
         }
       ]
     }'

You should receive a response confirming that your request is queued for processing once you have called the endpoint.

4

Get Video Status

You may use the following request to view the status of your video request

curl --request GET \
     --url https://api.topazlabs.com/video/[your-requestID]/status \
     --header 'X-API-Key: Your-API-Key' \
     --header 'accept: application/json'

Once your video has finished processing, you will receive a link to download your video as a response to this endpoint.

Congratulations! You have just completed your first Video API request! 🎉

We have now made popular video models such as Proteus, Starlight Precise, and Astra Creative more available as ready-to-use APIs so that you can easily integrate them into your applications.

Once you find a model that you want to use in our "Models" tab, you can grab the URL from the model's dedicated page. Individual model pages also provide some important information about the model including use cases and examples of how you can call it.

Check out our API Playgroundarrow-up-right to tinker with these models and let us know your feedback and questions on our Discordarrow-up-right.

chevron-rightHow do I make an API call from the API Playground?hashtag

It's now easier more than ever to create and send your first API request. Once you have a Topaz Labs account and you have created your first API key, navigate over to our API Playgroundarrow-up-right to better understand how to build requests. Please see the walkthrough above for an example of an image being upscaled with our Enhance Synchronous endpoint on the Image API.

More Information

chevron-rightAPI Restrictionshashtag
  • The API has access rate limits depending on the current load on the servers. If you receive a HTTP 429 response, please try again (soon). We recommend using an exponential backoff for the requests to avoid immediately hitting the limit again.

  • The API only responds to HTTPS-secured communications. Any requests sent via HTTP return an HTTP 301 redirect to the corresponding HTTPS resources.

  • The API enforces a request size limit of 500MB. If a request exceeds this limit, the server responds with an HTTP 413. Please ensure that requests stay within the size constraint to avoid this error.

Please reach out to [email protected]envelope with any questions.

Last updated