A robust, type-safe C# SDK designed for seamless integration with the FastPix API platform.
The FastPix C# SDK simplifies integration with the FastPix platform. It provides a clean, strongly-typed interface for secure and efficient communication with the FastPix API, enabling easy management of media uploads, live streaming, on‑demand content, playlists, video analytics, and signing keys for secure access and token management. It is intended for use with .NET 8.0 and above.
| 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.
To get started with the FastPix C# SDK, ensure you have the following:
- The FastPix APIs are authenticated using a Username and a Password. You must generate these credentials to use the SDK.
- Follow the steps in the Authentication with Basic Auth guide to obtain your credentials.
Configure your FastPix credentials using environment variables for enhanced security and convenience:
# Set your FastPix credentials
export FASTPIX_USERNAME="your-access-token"
export FASTPIX_PASSWORD="your-secret-key"Security Note: Never commit your credentials to version control. Use environment variables or secure credential management systems.
Install the FastPix C# SDK using your preferred package manager:
dotnet add package FastpixIn Visual Studio, open the Package Manager Console and run:
Install-Package FastpixTo add a reference to a local instance of the SDK in a .NET project:
dotnet add reference src/Fastpix/Fastpix.csprojThe SDK uses standard C# namespaces. Import the necessary namespaces at the top of your files:
using Fastpix;
using Fastpix.Models.Components;
using Fastpix.Models.Requests;
using System.Collections.Generic;Initialize the FastPix SDK with your credentials:
using Fastpix;
using Fastpix.Models.Components;
var sdk = new FastpixSDK(security: new Security() {
Username = "your-access-token",
Password = "your-secret-key",
});Or using environment variables:
using Fastpix;
using Fastpix.Models.Components;
using System;
var sdk = new FastpixSDK(security: new Security() {
Username = Environment.GetEnvironmentVariable("FASTPIX_USERNAME"), // Your Access Token
Password = Environment.GetEnvironmentVariable("FASTPIX_PASSWORD"), // Your Secret Key
});using Fastpix;
using Fastpix.Models.Components;
using System.Collections.Generic;
var sdk = new FastpixSDK(security: new Security() {
Username = "your-access-token",
Password = "your-secret-key",
});
var 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 responseComprehensive 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
- 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.
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.