A robust, type-safe C# SDK designed for seamless integration with the FastPix API platform.
The FastPix C# SDK is a strongly-typed .NET client for the FastPix video API. From any .NET 8 app you can upload and manage videos, run live streams and simulcasts, create and secure playback IDs, manage playlists and signing keys, pull video analytics (views, metrics, dimensions, and errors), and drive in-video AI features such as subtitles, chapters, summaries, and content moderation.
Works with: .NET 8.0+ · C# · NuGet package Fastpix · ASP.NET Core, console, and worker apps
📖 Docs: https://fastpix.com/docs/language-sdks/csharp-sdk · 🚀 Free account: https://dashboard.fastpix.com
Skip straight to a section without scrolling:
If you are using the FastPix C# SDK for the first time, follow these steps in order:
- Check your .NET version
- Create a .NET project
- Install the FastPix SDK
- Verify the SDK installation
- Configure authentication
- Initialize the FastPix client
- Make your first API request
- Retrieve a media asset
- Generate a playback ID
Do not skip the verification steps. If the SDK does not install or the project does not build, resolve that issue before making an API request.
Make sure you have the following:
- .NET 8.0 or later.
- The .NET CLI.
- Internet access.
- A FastPix account.
- A FastPix Access Token.
- A FastPix Secret Key.
- A publicly accessible video URL for the first media-creation example.
| Requirement | Version | Description |
|---|---|---|
| .NET | 8.0+ |
Core runtime environment |
| NuGet | Latest |
Package manager for dependencies |
| Internet | Required |
API communication and authentication |
Pro Tip: We recommend using .NET 8.0+ for optimal performance and the latest language features.
FastPix uses HTTP Basic Authentication.
| SDK property | FastPix credential |
|---|---|
Username |
Access Token |
Password |
Secret Key |
Follow the steps in the Authentication with Basic Auth guide to obtain your credentials from the FastPix Dashboard.
Optionally, store your credentials as environment variables:
# Set your FastPix credentials
export FASTPIX_USERNAME="your-access-token"
export FASTPIX_PASSWORD="your-secret-key"Security: Do not commit your Access Token or Secret Key to source control. Use environment variables or a secure secrets manager.
Run:
dotnet --versionThe output must be 8.0 or later.
For example:
8.0.414
You can also check the installed SDKs:
dotnet --list-sdksIf .NET 8 or later is not installed, install a supported .NET SDK before continuing.
Create a new console application:
mkdir fastpix-csharp-demo
cd fastpix-csharp-demo
dotnet new consoleThis creates a new .NET console application containing files similar to:
fastpix-csharp-demo/
├── fastpix-csharp-demo.csproj
├── Program.cs
└── obj/
Verify that the project builds before installing the FastPix SDK:
dotnet buildYou should see output similar to:
Build succeeded.
0 Warning(s)
0 Error(s)
If the build fails, resolve the .NET project issue before continuing.
Install the FastPix SDK from NuGet:
dotnet add package FastpixThe SDK is added to your project as a NuGet dependency.
Verify the package:
dotnet list packageYou should see an entry similar to:
Fastpix 1.1.6
The exact version may be different if a newer version has been published.
Before making an API request, verify that your application can import and initialize the FastPix SDK.
Replace the contents of Program.cs with:
using Fastpix;
using Fastpix.Models.Components;
var sdk = new FastpixSDK(
security: new Security
{
Username = "test",
Password = "test"
}
);
Console.WriteLine("FastPix SDK initialized successfully");Run:
dotnet runExpected output:
FastPix SDK initialized successfully
At this point you have verified that:
- .NET is installed.
- The project builds.
- The
Fastpixpackage is installed. - The required namespaces are available.
- The
FastpixSDKclient can be initialized.
The example uses placeholder credentials, so it does not make an API request.
Do not put your FastPix credentials directly in Program.cs.
Set the credentials as environment variables instead.
export FASTPIX_USERNAME="your-access-token"
export FASTPIX_PASSWORD="your-secret-key"Verify that the variables are set without printing the actual credentials:
test -n "$FASTPIX_USERNAME" && echo "FASTPIX_USERNAME is set"
test -n "$FASTPIX_PASSWORD" && echo "FASTPIX_PASSWORD is set"Expected output:
FASTPIX_USERNAME is set
FASTPIX_PASSWORD is set
$env:FASTPIX_USERNAME="your-access-token"
$env:FASTPIX_PASSWORD="your-secret-key"Verify:
if ($env:FASTPIX_USERNAME) { "FASTPIX_USERNAME is set" }
if ($env:FASTPIX_PASSWORD) { "FASTPIX_PASSWORD is set" }Do not print the values of the credentials themselves.
Update Program.cs:
using Fastpix;
using Fastpix.Models.Components;
var username = Environment.GetEnvironmentVariable("FASTPIX_USERNAME");
var password = Environment.GetEnvironmentVariable("FASTPIX_PASSWORD");
if (string.IsNullOrWhiteSpace(username))
{
throw new InvalidOperationException(
"FASTPIX_USERNAME environment variable is not set."
);
}
if (string.IsNullOrWhiteSpace(password))
{
throw new InvalidOperationException(
"FASTPIX_PASSWORD environment variable is not set."
);
}
var sdk = new FastpixSDK(
security: new Security
{
Username = username,
Password = password
}
);
Console.WriteLine("FastPix client initialized successfully");Run:
dotnet runExpected output:
FastPix client initialized successfully
Initializing the SDK does not make an API request. The SDK contacts the FastPix API when you call an operation such as CreateMediaAsync.
The simplest way to verify the complete integration is to create a media asset from a publicly accessible video URL.
Replace Program.cs with:
using Fastpix;
using Fastpix.Models.Components;
using System.Collections.Generic;
using System.Text.Json;
var username = Environment.GetEnvironmentVariable("FASTPIX_USERNAME");
var password = Environment.GetEnvironmentVariable("FASTPIX_PASSWORD");
if (string.IsNullOrWhiteSpace(username))
{
throw new InvalidOperationException(
"FASTPIX_USERNAME environment variable is not set."
);
}
if (string.IsNullOrWhiteSpace(password))
{
throw new InvalidOperationException(
"FASTPIX_PASSWORD environment variable is not set."
);
}
var sdk = new FastpixSDK(
security: new Security()
{
Username = username,
Password = password,
}
);
var request = new CreateMediaRequest()
{
Inputs = new List<Fastpix.Models.Components.Input>()
{
Fastpix.Models.Components.Input.CreatePullVideoInput(
new PullVideoInput()
{
Url = "https://static.fastpix.com/fp-sample-video.mp4"
}
)
},
Metadata = new Dictionary<string, string>()
{
{ "title", "My first FastPix video" },
{ "source", "csharp-demo" }
}
};
try
{
var response = await sdk.InputVideo.CreateMediaAsync(request);
Console.WriteLine("Media creation request succeeded.");
Console.WriteLine();
Console.WriteLine("Response type:");
Console.WriteLine(response.GetType().FullName);
Console.WriteLine();
Console.WriteLine("Response:");
Console.WriteLine(
JsonSerializer.Serialize(
response,
new JsonSerializerOptions
{
WriteIndented = true
}
)
);
}
catch (Exception ex)
{
Console.Error.WriteLine("FastPix API request failed.");
Console.Error.WriteLine(ex.Message);
}Run:
dotnet runIf the request succeeds, FastPix returns the response from the media creation API.
Note: The example URL above is a placeholder. You must replace it with a URL that points directly to a video file that FastPix can access.
After creating media, use the returned media ID to retrieve the media details.
The media ID returned by the create operation can be passed to the corresponding media retrieval operation.
For a media asset to become playable, wait until its processing status indicates that it is ready.
Once your media is ready, you can create a playback ID for video playback.
Playback IDs can be used with FastPix playback clients such as the FastPix Web Player.
For secure content, use signed playback and the appropriate signing configuration.
See the FastPix playback documentation for details.
Creating media is usually the first operation in an on-demand video workflow. You carry the media ID from one call to the next, from upload through to playback.
A playback ID is created separately, only when you need playback access.
More examples: For runnable, end-to-end flows (media creation, live streaming, playlists, analytics, and more), see the
examples/directory in the repo.
Comprehensive C# SDK for FastPix platform integration with full API coverage.
Upload, manage, and transform video content with comprehensive media management capabilities.
For detailed documentation, see FastPix Video on Demand Overview.
- Create from URL - Upload video content from external URL
- Upload from Device - Upload video files directly from device
- List All Media - Retrieve complete list of all media files
- Get Media by ID - Get detailed information for specific media
- Update Media - Modify media metadata and settings
- Delete Media - Remove media files from library
- Cancel Upload - Stop ongoing media upload process
- Get Input Info - Retrieve detailed input information
- List Uploads - Get all available upload URLs
- List Clips - Get all clips of a media
- Create Playback ID - Generate secure playback identifier
- List Playback IDs - Get all playback IDs for a media
- Delete Playback ID - Remove playback access
- Get Playback ID - Retrieve playback configuration details
- Update Domain Restrictions - Update domain restrictions for a playback ID
- Update User-Agent Restrictions - Update user-agent restrictions for a playback ID
- Create Playlist - Create new video playlist
- List Playlists - Get all available playlists
- Get Playlist - Retrieve specific playlist details
- Update Playlist - Modify playlist settings and metadata
- Delete Playlist - Remove playlist from library
- Add Media - Add media items to playlist
- Reorder Media - Change order of media in playlist
- Remove Media - Remove media from playlist
- Create Key - Generate new signing key pair
- List Keys - Get all available signing keys
- Delete Key - Remove signing key from system
- Get Key - Retrieve specific signing key details
- List DRM Configs - Get all DRM configuration options
- Get DRM Config - Retrieve specific DRM configuration
Stream, manage, and transform live video content with real-time broadcasting capabilities.
For detailed documentation, see FastPix Live Stream Overview.
- Create Stream - Initialize new live streaming session
- List Streams - Retrieve all active live streams
- Get Viewer Count - Get real-time viewer statistics
- Get Stream - Retrieve detailed stream information
- Delete Stream - Terminate and remove live stream
- Update Stream - Modify stream settings and configuration
- Enable Stream - Activate live streaming
- Disable Stream - Pause live streaming
- Complete Stream - Finalize and archive stream
- Create Playback ID - Generate secure live playback access
- Delete Playback ID - Revoke live playback access
- Get Playback ID - Retrieve live playback configuration
- Update Domain Restrictions - Update domain restrictions for a live playback ID
- Update User-Agent Restrictions - Update user-agent restrictions for a live playback ID
- Create Simulcast - Set up multi-platform streaming
- Delete Simulcast - Remove simulcast configuration
- Get Simulcast - Retrieve simulcast settings
- Update Simulcast - Modify simulcast parameters
Monitor video performance and quality with comprehensive analytics and real-time metrics.
For detailed documentation, see FastPix Video Data Overview.
- List Breakdown Values - Get detailed breakdown of metrics by dimension
- List Overall Values - Get aggregated metric values across all content
- Get Timeseries Data - Retrieve time-based metric trends and patterns
- Compare Values - List comparison values
- List Video Views - Get comprehensive list of video viewing sessions
- Get View Details - Retrieve detailed information about specific video views
- List Top Content - Find your most popular and engaging content
- List Dimensions - Get available data dimensions for filtering and analysis
- List Filter Values - Get specific values for a particular dimension
- List Errors - Get list of playback errors
Transform and enhance your video content with powerful AI and editing capabilities.
Enhance video content with AI-powered features including moderation, summarization, and intelligent categorization.
- Update Summary - Create AI-generated video summaries
- Update Chapters - Automatically generate video chapter markers
- Extract Entities - Identify and extract named entities from content
- Enable Moderation - Activate content moderation and safety checks
- List Live Clips - Get all clips of a live stream
- List Media Clips - Retrieve all clips associated with a source media
- Generate Subtitles - Create automatic subtitles for media
- Add Track - Add audio or subtitle tracks to media
- Update Track - Modify existing audio or subtitle tracks
- Delete Track - Remove audio or subtitle tracks
- Update Source Access - Control access permissions for media source
- Update MP4 Support - Configure MP4 download capabilities
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
To change the default retry strategy for a single API call, simply pass a RetryConfig to the call:
using Fastpix;
using Fastpix.Models.Components;
using Fastpix.Utils.Retries;
using System.Collections.Generic;
var sdk = new FastpixSDK(security: new Security() {
Username = "your-access-token",
Password = "your-secret-key",
});
CreateMediaRequest req = new CreateMediaRequest() {
Inputs = new List<Fastpix.Models.Components.Input>() {
Fastpix.Models.Components.Input.CreatePullVideoInput(
new PullVideoInput() {}
),
},
Metadata = new Dictionary<string, string>() {
{ "<key>", "<value>" },
},
};
var res = await sdk.InputVideo.CreateMediaAsync(
retryConfig: new RetryConfig(
strategy: RetryConfig.RetryStrategy.BACKOFF,
backoff: new BackoffStrategy(
initialIntervalMs: 1L,
maxIntervalMs: 50L,
maxElapsedTimeMs: 100L,
exponent: 1.1
),
retryConnectionErrors: false
),
request: req
);
// handle responseIf you'd like to override the default retry strategy for all operations that support retries, you can use the RetryConfig optional parameter when initializing the SDK:
using Fastpix;
using Fastpix.Models.Components;
using Fastpix.Utils.Retries;
using System.Collections.Generic;
var sdk = new FastpixSDK(
retryConfig: new RetryConfig(
strategy: RetryConfig.RetryStrategy.BACKOFF,
backoff: new BackoffStrategy(
initialIntervalMs: 1L,
maxIntervalMs: 50L,
maxElapsedTimeMs: 100L,
exponent: 1.1
),
retryConnectionErrors: false
),
security: new Security() {
Username = "your-access-token",
Password = "your-secret-key",
}
);
CreateMediaRequest req = new CreateMediaRequest() {
Inputs = new List<Fastpix.Models.Components.Input>() {
Fastpix.Models.Components.Input.CreatePullVideoInput(
new PullVideoInput() {}
),
},
Metadata = new Dictionary<string, string>() {
{ "<key>", "<value>" },
},
};
var res = await sdk.InputVideo.CreateMediaAsync(req);
// handle responseFastpixException is the base exception class for all HTTP error responses. It has the following properties:
| Property | Type | Description |
|---|---|---|
Message |
string | Error message |
Request |
HttpRequestMessage | HTTP request object |
Response |
HttpResponseMessage | HTTP response object |
Body |
string | HTTP response body |
using Fastpix;
using Fastpix.Models.Components;
using Fastpix.Models.Errors;
using System.Collections.Generic;
var sdk = new FastpixSDK(security: new Security() {
Username = "your-access-token",
Password = "your-secret-key",
});
try
{
CreateMediaRequest req = new CreateMediaRequest() {
Inputs = new List<Fastpix.Models.Components.Input>() {
Fastpix.Models.Components.Input.CreatePullVideoInput(
new PullVideoInput() {}
),
},
Metadata = new Dictionary<string, string>() {
{ "<key>", "<value>" },
},
};
var res = await sdk.InputVideo.CreateMediaAsync(req);
// handle response
}
catch (FastpixException ex) // all SDK exceptions inherit from FastpixException
{
// ex.ToString() provides a detailed error message
System.Console.WriteLine(ex);
// Base exception fields
HttpRequestMessage request = ex.Request;
HttpResponseMessage response = ex.Response;
var statusCode = (int)response.StatusCode;
var responseBody = ex.Body;
}
catch (OperationCanceledException ex)
{
// CancellationToken was cancelled
}
catch (System.Net.Http.HttpRequestException ex)
{
// Check ex.InnerException for Network connectivity errors
}Primary exception:
FastpixException: The base class for HTTP error responses.
Less common exceptions (2)
-
System.Net.Http.HttpRequestException: Network connectivity error. For more details about the underlying cause, inspect theex.InnerException. -
Inheriting from
FastpixException:ResponseValidationError: Thrown when the response data could not be deserialized into the expected type.
The default server can be overridden globally by passing a URL to the serverUrl: string optional parameter when initializing the SDK client instance. For example:
using Fastpix;
using Fastpix.Models.Components;
using System.Collections.Generic;
var sdk = new FastpixSDK(
serverUrl: "<server-url>",
security: new Security() {
Username = "your-access-token",
Password = "your-secret-key",
}
);
CreateMediaRequest req = new CreateMediaRequest() {
Inputs = new List<Fastpix.Models.Components.Input>() {
Fastpix.Models.Components.Input.CreatePullVideoInput(
new PullVideoInput() {}
),
},
Metadata = new Dictionary<string, string>() {
{ "<key>", "<value>" },
},
};
var res = await sdk.InputVideo.CreateMediaAsync(req);
// handle responseThe C# SDK makes API calls using an IFastpixHttpClient that wraps the native
HttpClient. This
client provides the ability to attach hooks around the request lifecycle that can be used to modify the request or handle
errors and response.
The IFastpixHttpClient interface allows you to either use the default FastpixHttpClient that comes with the SDK,
or provide your own custom implementation with customized configuration such as custom message handlers, timeouts,
connection pooling, and other HTTP client settings.
The following example shows how to create a custom HTTP client with request modification and error handling:
using Fastpix;
using Fastpix.Utils;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
// Create a custom HTTP client
public class CustomHttpClient : IFastpixHttpClient
{
private readonly IFastpixHttpClient _defaultClient;
public CustomHttpClient()
{
_defaultClient = new FastpixHttpClient();
}
public async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken? cancellationToken = null)
{
// Add custom header and timeout
request.Headers.Add("x-custom-header", "custom value");
request.Headers.Add("x-request-timeout", "30");
try
{
var response = await _defaultClient.SendAsync(request, cancellationToken);
// Log successful response
Console.WriteLine($"Request successful: {response.StatusCode}");
return response;
}
catch (Exception error)
{
// Log error
Console.WriteLine($"Request failed: {error.Message}");
throw;
}
}
public void Dispose()
{
_defaultClient?.Dispose();
}
}
// Use the custom HTTP client with the SDK
var customHttpClient = new CustomHttpClient();
var sdk = new FastpixSDK(client: customHttpClient);You can also provide a completely custom HTTP client with your own configuration:
using Fastpix.Utils;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
// Custom HTTP client with custom configuration
public class AdvancedHttpClient : IFastpixHttpClient
{
private readonly HttpClient _httpClient;
public AdvancedHttpClient()
{
var handler = new HttpClientHandler()
{
MaxConnectionsPerServer = 10,
// ServerCertificateCustomValidationCallback = customCertValidation, // Custom SSL validation if needed
};
_httpClient = new HttpClient(handler)
{
Timeout = TimeSpan.FromSeconds(30)
};
}
public async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken? cancellationToken = null)
{
return await _httpClient.SendAsync(request, cancellationToken ?? CancellationToken.None);
}
public void Dispose()
{
_httpClient?.Dispose();
}
}
var sdk = new FastpixSDK(client: new AdvancedHttpClient());For simple debugging, you can enable request/response logging by implementing a custom client:
public class LoggingHttpClient : IFastpixHttpClient
{
private readonly IFastpixHttpClient _innerClient;
public LoggingHttpClient(IFastpixHttpClient innerClient = null)
{
_innerClient = innerClient ?? new FastpixHttpClient();
}
public async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken? cancellationToken = null)
{
// Log request
Console.WriteLine($"Sending {request.Method} request to {request.RequestUri}");
var response = await _innerClient.SendAsync(request, cancellationToken);
// Log response
Console.WriteLine($"Received {response.StatusCode} response");
return response;
}
public void Dispose() => _innerClient?.Dispose();
}
var sdk = new FastpixSDK(client: new LoggingHttpClient());The SDK also provides built-in hook support through the SDKConfiguration.Hooks system, which automatically handles
BeforeRequestAsync, AfterSuccessAsync, and AfterErrorAsync hooks for advanced request lifecycle management.
How do I install the FastPix C# SDK?
Add the NuGet package with dotnet add package Fastpix (or Install-Package Fastpix in Visual Studio). See Install the FastPix SDK.
How do I authenticate the FastPix .NET SDK?
FastPix uses Basic Auth: pass your access token as Username and your secret key as Password when constructing FastpixSDK. See Initialize the FastPix client.
How do I upload a video from C#?
Create media from a URL or upload from a device through sdk.InputVideo, for example await sdk.InputVideo.CreateMediaAsync(req). See Make your first API request and Available Resources and Operations.
How do I start a live stream in .NET? Use the Live API to create and manage streams, simulcasts, and live playback IDs. See Available Resources and Operations.
How do I create a secure playback ID? Generate playback IDs and manage signing keys and DRM configurations through the Media API resources. See Available Resources and Operations.
How do I get video analytics and metrics in C#? The Video Data API exposes metrics, views, dimensions, and errors for monitoring quality of experience. See Available Resources and Operations.
How do I handle API errors?
Catch FastpixException (the base class for all HTTP error responses); it exposes the request, response, status code, and body. See Error Handling.
How do I configure automatic retries?
Pass a RetryConfig per call or when constructing the SDK to control the backoff strategy. See Retries.
How do I use a custom HttpClient, proxy, or timeout?
Provide your own IFastpixHttpClient implementation (custom headers, handlers, timeouts, connection pooling) or use the built-in hooks. See Custom HTTP Client.
Which .NET versions are supported? The SDK targets .NET 8.0 and above. See Before you begin.
Is the SDK strongly typed? Yes - it is a strongly-typed client generated from the FastPix API specification, so requests and responses are fully typed. See Development.
FastPix publishes a server SDK for every major backend language, each generated from the same API specification:
| Language | Repo | Install |
|---|---|---|
| C# / .NET (this repo) | fastpix-sdk-csharp | dotnet add package Fastpix |
| Node.js / TypeScript | node-sdk | npm install @fastpix/fastpix-node |
| Python | fastpix-python | pip install fastpix-python |
| Go | fastpix-go | go get github.com/FastPix/fastpix-go |
| PHP | fastpix-php | composer require fastpix/sdk |
| Java | fastpix-java | io.fastpix:sdk (Maven/Gradle) |
| Ruby | fastpix-ruby | gem install fastpixapi |
The C# SDK manages media, live streams, and playback on the server. To upload and play that media in the browser, pair it with these FastPix client-side libraries:
- web-uploads-sdk - resumable, chunked file uploads from the browser (
@fastpix/resumable-uploads) - react-web-uploader - a drop-in React upload component (
@fastpix/fp-react-uploader) - web-player-component - the FastPix HLS video player web component (
@fastpix/fp-player)
Browse every SDK and tool in the FastPix organization.
This C# SDK is programmatically generated from our API specifications. Any manual modifications to internal files will be overwritten during subsequent generation cycles.
We value community contributions and feedback. Feel free to submit pull requests or open issues with your suggestions, and we'll do our best to include them in future releases.
For comprehensive understanding of each API's functionality, including detailed request and response specifications, parameter descriptions, and additional examples, please refer to the FastPix API Reference.
The API reference offers complete documentation for all available endpoints and features, enabling developers to integrate and leverage FastPix APIs effectively.
