SDKs
Official client libraries for the Impossible FX Render API. Each SDK wraps the Render API with a clean, language-native interface. All SDKs implement the same API surface across TypeScript, Python, Java, Go, and Rust.
These docs cover SDK v3, which uses region-based endpoints (render-{region}.impossible.io). If you’re migrating from v2, the main changes are: region is now required in the constructor, method signatures have been simplified, and batch operations are built in.
TypeScript / Node.js
For server-side JavaScript and TypeScript. Requires Node.js 18+.
Install:
npm install impossiblefx
Quick start:
import { ImpossibleFX } from 'impossiblefx';
const client = new ImpossibleFX({
region: 'us-east-1',
apiKey: process.env.IMPOSSIBLE_API_KEY,
});
// Synchronous render — waits for completion and returns the URL
const result = await client.render('my-project', 'welcome-video', {
name: 'Alex',
company: 'Acme Inc',
}, { format: 'mp4' });
console.log(result.url);
Async render — returns immediately, poll for progress:
import { ImpossibleFX } from 'impossiblefx';
const client = new ImpossibleFX({
region: 'us-east-1',
apiKey: process.env.IMPOSSIBLE_API_KEY,
});
// Start an async render
const result = await client.render('my-project', 'welcome-video', {
name: 'Alex',
}, { format: 'mp4', async: true });
console.log('Token:', result.token);
// Build the URL from the token
const url = client.getUrl(result.token, 'mp4');
console.log('URL:', url);
// Poll for progress (only available for async renders)
let progress = await client.getProgress(result.token);
while (progress.done < progress.total) {
await new Promise((r) => setTimeout(r, 1000));
progress = await client.getProgress(result.token);
console.log(`Progress: ${progress.done}/${progress.total}`);
}
console.log('Render complete!');
Browser JavaScript
For client-side rendering in web applications. See Video Players for playback integration.
Install:
<script src="https://cdn.impossible.io/support/impossiblefx.js"></script> npm install impossiblefx-browser Usage:
const client = new ImpossibleFX({
region: 'us-east-1',
});
const result = await client.render('my-project', 'welcome-video', {
name: 'Alex',
});
document.getElementById('my-video').src = result.url;
Python
Requires Python 3.9+. Uses httpx for HTTP.
Install:
pip install impossible-fx
Quick start:
from impossible_fx import ImpossibleFX
client = ImpossibleFX(region="us-east-1", api_key="your-api-key")
# Synchronous render — waits for completion and returns the URL
result = client.render(
project_id="my-project",
movie="welcome-video",
params={"name": "Alex", "company": "Acme Inc"},
format="mp4",
)
print(result.url)
Async render — returns immediately, poll for progress:
import time
from impossible_fx import ImpossibleFX
with ImpossibleFX(region="us-east-1", api_key="your-api-key") as client:
# Start an async render
result = client.render(
project_id="my-project",
movie="welcome-video",
params={"name": "Alex"},
format="mp4",
async_=True,
)
# Build the URL from the token
url = client.get_url(result.token, format="mp4")
print(f"URL: {url}")
# Poll for progress (only available for async renders)
progress = client.get_progress(result.token)
while progress.done < progress.total:
time.sleep(1)
progress = client.get_progress(result.token)
print(f"Progress: {progress.done}/{progress.total}")
print("Render complete!")
Java
Requires Java 11+.
Install (Maven):
<dependency>
<groupId>io.impossible</groupId>
<artifactId>impossiblefx</artifactId>
<version>3.0.0</version>
</dependency>
Install (Gradle):
implementation 'io.impossible:impossiblefx:3.0.0'
Quick start:
import io.impossible.fx.ImpossibleFX;
import io.impossible.fx.RenderOptions;
import io.impossible.fx.RenderResult;
import java.util.Map;
ImpossibleFX client = new ImpossibleFX.Builder()
.region("us-east-1")
.apiKey("your-api-key")
.build();
// Synchronous render — waits for completion and returns the URL
RenderResult result = client.render("my-project", "welcome-video",
Map.of("name", "Alex", "company", "Acme Inc"),
RenderOptions.builder().format("mp4").build());
System.out.println(result.getUrl());
Async render — returns immediately, poll for progress:
import io.impossible.fx.*;
import java.util.Map;
ImpossibleFX client = new ImpossibleFX.Builder()
.region("us-east-1")
.apiKey("your-api-key")
.build();
// Start an async render
RenderOptions asyncOptions = RenderOptions.builder()
.format("mp4")
.async(true)
.build();
RenderResult result = client.render("my-project", "welcome-video",
Map.of("name", "Alex"), asyncOptions);
System.out.println("Token: " + result.getToken());
// Build the URL from the token
String url = client.getUrl(result.getToken(), "mp4");
System.out.println("URL: " + url);
// Poll for progress (only available for async renders)
Progress progress = client.getProgress(result.getToken());
while (progress.getDone() < progress.getTotal()) {
Thread.sleep(1000);
progress = client.getProgress(result.getToken());
System.out.printf("Progress: %d/%d%n", progress.getDone(), progress.getTotal());
}
System.out.println("Render complete!");
Go
Requires Go 1.21+. No external dependencies.
Install:
go get github.com/impossiblesoftware/impossible-fx-sdk/v3/go
Quick start:
package main
import (
"context"
"fmt"
impossiblefx "github.com/impossiblesoftware/impossible-fx-sdk/v3/go"
)
func main() {
client := impossiblefx.NewClient("us-east-1",
impossiblefx.WithAPIKey("your-api-key"))
// Synchronous render — waits for completion and returns the URL
result, err := client.Render(context.Background(),
"my-project", "welcome-video",
map[string]any{"name": "Alex", "company": "Acme Inc"},
impossiblefx.WithFormat("mp4"))
if err != nil {
panic(err)
}
fmt.Println(result.URL)
}
Async render — returns immediately, poll for progress:
package main
import (
"context"
"fmt"
"time"
impossiblefx "github.com/impossiblesoftware/impossible-fx-sdk/v3/go"
)
func main() {
ctx := context.Background()
client := impossiblefx.NewClient("us-east-1",
impossiblefx.WithAPIKey("your-api-key"))
// Start an async render
result, err := client.Render(ctx,
"my-project", "welcome-video",
map[string]any{"name": "Alex"},
impossiblefx.WithFormat("mp4"), impossiblefx.WithAsync())
if err != nil {
panic(err)
}
fmt.Println("Token:", result.Token)
// Build the URL from the token
url := client.GetURL(result.Token, "mp4")
fmt.Println("URL:", url)
// Poll for progress (only available for async renders)
for {
progress, err := client.GetProgress(ctx, result.Token)
if err != nil {
panic(err)
}
fmt.Printf("Progress: %d/%d\n", progress.Done, progress.Total)
if progress.Done >= progress.Total {
break
}
time.Sleep(1 * time.Second)
}
fmt.Println("Render complete!")
}
Rust
Requires Rust 2021 edition. Uses tokio for async and reqwest for HTTP.
Install (Cargo.toml):
[dependencies]
impossible-fx-sdk = "3.0"
tokio = { version = "1", features = ["full"] }
serde_json = "1"
Quick start:
use impossible_fx_sdk::{ImpossibleFX, RenderOptions};
use std::collections::HashMap;
#[tokio::main]
async fn main() -> impossible_fx_sdk::Result<()> {
let client = ImpossibleFX::builder("us-east-1")
.api_key("your-api-key")
.build()?;
let mut params = HashMap::new();
params.insert("name".into(), serde_json::json!("Alex"));
params.insert("company".into(), serde_json::json!("Acme Inc"));
// Synchronous render — waits for completion and returns the URL
let result = client
.render("my-project", "welcome-video", ¶ms,
Some(RenderOptions { format: Some("mp4".into()), ..Default::default() }))
.await?;
println!("{}", result.url);
Ok(())
}
Async render — returns immediately, poll for progress:
use impossible_fx_sdk::{ImpossibleFX, RenderOptions};
use std::collections::HashMap;
use tokio::time::{sleep, Duration};
#[tokio::main]
async fn main() -> impossible_fx_sdk::Result<()> {
let client = ImpossibleFX::builder("us-east-1")
.api_key("your-api-key")
.build()?;
let mut params = HashMap::new();
params.insert("name".into(), serde_json::json!("Alex"));
// Start an async render
let result = client
.render("my-project", "welcome-video", ¶ms,
Some(RenderOptions {
format: Some("mp4".into()),
async_: Some(true),
..Default::default()
}))
.await?;
// Build the URL from the token
let url = client.get_url(&result.token, "mp4");
println!("URL: {}", url);
// Poll for progress (only available for async renders)
loop {
let progress = client.get_progress(&result.token).await?;
println!("Progress: {}/{}", progress.done, progress.total);
if progress.done >= progress.total {
break;
}
sleep(Duration::from_secs(1)).await;
}
println!("Render complete!");
Ok(())
}
API Reference
All SDKs implement the same methods. See the full API reference for endpoint details.
Core Render
| Method | Description |
|---|---|
render(projectId, movie, params, options?) | Render a movie. Blocks until complete by default, or returns immediately with async: true. |
createToken(projectId, movie, params, options?) | Create a render token without starting a render. |
getUrl(token, format?) | Construct the media URL for a token. |
getProgress(token) | Poll render progress for async renders (done/total). |
Batch Operations
| Method | Description |
|---|---|
createBatch(routing?) | Create a new batch queue |
addBatchTasks(batchId, tasks) | Add render tasks to a batch |
runBatch(batchId) | Start batch execution |
getBatchStatus(batchId) | Get batch status and counts |
getBatchResults(runId) | Get results for a completed batch run |
cancelBatch(batchId) | Cancel a running batch |
Render Options
| Option | Type | Description |
|---|---|---|
async | boolean | When true, render returns immediately with a token. Poll progress with getProgress(). Default: false. |
format | string | Output format: mp4, gif, png, etc. |
routingKey | string | Render affinity / queue selection key. |
Authentication
All clients accept an optional API key. When provided, it is sent as a Bearer token:
Authorization: Bearer <apiKey>
Base URL
SDKs connect to region-specific endpoints:
https://render-{region}.impossible.io/v2