> For the complete documentation index, see [llms.txt](https://docs.probe.splx.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.probe.splx.ai/platform-api/authentication.md).

# Authentication

To learn how to obtain your personal access token, refer to the [**Access Token Generation**](/settings/platform-settings/user-settings/personal-access-tokens.md#access-token-generation) section in the documentation.

All users, including those with free accounts, [must generate a Personal Access Token (PAT)](/settings/platform-settings/user-settings/personal-access-tokens.md) to authenticate with the Platform API.

## Using the Personal Access Token

Once you've obtained your personal access token, include it in the header of your request as a value of a "**X-Api-Key**" key:

```
X-Api-Key = "<PAT>"
```

**Example Request:**

```bash
curl -L \
  --request POST \
  --url '/api/v2/test-run/trigger' \  
  --header 'X-Api-Key: YOUR_API_KEY' \  # Replace YOUR_API_KEY with your personal access token
  --header 'Content-Type: application/json-patch+json' \  
  --data '{"targetId":1,"probeIds":[1,2,3],"name":"SPLX Test Run"}'  
```

## Response to Unauthorized Access

If the Authorization header is not provided, or if an invalid token is used, the API will return a 401 Unauthorized error. This response indicates that authentication is required to access the requested resource.

**Example Response:**

```json
{
  "error": {
    "message": "Unauthorized: Authentication is required to access this resource.",
    "code": "UNAUTHORIZED"
  }
}
```

{% hint style="warning" %}

* **Ensure your token is kept secure**: Your personal access token provides access to your API resources. Do not share or expose your token publicly.
* **Token Expiry**: Personal access tokens may have an expiration date based on the configuration set during their creation. Make sure to regenerate your token if needed.
  {% endhint %}


---

# 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.probe.splx.ai/platform-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.
