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

# Authentication

Reference for the Authentication operations of the Patch My PC Cloud Customer API, with parameters, request and response schemas, and examples.

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

Operations that exchange a personal access token for an access token. For the base URL, authentication, rate limits, and errors that apply to every operation, see [REST API reference](https://docs.patchmypc.com/patch-my-pc-cloud-api/rest-api.md).

The examples use the US host, `https://us.portal.patchmypc.com`. If your Patch My PC account is in the EU region, use `https://eu.portal.patchmypc.com` instead.

Each operation lists the scope a personal access token (PAT) needs to call it.

## Exchange a personal access token for an access token

Exchanges a personal access token, supplied in the `Authorization` header as a bearer credential, for an access token that's valid for 60 minutes. Send the access token on subsequent requests, and exchange the personal access token again when the access token expires.

Operation ID: `ExchangePatForToken`

{% code collapsedlinecount="10" %}

```http
POST /v1/api/auth/token
```

{% endcode %}

**Authentication:** None. Send the PAT itself in the `Authorization` header.

**Responses**

| Status | Description           | Body                                              |
| ------ | --------------------- | ------------------------------------------------- |
| `200`  | OK                    | [`TokenExchangeResponse`](#tokenexchangeresponse) |
| `400`  | Bad Request           | string                                            |
| `401`  | Unauthorized          | None                                              |
| `403`  | Forbidden             | None                                              |
| `500`  | Internal Server Error | None                                              |

**Example request**

{% code collapsedlinecount="10" %}

```bash
curl -X POST "https://us.portal.patchmypc.com/v1/api/auth/token" \
  -H "Authorization: Bearer {personal-access-token}"
```

{% endcode %}

## Schemas

The types used by the operations on this page. Property names are case-sensitive in responses and case-insensitive in requests.

### TokenExchangeResponse

| Name         | Type            | Required | Description                                                                                                                                  |
| ------------ | --------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `gatewayJwt` | string          | No       | A short-lived access token. Send it as a bearer token in the `Authorization` header of subsequent API calls until it expires. Can be `null`. |
| `expiresIn`  | integer (int32) | No       | Number of seconds until the access token in `gatewayJwt` expires. Exchange your personal access token again to get a new access token.       |


---

# 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/rest-api/authentication.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.
