> 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.probe.splx.ai/platform-api/authentication.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
