> For the complete documentation index, see [llms.txt](https://docs.patchmypc.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk.md). Agents can also search and read this documentation through its [MCP server](https://docs.patchmypc.com/~gitbook/mcp).

# .NET SDK

Use the .NET SDK to call the Patch My PC Cloud Customer API from your own applications and automation.

[Back to the Cloud Customer API overview](https://docs.patchmypc.com/patch-my-pc-cloud-api)

The .NET SDK is a client library for the Patch My PC Cloud Customer API. It authenticates with a personal access token, keeps track of the company and connection you're working with, uploads installer files in parallel chunks, and returns every outcome as a result object instead of throwing exceptions. Everything the SDK exposes is on one interface, `IPmpcCloudClient`.

Use the SDK when you're building a .NET application or service. If you're scripting, the PowerShell module wraps the same interface with one cmdlet per method. If you're working from another language, call the REST API directly.

## Supported frameworks

The NuGet package `PatchMyPC.Cloud` targets:

| Target framework | Use it for                       |
| ---------------- | -------------------------------- |
| `net8.0`         | Applications that run on .NET 8  |
| `net10.0`        | Applications that run on .NET 10 |

The SDK authenticates with a personal access token (PAT), so it needs no user at the keyboard and suits services, scheduled jobs, and pipelines. You create the PAT in the Patch My PC portal. For details, see [Create a personal access token](https://docs.patchmypc.com/patch-my-pc-cloud-api/create-a-personal-access-token.md) and [Authentication](https://docs.patchmypc.com/patch-my-pc-cloud-api/authentication.md).

## Quick start

1. Add the package to your project. It's published on nuget.org:

   ```bash
   dotnet add package PatchMyPC.Cloud
   ```
2. Set your account's region, `Us`, `Eu`, or `Uk`, in the `PmpcCloudSdkConfig` configuration section, for example with the environment variable `PmpcCloudSdkConfig__Region=Us`.
3. Register the SDK, authenticate with your personal access token, and make a call:

   ```csharp
   using Microsoft.Extensions.DependencyInjection;
   using Microsoft.Extensions.Hosting;
   using PatchMyPC.Cloud.Client;
   using PatchMyPC.Cloud.Extensions;
   using PatchMyPC.Cloud.Services;

   var builder = Host.CreateApplicationBuilder(args);
   builder.Services.AddPmpcCloudSdk();
   using var host = builder.Build();

   using var scope = host.Services.CreateScope();
   var client = scope.ServiceProvider.GetRequiredService<IPmpcCloudClient>();

   var pat = Environment.GetEnvironmentVariable("PMPC_PAT")
       ?? throw new InvalidOperationException("Set PMPC_PAT to a personal access token.");

   var session = await client.AuthenticateWithPersonalAccessTokenAsync(pat);
   if (session.IsFailure)
   {
       Console.WriteLine($"Authentication failed: {session.Error.Code} {session.Error.Message}");
       return;
   }

   var search = await client.SearchApplicationsAsync(new ProductFilterRequest { DisplayNameSearchString = "Contoso" });
   if (search.IsSuccess)
   {
       foreach (var product in search.Value.Products)
       {
           Console.WriteLine($"{product.ProductId} {product.DisplayName} {product.Version}");
       }
   }
   ```

For configuration options and a complete console example, see [Install and configure the SDK](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/install-and-configure.md).

## Method index

### Authentication

| Method                                                                                                                                                        | Description                                                         |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
| [`AuthenticateWithPersonalAccessTokenAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/authentication.md#authenticatewithpersonalaccesstokenasync) | Authenticates with a personal access token and selects its company. |
| [`GetSelectedCompany`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/authentication.md#getselectedcompany)                                             | Returns the company the session works with.                         |
| [`ClearAuthenticationAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/authentication.md#clearauthenticationasync)                                 | Signs out and clears the session's company.                         |
| [`IsServiceHealthyAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/authentication.md#isservicehealthyasync)                                       | Checks whether the Cloud Customer API is reachable.                 |

### Customer information and connections

| Method                                                                                                                                          | Description                                                   |
| ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
| [`GetCustomerInfoAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/customer-and-connections.md#getcustomerinfoasync)                 | Gets your account information and usage limits.               |
| [`GetAvailableConnectionsAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/customer-and-connections.md#getavailableconnectionsasync) | Lists the connections for your company.                       |
| [`SetSelectedConnectionAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/customer-and-connections.md#setselectedconnectionasync)     | Selects the connection that deployment and catalog calls use. |
| [`GetSelectedConnection`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/customer-and-connections.md#getselectedconnection)               | Returns the currently selected connection.                    |

### Applications

| Method                                                                                                                                      | Description                                                     |
| ------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| [`SearchApplicationsAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/applications.md#searchapplicationsasync)                   | Searches your applications with filters, sorting, and paging.   |
| [`GetApplicationDetailsAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/applications.md#getapplicationdetailsasync)             | Gets the details of one of your applications.                   |
| [`CreateApplicationAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/applications.md#createapplicationasync)                     | Uploads installer files and creates a new application.          |
| [`UpdateApplicationAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/applications.md#updateapplicationasync)                     | Uploads a new version of an existing application.               |
| [`EditApplicationAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/applications.md#editapplicationasync)                         | Corrects the metadata or files of the current version in place. |
| [`GetApplicationFilesAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/applications.md#getapplicationfilesasync)                 | Lists the files in an application's current version.            |
| [`SearchPublicApplicationsAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/applications.md#searchpublicapplicationsasync)       | Searches the Patch My PC public catalog.                        |
| [`GetPublicApplicationDetailsAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/applications.md#getpublicapplicationdetailsasync) | Gets the details of a public catalog application.               |

### Custom applications

| Method                                                                                                                                             | Description                                               |
| -------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- |
| [`SearchCustomApplicationsAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/custom-applications.md#searchcustomapplicationsasync)       | Searches your custom applications.                        |
| [`GetCustomApplicationDetailsAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/custom-applications.md#getcustomapplicationdetailsasync) | Gets the details of a custom application.                 |
| [`CreateCustomApplicationAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/custom-applications.md#createcustomapplicationasync)         | Uploads installer files and creates a custom application. |
| [`UpdateCustomApplicationAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/custom-applications.md#updatecustomapplicationasync)         | Uploads a new version of a custom application.            |
| [`EditCustomApplicationAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/custom-applications.md#editcustomapplicationasync)             | Corrects a custom application's current version in place. |
| [`DeleteApplicationAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/custom-applications.md#deleteapplicationasync)                     | Deletes one of your custom applications.                  |
| [`DeleteCustomApplicationAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/custom-applications.md#deletecustomapplicationasync)         | Deletes one of your custom applications.                  |

### Deployments

| Method                                                                                                                                                 | Description                                                    |
| ------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------- |
| [`GetDeploymentsAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/deployments.md#getdeploymentsasync)                                       | Lists an application's deployments on the selected connection. |
| [`GetDeploymentDetailsAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/deployments.md#getdeploymentdetailsasync)                           | Gets the full detail of one deployment.                        |
| [`GetDeploymentDependencyCandidatesAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/deployments.md#getdeploymentdependencycandidatesasync) | Lists deployments that can be used as dependencies.            |
| [`CreateDeploymentAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/deployments.md#createdeploymentasync)                                   | Creates a deployment for an application.                       |
| [`EditDeploymentAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/deployments.md#editdeploymentasync)                                       | Changes selected settings on an existing deployment.           |
| [`DeleteDeploymentAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/deployments.md#deletedeploymentasync)                                   | Deletes a deployment.                                          |
| [`RedeployDeploymentAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/deployments.md#redeploydeploymentasync)                               | Recreates a deployment from scratch.                           |
| [`SyncDeploymentAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/deployments.md#syncdeploymentasync)                                       | Moves a deployment to its latest pending version.              |
| [`SetDeploymentSyncPauseStatusAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/deployments.md#setdeploymentsyncpausestatusasync)           | Pauses or resumes a deployment's scheduled sync.               |

### Deployment templates

| Method                                                                                                                                        | Description                                                |
| --------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
| [`GetDeploymentTemplatesAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/deployment-templates.md#getdeploymenttemplatesasync)     | Lists the deployment templates on the selected connection. |
| [`GetDeploymentTemplateAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/deployment-templates.md#getdeploymenttemplateasync)       | Gets the settings stored in a deployment template.         |
| [`CreateDeploymentTemplateAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/deployment-templates.md#createdeploymenttemplateasync) | Creates a deployment template.                             |
| [`UpdateDeploymentTemplateAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/deployment-templates.md#updatedeploymenttemplateasync) | Replaces the settings of a deployment template.            |
| [`DeleteDeploymentTemplateAsync`](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/deployment-templates.md#deletedeploymenttemplateasync) | Deletes a deployment template.                             |

## Related pages

{% content-ref url="/pages/PbFA7UldtLi5AuJlqwUF" %}
[Install and configure the SDK](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/install-and-configure.md)
{% endcontent-ref %}

{% content-ref url="/pages/EB4GlnbvMK19TzkkbX8T" %}
[Results and errors](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/results-and-errors.md)
{% endcontent-ref %}

{% content-ref url="/pages/KbtoHgBjRG4iAAiu7x7n" %}
[Authentication](https://docs.patchmypc.com/patch-my-pc-cloud-api/authentication.md)
{% endcontent-ref %}

{% content-ref url="/pages/4srR3a0tsKJ9ylflxojw" %}
[Cross-reference: cmdlets, SDK methods, and REST operations](https://docs.patchmypc.com/patch-my-pc-cloud-api/cross-reference.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
