> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://fastpix.com/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://fastpix.com/docs/_mcp/server.

# FastPix C# SDK

The FastPix C# SDK is a strongly typed .NET client for the FastPix video API. From any .NET 8 application you can upload and manage videos, run live streams and simulcasts, create and secure playback IDs, manage playlists and signing keys, pull video analytics, and use in-video AI features. It works with ASP.NET Core, console, and worker apps.

\


> **Find more in the SDK reference**
>
> For all methods, runnable examples, and advanced usage, see the [FastPix C# SDK](https://github.com/FastPix/fastpix-sdk-csharp) on GitHub.

\


## Before you begin

Make sure you have:

* .NET 8.0 or later
* The .NET CLI
* Internet access
* A FastPix account
* A FastPix Access Token and Secret Key, generated from the [FastPix Dashboard](https://dashboard.fastpix.com). See [Activate your account](/getting-started/activate-your-account).

FastPix uses HTTP Basic Authentication. The SDK maps your credentials as follows:

| SDK property | FastPix credential |
| ------------ | ------------------ |
| `Username`   | Access Token       |
| `Password`   | Secret Key         |

> **Security:** Never commit your Access Token or Secret Key to source control. Use environment variables or a secure credential-management system.

Follow the steps below in order, and do not skip the verification steps. If the SDK does not install, the project does not build, or authentication fails, resolve that issue before making an API request.

\


## Check your .NET version

```bash
dotnet --version
```

The output must be 8.0 or later, for example `8.0.414`. You can also list the installed SDKs:

```bash
dotnet --list-sdks
```

If .NET 8 or later is not installed, install a supported .NET SDK before continuing.

\


## Create a .NET project

Create a new console application:

```bash
mkdir fastpix-csharp-demo
cd fastpix-csharp-demo
dotnet new console
```

Verify that the project builds before installing the SDK:

```bash
dotnet build
```

You should see `Build succeeded`. If the build fails, resolve the .NET project issue before continuing.

\


## Install the FastPix SDK

Install the FastPix SDK from NuGet:

```bash
dotnet add package Fastpix
```

The SDK is added to your project as a NuGet dependency. Confirm the package:

```bash
dotnet list package
```

You should see an entry for `Fastpix` and the installed version.

\


## Verify the SDK installation

Confirm that your application can import and initialize the SDK. Replace the contents of `Program.cs` with:

```csharp
using Fastpix;
using Fastpix.Models.Components;

var sdk = new FastpixSDK(
    security: new Security
    {
        Username = "test",
        Password = "test"
    }
);

Console.WriteLine("FastPix SDK initialized successfully");
```

Run it:

```bash
dotnet run
```

The expected output is `FastPix SDK initialized successfully`. This verifies that .NET is installed, the project builds, the `Fastpix` package is installed, the namespaces are available, and the `FastpixSDK` client can be initialized. The placeholder credentials mean this does not make an API request.

\


## Configure authentication

FastPix uses HTTP Basic Authentication, where `Username` is your Access Token and `Password` is your Secret Key. For local development, set these as environment variables so they stay out of your source code:

```bash
# macOS and Linux
export FASTPIX_USERNAME="<YOUR_ACCESS_TOKEN>"
export FASTPIX_PASSWORD="<YOUR_SECRET_KEY>"
```

```powershell
# Windows PowerShell
$env:FASTPIX_USERNAME="<YOUR_ACCESS_TOKEN>"
$env:FASTPIX_PASSWORD="<YOUR_SECRET_KEY>"
```

\


## Verify that your credentials are set

Check that both variables are set without printing their values:

```bash
# macOS and Linux
test -n "$FASTPIX_USERNAME" && echo "FASTPIX_USERNAME is set"
test -n "$FASTPIX_PASSWORD" && echo "FASTPIX_PASSWORD is set"
```

Both should report as set. If either is missing, set the corresponding environment variable before continuing.

\


## Initialize the FastPix client

Update `Program.cs` to read the credentials from the environment:

```csharp
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 it:

```bash
dotnet run
```

The expected output is `FastPix client initialized successfully`. Initializing the SDK does not make an API request. The SDK contacts the FastPix API only when you call an operation such as `CreateMediaAsync`.

\


## Make your first API request

The simplest way to verify the integration is to create a media asset from a publicly accessible video URL. FastPix provides a sample video at `https://static.fastpix.com/fp-sample-video.mp4`.

Replace `Program.cs` with:

```csharp
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(
        JsonSerializer.Serialize(
            response,
            new JsonSerializerOptions
            {
                WriteIndented = true
            }
        )
    );
}
catch (Exception ex)
{
    Console.Error.WriteLine("FastPix API request failed.");
    Console.Error.WriteLine(ex.Message);
}
```

Run it:

```bash
dotnet run
```

A successful request returns information about the newly created media asset, similar to:

```json
{
  "success": true,
  "data": {
    "id": "..."
  }
}
```

The exact fields depend on the API response and the installed SDK version.

\


## Capture the media ID

The create-media response contains the unique ID assigned to the media asset, at `data.id`:

```json
{
  "success": true,
  "data": {
    "id": "12345678-1234-1234-1234-123456789abc"
  }
}
```

Save this value for later operations:

```text
MEDIA_ID=<value returned in data.id>
```

A `media_id` is not the same as a `playback_id`. They identify different resources and are used for different operations.

\


## Verify the integration

A successful create-media request confirms that .NET is installed and supported, the project builds, the `Fastpix` package is installed, your credentials are configured, the client can authenticate, and FastPix returns a media ID.

Creating media is usually the first step in a FastPix on-demand workflow: you create the media, wait until processing finishes, then create a playback ID to play it. The initial SDK integration is now complete.

\


## Resources, error handling, and reference

The SDK is generated from the FastPix API specification, so the complete and always-current reference lives in the repo and the API docs:

* **All resources, operations, error handling, retries, server selection, and custom HTTP clients**: the [FastPix C# SDK on GitHub](https://github.com/FastPix/fastpix-sdk-csharp), with runnable code in the [examples](https://github.com/FastPix/fastpix-sdk-csharp/tree/main/examples) directory.
* **Media** (upload, manage, playback, playlists, signing keys, DRM): [Video on Demand API](https://fastpix.com/docs/video-on-demand-api/overview).
* **Live** (streams, simulcasts, live playback): [Live Stream API](https://fastpix.com/docs/live-stream-api/overview).
* **Video Data** (metrics, views, dimensions, errors): [Video Data API](https://fastpix.com/docs/video-data-api/overview).
* **In-video AI** (summaries, chapters, named entities, moderation): [In-Video AI](/in-video-ai/overview).

\


#### Frequently asked questions

The SDK is a strongly typed .NET wrapper around the same FastPix REST API. It handles authentication, request serialization, and response parsing for you, so you call methods like `await sdk.InputVideo.CreateMediaAsync(req)` instead of building raw HTTP requests. Anything the SDK does, you can also do by calling the REST API directly. See [Make your first API request](#make-your-first-api-request).

Add the NuGet package with `dotnet add package Fastpix`, or `Install-Package Fastpix` in the Visual Studio Package Manager Console. See [Install the FastPix SDK](#install-the-fastpix-sdk).

FastPix uses HTTP Basic Authentication. Pass your Access Token as the `Username` and your Secret Key as the `Password` in `Security` when constructing `FastpixSDK`. See [Initialize the FastPix client](#initialize-the-fastpix-client).

Create media from a URL or a direct upload through the input-video resource on the client, for example `await sdk.InputVideo.CreateMediaAsync(req)`. See [Make your first API request](#make-your-first-api-request).

FastPix uploads are not limited by your .NET process memory. When you pull from a URL, FastPix fetches the file directly, and when you upload from a device, the SDK gives you a signed URL that the file goes to directly, so the bytes never pass through your .NET application. Large multi-gigabyte files upload without extra configuration. See the [Video on Demand API](https://fastpix.com/docs/video-on-demand-api/overview).

Use the Live API resources to create and manage streams, simulcasts, and live playback IDs. See the [SDK reference on GitHub](https://github.com/FastPix/fastpix-sdk-csharp) and the [Live Stream API](https://fastpix.com/docs/live-stream-api/overview).

Generate playback IDs and manage signing keys and DRM configurations through the Media API resources. See the [SDK reference on GitHub](https://github.com/FastPix/fastpix-sdk-csharp) and the [Video on Demand API](https://fastpix.com/docs/video-on-demand-api/overview).

Create the media with a private access policy, then generate a signed playback ID so only holders of a valid token can play it. For stronger protection, enable DRM on the playback ID. You revoke access by deleting the playback ID. Handle all of this through the Media API resources. See the [Video on Demand API](https://fastpix.com/docs/video-on-demand-api/overview).

The Video Data API exposes metrics, views, dimensions, and errors for quality-of-experience monitoring. See the [Video Data API](https://fastpix.com/docs/video-data-api/overview).

Catch `FastpixException`, the base class for HTTP error responses, which exposes the request, response, status code, and body. See the [SDK reference on GitHub](https://github.com/FastPix/fastpix-sdk-csharp) for the error types each operation can throw.

Pass a `RetryConfig` per call or when constructing the SDK to control the backoff strategy. See the [SDK reference on GitHub](https://github.com/FastPix/fastpix-sdk-csharp).

Provide your own `IFastpixHttpClient` implementation, with custom headers, message handlers, timeouts, or connection pooling, or use the SDK's built-in request hooks. See the [SDK reference on GitHub](https://github.com/FastPix/fastpix-sdk-csharp).

.NET 8.0 and later. See [Before you begin](#before-you-begin).

\


## What's next

Want to go further? Browse runnable, end-to-end samples for the FastPix C# SDK in the [examples folder](https://github.com/FastPix/fastpix-sdk-csharp/tree/main/examples) of the GitHub repository.

\


## Release notes

For a complete history of releases, improvements, and fixes, see the [FastPix C# SDK CHANGELOG on GitHub](https://github.com/FastPix/fastpix-sdk-csharp/blob/main/CHANGELOG.md).