Getting started overview

Getting started with Final Space involves a sequence of steps designed to enable developers to integrate video capabilities into their applications. This process generally includes account creation, securing API credentials, and executing a foundational API request, such as uploading and encoding a video. Final Space provides a free tier that includes monthly allowances for storage, bandwidth, and encoding minutes, which can be utilized for development and testing purposes. The platform also offers official SDKs in multiple programming languages to streamline interaction with its API.

The core functionality of Final Space revolves around its video encoding and streaming APIs, which allow for the processing, management, and delivery of video content. Developers can choose to interact directly with the RESTful API or leverage the provided SDKs to abstract common operations. The following sections detail the steps to set up an account, obtain the necessary authentication keys, and make a first successful API call.

Quick Reference Guide

Step What to Do Where
1. Sign Up Create a Final Space account Final Space homepage
2. Get API Keys Retrieve your API Key and Secret Final Space Dashboard > API Settings
3. Install SDK (Optional) Install the relevant SDK for your language (e.g., Python, JavaScript) Final Space SDK documentation
4. Configure Environment Set up API keys as environment variables or directly in code Your development environment
5. Make First Request Send a simple API call, such as uploading a video for encoding Using cURL, Postman, or a chosen SDK

Create an account and get keys

To begin using Final Space, the first step is to create an account. Navigate to the Final Space website and complete the registration process. During signup, you will typically provide an email address and set a password. After successful registration, you will gain access to the Final Space dashboard, which serves as the central hub for managing your projects, viewing usage statistics, and accessing API credentials.

Retrieving API Credentials

API authentication for Final Space typically relies on a combination of an API Key and an API Secret. These credentials are used to verify your identity and authorize your requests to the Final Space API. Follow these steps to locate your keys:

  1. Log in to your Final Space dashboard.
  2. Navigate to the 'API Settings' or 'Developer Settings' section. The exact path may vary but is generally accessible from the main dashboard navigation.
  3. Locate your unique API Key and API Secret. These are sensitive credentials and should be treated with the same security considerations as passwords.
  4. Store your API Key and Secret securely. It is recommended to use environment variables or a secrets management service in production environments rather than hardcoding them directly into your application code. This practice is aligned with general security principles for API keys, as detailed in guides like AWS access key best practices.

Your API Key is usually a public identifier for your application, while the API Secret is a confidential token used to sign requests or generate authentication tokens. Some APIs might also use OAuth 2.0 for more granular access control, although for initial setup, direct API key/secret authentication is common.

Your first request

Once you have obtained your API Key and Secret, you can make your first API request to Final Space. This initial step often involves uploading a video file for encoding, which demonstrates a fundamental capability of the platform. We will provide examples using both cURL for a direct HTTP request and Python using the official Final Space SDK.

Prerequisites

  • Your Final Space API Key and Secret.
  • A video file to upload (e.g., sample.mp4).
  • If using Python, ensure Python is installed and install the Final Space SDK: pip install finalspace-sdk.

Method 1: Using cURL (Raw HTTP Request)

This example demonstrates uploading a video file for encoding using cURL. Replace YOUR_API_KEY and YOUR_API_SECRET with your actual credentials.

curl -X POST \ 
  https://api.finalspace.com/v1/videos \ 
  -H 'Content-Type: multipart/form-data' \ 
  -H 'Authorization: Bearer YOUR_API_KEY:YOUR_API_SECRET' \ 
  -F 'file=@/path/to/your/sample.mp4' \ 
  -F 'metadata={"title":"My First Video","description":"Uploaded via cURL"}'

This command sends a POST request to the /v1/videos endpoint, indicating a file upload with associated metadata. The Authorization header typically uses a scheme like Bearer, requiring your API key and secret for authentication. For specific authentication details, refer to the Final Space API authentication guide.

Method 2: Using the Python SDK

The Final Space Python SDK simplifies API interactions. Ensure you have installed the SDK (pip install finalspace-sdk) and have your API credentials ready. This example uploads a video and prints its ID.

import os
from finalspace import Client

# It's recommended to load these from environment variables
api_key = os.getenv('FINALSPACE_API_KEY', 'YOUR_API_KEY')
api_secret = os.getenv('FINALSPACE_API_SECRET', 'YOUR_API_SECRET')

client = Client(api_key=api_key, api_secret=api_secret)

file_path = '/path/to/your/sample.mp4'

try:
    with open(file_path, 'rb') as f:
        video = client.videos.upload(file=f, title="My SDK Video", description="Uploaded with Python SDK")
    print(f"Video uploaded successfully! Video ID: {video['id']}")
except Exception as e:
    print(f"Error uploading video: {e}")

In this Python example, the Client object is initialized with your API credentials. The client.videos.upload() method handles the complexities of the HTTP request, including file handling and setting appropriate headers. The response typically includes a video ID, which can be used to track the encoding status or manage the video later.

Common next steps

After successfully making your first API call, several common next steps can further integrate Final Space into your application workflow:

  1. Monitor Encoding Status: Videos uploaded to Final Space undergo an encoding process. You can poll the API for the status of your video using the video ID returned from the upload request. The Final Space video status documentation provides details on how to retrieve this information.
  2. Retrieve Playback URLs: Once encoding is complete, Final Space generates various renditions and provides playback URLs. These URLs can be embedded directly into web pages or used in video players.
  3. Implement Webhooks: Instead of polling, set up webhooks to receive real-time notifications when a video's status changes (e.g., encoding complete, error). This reduces unnecessary API calls and provides a more efficient event-driven architecture. Guides on Final Space webhooks implementation are available.
  4. Explore Live Streaming: If your use case involves live events, explore the Final Space Live Streaming API, which allows for ingesting, processing, and delivering live video feeds.
  5. Integrate with a CDN: Final Space often leverages a global Content Delivery Network (CDN) for efficient video delivery. Understanding how to optimize CDN usage and manage caching can improve user experience.
  6. Review Usage and Billing: Regularly check your usage statistics in the Final Space dashboard to monitor your storage, bandwidth, and encoding minutes, especially if you are on the free or usage-based tiers.

Troubleshooting the first call

Encountering issues during your first API call is common. Here are some troubleshooting steps:

  • Check API Keys: Ensure your API Key and API Secret are correct and have not been truncated or mistyped. Verify they are loaded properly if using environment variables.
  • Authentication Format: Confirm the authentication header format (e.g., Bearer YOUR_API_KEY:YOUR_API_SECRET) matches the Final Space API documentation. Incorrect authentication is often indicated by 401 Unauthorized errors.
  • Endpoint URL: Double-check the API endpoint URL (e.g., https://api.finalspace.com/v1/videos) for any typos.
  • Content-Type Header: For file uploads, ensure the Content-Type header is correctly set, typically to multipart/form-data.
  • File Path: Verify that the local file path specified in your cURL command or SDK upload function is correct and the file exists.
  • Error Messages: Pay close attention to the error messages returned by the API. They often provide specific information about what went wrong. For example, a 400 Bad Request might indicate malformed JSON in metadata or an incorrect parameter.
  • Network Connectivity: Ensure your development environment has stable internet access and is not blocked by a firewall from reaching the Final Space API endpoints.
  • SDK Version: If using an SDK, ensure it is up to date. Older SDK versions might not support newer API features or could contain bugs that have since been resolved.
  • Consult Documentation: Refer to the Final Space troubleshooting guide and the specific API reference for details on error codes and common issues.

When debugging, tools like Postman or Insomnia can be instrumental in constructing and testing API requests independently of your application code, helping to isolate issues with authentication or request formatting. Additionally, most programming languages offer debugging tools to inspect variables and execution flow.