> 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/errors.md). Agents can also search and read this documentation through its [MCP server](https://docs.patchmypc.com/~gitbook/mcp).

# Errors

HTTP status codes, problem details responses, and SDK and PowerShell module error codes returned by the Patch My PC Cloud Customer API.

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

The Patch My PC Cloud Customer API uses standard HTTP status codes. The .NET SDK and PowerShell module translate each failure into a stable error code that you can branch on in code and scripts.

## Status codes

| Status                      | Meaning                                                                                                                                      | Retry?                                                                                                                     |
| --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `400 Bad Request`           | The request is invalid—for example a missing field, an invalid value, or a request that conflicts with the application's current state       | No. Fix the request.                                                                                                       |
| `401 Unauthorized`          | Authentication is missing, expired, or was rejected                                                                                          | After you exchange your personal access token (PAT) again                                                                  |
| `403 Forbidden`             | The request wasn't authorized. Common causes include missing account permissions or PAT scopes, or an operation unavailable for the account. | No. See [Forbidden responses](#understand-forbidden-responses).                                                            |
| `404 Not Found`             | The application, deployment, or other resource doesn't exist in your account                                                                 | No                                                                                                                         |
| `429 Too Many Requests`     | You exceeded a rate limit                                                                                                                    | Yes, after the `Retry-After` interval. See [Rate limits](https://docs.patchmypc.com/patch-my-pc-cloud-api/rate-limits.md). |
| `500 Internal Server Error` | An unexpected failure occurred                                                                                                               | Yes, with backoff                                                                                                          |
| `504 Gateway Timeout`       | The request took too long to complete                                                                                                        | Yes, with backoff. For searches, request fewer results at a time.                                                          |

## Request problem details

By default, error bodies are kept simple for compatibility with existing clients: a `400` or `404` response returns a plain string that explains the problem, and most `401` and `403` responses have no body.

To receive structured errors, send `application/problem+json` in the `Accept` header. Error responses then use the problem details format ([RFC 9457](https://www.rfc-editor.org/rfc/rfc9457)):

{% code collapsedlinecount="10" %}

```http
GET https://us.portal.patchmypc.com/v1/api/apps/{product-id}
Authorization: Bearer {access-token}
Accept: application/json, application/problem+json
```

{% endcode %}

The REST examples on this page use the US host. Use `https://eu.portal.patchmypc.com` for EU accounts or `https://uk.portal.patchmypc.com` for UK accounts.

{% code collapsedlinecount="10" %}

```json
{
  "title": "not_found",
  "status": 404,
  "detail": "{explanation}"
}
```

{% endcode %}

| Member        | Description                                                                                 |
| ------------- | ------------------------------------------------------------------------------------------- |
| `title`       | A stable, machine-readable code in lowercase with underscores. Branch on this value.        |
| `status`      | The HTTP status code                                                                        |
| `detail`      | A human-readable explanation. Don't parse it—the wording can change.                        |
| Other members | Structured context for specific errors, for example `retryAfterSeconds` on a `429` response |

Rate-limit (`429`) and insufficient-scope (`403`) responses always use the problem details format, whether or not you ask for it.

The SDK requests problem details for you.

## Understand forbidden responses

Common causes of a `403 Forbidden` response are missing account permissions, a PAT without the required scope, or an operation unavailable for the account. With problem details, the `title` distinguishes these cases.

| `title`               | Cause                                                                                                          | What to do                                                                                                                                 |
| --------------------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `forbidden`           | Your account doesn't have the permission the operation needs                                                   | Ask your administrator about the permission                                                                                                |
| `insufficient_scope`  | The PAT doesn't include the scope the operation needs. The response lists `requiredScope` and `grantedScopes`. | Create a new PAT with the required scope. See [Authentication](https://docs.patchmypc.com/patch-my-pc-cloud-api/authentication.md#scopes). |
| `feature_not_enabled` | The operation is unavailable for this account                                                                  | Contact Patch My PC support                                                                                                                |

Retrying a `403` response doesn't help. Resolve the authorization issue or contact support if the operation is unavailable.

## Error codes in the SDK and PowerShell module

SDK methods return a result instead of throwing. When `IsFailure` is `true`, `Error.Code` holds one of the codes below. The constants are defined on `PmpcCloudErrorCodes`. The PowerShell module writes a non-terminating error record whose error ID is the same code.

| HTTP status and problem title             | Error code               | `PmpcCloudErrorCodes` constant |
| ----------------------------------------- | ------------------------ | ------------------------------ |
| `400` `validation_error`                  | `VALIDATION_ERROR`       | `ValidationError`              |
| `401` `unauthorized`                      | `AUTH_ERROR`             | `AuthenticationFailed`         |
| `403` `forbidden` or `insufficient_scope` | `AUTHZ_ERROR`            | `AuthorizationFailed`          |
| `403` `feature_not_enabled`               | `FEATURE_NOT_ENABLED`    | `FeatureNotEnabled`            |
| `404` `not_found`                         | `NOT_FOUND`              | `NotFound`                     |
| `409` `conflict`                          | `CONFLICT`               | `Conflict`                     |
| `429` `rate_limit_exceeded`               | `RATE_LIMITED`           | `RateLimited`                  |
| `5xx` `internal_error`                    | `UNEXPECTED_ERROR`       | `UnexpectedError`              |
| `429` from the PAT exchange               | `PAT_EXCHANGE_THROTTLED` | `PatExchangeThrottled`         |
| `403` from the PAT exchange               | `PAT_NOT_ENTITLED`       | `PatExchangeNotEntitled`       |
| None—you canceled the operation           | `OPERATION_CANCELLED`    | `OperationCancelled`           |

The SDK can also report `NETWORK_ERROR` when it can't reach the service and `CONFIG_ERROR` when its configuration is incomplete.

For `RATE_LIMITED`, and for `PAT_EXCHANGE_THROTTLED` when the service sends a retry interval, `Error.Metadata` carries `retryAfterSeconds` so you can wait exactly as long as the service asks. In the PowerShell module, a rate-limit error has the category `LimitsExceeded`.

{% tabs %}
{% tab title="REST" %}
{% code collapsedlinecount="10" %}

```http
POST https://us.portal.patchmypc.com/v1/api/apps/search
Authorization: Bearer {access-token}
Content-Type: application/json
Accept: application/json, application/problem+json

{ "displayNameSearchString": "{display-name}" }
```

{% endcode %}

Check the status code first. For a failure, read `title` from the problem details body.
{% endtab %}

{% tab title="C#" %}
{% code title="Program.cs" collapsedlinecount="10" %}

```csharp
using PatchMyPC.Cloud.Constants;

var result = await client.GetCustomerInfoAsync();
if (result.IsFailure)
{
    switch (result.Error.Code)
    {
        case PmpcCloudErrorCodes.RateLimited:
            result.Error.Metadata.TryGetValue("retryAfterSeconds", out var retryAfter);
            Console.WriteLine($"Rate limited. Retry after {retryAfter ?? 60} seconds.");
            break;
        default:
            Console.WriteLine($"{result.Error.Code}: {result.Error.Message}");
            break;
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="PowerShell" %}
{% code collapsedlinecount="10" %}

```powershell
Get-PmpcCustomerInfo -ErrorAction SilentlyContinue -ErrorVariable failures
foreach ($failure in $failures) {
    switch ($failure.FullyQualifiedErrorId.Split(',')[0]) {
        'RATE_LIMITED'        { 'Rate limited. Wait and try again.' }
        default               { $failure.Exception.Message }
    }
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Related pages

* [Results and errors](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/results-and-errors.md)
* [Rate limits](https://docs.patchmypc.com/patch-my-pc-cloud-api/rate-limits.md)
* [Authentication](https://docs.patchmypc.com/patch-my-pc-cloud-api/authentication.md)


---

# 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/errors.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.
