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, type-safe 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 and above.
| Requirement | Version | Description |
|---|---|---|
| .NET SDK | 8.0+ |
Core runtime environment |
| NuGet | Latest |
Package manager for dependencies |
| Internet | Required |
API communication and authentication |
Pro Tip: We recommend using .NET 9+ 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 Fastpix Install-Package FastpixPM> Install-Package FastpixThis SDK supports both C# 8.0+ and .NET Framework 4.8+. Examples in this documentation use modern C# syntax as it's the preferred format, but you can use either approach.
// Basic imports
using Fastpix;
using Fastpix.Models.Components;// Legacy using statements
using Fastpix;
using Fastpix.Models.Components;Why Modern C#? Modern C# provides better type safety, nullable reference types, and are the current .NET standard. They enable better IntelliSense and development tooling support.
Note: This SDK automatically provides both framework support. If you encounter compatibility issues in your project, you may need to update your target framework to .NET 8.0 or higher.
Security Note: For production applications, it's recommended to make API calls from your backend server rather than directly from client applications to:
- Keep credentials secure
- Avoid CORS issues
- Implement proper authentication.
Initialize the FastPix SDK with your credentials:
using Fastpix;
using Fastpix.Models.Components;
var sdk = new FastPix(
security: new Security
{
Username = "your-access-token", // ⚠️ Replace with your actual FastPix username
Password = "secret-key", // ⚠️ Replace with your actual FastPix password
}
);Or using environment variables:
using Fastpix;
using Fastpix.Models.Components;
var sdk = new FastPix(
security: new Security
{
Username = Environment.GetEnvironmentVariable("FASTPIX_USERNAME"),
Password = Environment.GetEnvironmentVariable("FASTPIX_PASSWORD"),
}
);using Fastpix;
using Fastpix.Models.Components;
using System.Collections.Generic;
using Newtonsoft.Json;
var sdk = new FastPix(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.CreateVideoInput(
new VideoInput() {
Type = "video",
Url = "https://static.fastpix.io/sample.mp4",
}
),
},
Metadata = new Dictionary<string, string>() {
{ "key1", "value1" },
},
AccessPolicy = CreateMediaRequestAccessPolicy.Public,
};
var res = await sdk.Videos.CreateFromUrlAsync(req);
Console.WriteLine(JsonConvert.SerializeObject(res.CreateMediaSuccessResponse, Formatting.Indented) ?? "null");
// handle response
⚠️ IMPORTANT: Replace CredentialsYou MUST replace the placeholder credentials with your actual FastPix API credentials:
- Replace
"your-access-token"with your actual FastPix username/access token- Replace
"your-secret-key"with your actual FastPix password/secret keyUsing placeholder credentials will result in
UnauthorizedExceptionerrors.Get your credentials from the FastPix Dashboard or follow the Authentication Guide.
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
- Create Playback ID - Generate secure playback identifier
- Delete Playback ID - Remove playback access
- Get Playback ID - Retrieve playback configuration details
- Stream only a portion of a video by appending
start/endparameters to the playback URL. Explore: Play specific segments. For creating reusable assets instead, see Create clips from existing media. - Try it:
https://stream.fastpix.io/{PLAYBACK_ID}.m3u8?start=20&end=60(replace{PLAYBACK_ID}and tweak times).
- Create reusable, shareable clip assets from a source video with precise start/end control. Explore: Create clips from existing media.
- Try it: use the clipping API from the guide to generate a new clip asset, then retrieve it via Media Clips to validate.
- 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 with DVR mode support
- 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
- Explore instant live clipping during a live stream to capture key moments without creating new assets. See the Live Clipping guide: Instant Live Clipping.
- Try it: enable a test live stream and capture a highlight clip while broadcasting to see it appear instantly.
- 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
- 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
- Get Concurrent Viewers - Monitor real-time viewer counts over time
- Get Viewer Breakdown - Analyze viewers by device, location, and other dimensions
- List Dimensions - Get available data dimensions for filtering and analysis
- List Filter Values - Get specific values for a particular dimension
Transform and enhance your video content with powerful AI and editing capabilities.
- In-Video AI Features - AI-powered content enhancement
- Media Clips - Manage video clips and segments
- Live Clips - Get clips from live streams
- Subtitles - Generate automatic subtitles
- Media Tracks - Add audio and subtitle tracks
- Access Control - Control content permissions
- Format Support - Configure download capabilities
Handle and manage errors with comprehensive error handling capabilities and detailed error information for all API operations.
- List Errors - Retrieve comprehensive error logs and diagnostics
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 System.Collections.Generic;
var sdk = new FastPix(security: new Security() {
Username = "your-access-token",
Password = "secret-key",
});
CreateMediaRequest req = new CreateMediaRequest() {
Inputs = new List<Fastpix.Models.Components.Input>() {
Fastpix.Models.Components.Input.CreateVideoInput(
new VideoInput() {
Type = "video",
Url = "https://static.fastpix.io/sample.mp4",
}
),
},
Metadata = new Dictionary<string, string>() {
{ "key1", "value1" },
},
AccessPolicy = CreateMediaRequestAccessPolicy.Public,
};
var res = await sdk.Videos.CreateFromUrlAsync(
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 System.Collections.Generic;
var sdk = new FastPix(
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 = "secret-key",
}
);
CreateMediaRequest req = new CreateMediaRequest() {
Inputs = new List<Fastpix.Models.Components.Input>() {
Fastpix.Models.Components.Input.CreateVideoInput(
new VideoInput() {
Type = "video",
Url = "https://static.fastpix.io/sample.mp4",
}
),
},
Metadata = new Dictionary<string, string>() {
{ "key1", "value1" },
},
AccessPolicy = CreateMediaRequestAccessPolicy.Public,
};
var res = await sdk.Videos.CreateFromUrlAsync(req);
// handle responseFastPixException is the base 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 |
using Fastpix;
using Fastpix.Models.Components;
using Fastpix.Models.Errors;
using System.Collections.Generic;
var sdk = new FastPix(security: new Security() {
Username = "your-access-token",
Password = "secret-key",
});
try
{
CreateMediaRequest req = new CreateMediaRequest() {
Inputs = new List<Fastpix.Models.Components.Input>() {
Fastpix.Models.Components.Input.CreateVideoInput(
new VideoInput() {
Type = "video",
Url = "https://static.fastpix.io/sample.mp4",
}
),
},
Metadata = new Dictionary<string, string>() {
{ "key1", "value1" },
},
AccessPolicy = CreateMediaRequestAccessPolicy.Public,
};
var res = await sdk.Videos.CreateFromUrlAsync(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;
if (ex is BadRequestException badRequestEx) // different exceptions may be thrown depending on the method
{
// Check error data fields
BadRequestExceptionPayload payload = badRequestEx.Payload;
bool? Success = payload.Success;
BadRequestError? Error = payload.Error;
// ...
}
// An underlying cause may be provided
if (ex.InnerException != null)
{
Exception cause = ex.InnerException;
}
}
catch (OperationCanceledException ex)
{
// CancellationToken was cancelled
}
catch (System.Net.Http.HttpRequestException ex)
{
// Check ex.InnerException for Network connectivity errors
}Primary exceptions:
FastPixException: The base class for HTTP error responses.InvalidPermissionException: *ValidationErrorResponse: Status code422. *
Less common exceptions (24)
-
System.Net.Http.HttpRequestException: Network connectivity error. For more details about the underlying cause, inspect theex.InnerException. -
Inheriting from
FastPixException:ForbiddenException: Status code403. Applicable to 26 of 66 methods.*UnauthorizedException: Applicable to 24 of 66 methods.*MediaNotFoundException: Status code404. Applicable to 17 of 66 methods.*BadRequestException: Bad Request. Status code400. Applicable to 10 of 66 methods.*NotFoundError: Status code404. Applicable to 8 of 66 methods.*ViewNotFoundException: View Not Found. Status code404. Applicable to 7 of 66 methods.*LiveNotFoundError: Stream Not Found. Status code404. Applicable to 6 of 66 methods.*InvalidPlaylistIdResponseException: Payload Validation Failed. Status code422. Applicable to 6 of 66 methods.*UnAuthorizedResponseException: response for unauthorized request. Status code401. Applicable to 4 of 66 methods.*ForbiddenResponseException: response for forbidden request. Status code403. Applicable to 4 of 66 methods.*TrackDuplicateRequestException: Duplicate language name. Status code400. Applicable to 3 of 66 methods.*NotFoundErrorSimulcast: Stream/Simulcast Not Found. Status code404. Applicable to 3 of 66 methods.*MediaOrPlaybackNotFoundException: Status code404. Applicable to 2 of 66 methods.*NotFoundErrorPlaybackId: Status code404. Applicable to 2 of 66 methods.*SigningKeyNotFoundError: Bad Request. Status code404. Applicable to 2 of 66 methods.*DuplicateMp4SupportException: Mp4Support value already exists. Status code400. Applicable to 1 of 66 methods.*StreamAlreadyDisabledError: Stream already disabled. Status code400. Applicable to 1 of 66 methods.*TrialPlanRestrictionError: Bad Request – Stream is either already enabled or cannot be enabled on trial plan. Status code400. Applicable to 1 of 66 methods.*StreamAlreadyEnabledError: Bad Request – Stream is either already enabled or cannot be enabled on trial plan. Status code400. Applicable to 1 of 66 methods.*SimulcastUnavailableException: Simulcast is not available for trial streams. Status code400. Applicable to 1 of 66 methods.*MediaClipNotFoundException: media workspace relation not found. Status code404. Applicable to 1 of 66 methods.*DuplicateReferenceIdErrorResponse: Displays the result of the request. Status code409. Applicable to 1 of 66 methods.*ResponseValidationError: Thrown when the response data could not be deserialized into the expected type.
* Refer to the relevant documentation to determine whether an exception applies to a specific operation.
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 FastPix(
serverUrl: "https://api.fastpix.io/v1/",
security: new Security() {
Username = "your-access-token",
Password = "secret-key",
}
);
CreateMediaRequest req = new CreateMediaRequest() {
Inputs = new List<Fastpix.Models.Components.Input>() {
Fastpix.Models.Components.Input.CreateVideoInput(
new VideoInput() {
Type = "video",
Url = "https://static.fastpix.io/sample.mp4",
}
),
},
Metadata = new Dictionary<string, string>() {
{ "key1", "value1" },
},
AccessPolicy = CreateMediaRequestAccessPolicy.Public,
};
var res = await sdk.Videos.CreateFromUrlAsync(req);
// handle responseThis 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.