> For the complete documentation index, see [llms.txt](https://docs.userlane.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.userlane.com/developers/subresource-integrity/getting-started-with-subresource-integrity.md). Agents can also search and read this documentation through its [MCP server](https://docs.userlane.com/~gitbook/mcp).

# Getting started with Subresource Integrity

Userlane supports [Subresource Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) (SRI) for userlane.js. With SRI, the browser only runs userlane.js if the file matches a cryptographic hash, so a modified file is never executed. Your application fetches the current file name and hash from the endpoint below, then loads userlane.js with them.

## What you get

* **`entryPoint`**: a uniquely named copy of userlane.js, for example `userlane.15d738.js`. It gives your application the latest version of userlane.js while still letting the browser check that the file is authentic.
* **`integrity`**: the hash of that file. It stays the same as long as the file does not change, which is how the browser checks that it received the same file.

## Fetch the current integrity value

`GET https://api.userlane.com/integrity/artifacts/main`

The endpoint needs no authentication and takes no parameters.

```bash
curl https://api.userlane.com/integrity/artifacts/main
```

Example response:

```json
{
  "entryPoint": "userlane.15d738.js",
  "integrity": "sha512-hLNayK35gUaWSrwOkUU/F1+XlNnP+ZQi2irN7jZuBOJSEgTd3m5onKEFuPAgYh2xLgb2R6MRBB5lZBtSPkqrKA=="
}
```

If no integrity value is available, the endpoint returns `404`.

{% hint style="warning" %}
Do not cache the response. The value changes whenever Userlane deploys a new version of userlane.js, so fetch it every time your application loads userlane.js.
{% endhint %}

## Load userlane.js with the integrity value

Use both values in the script tag that loads userlane.js:

```html
<script src="https://secure.userlane.com/userlane.15d738.js" integrity="sha512-hLNayK35gUaWSrwOkUU/F1+XlNnP+ZQi2irN7jZuBOJSEgTd3m5onKEFuPAgYh2xLgb2R6MRBB5lZBtSPkqrKA=="></script>
```

Replace the file name and hash with the values from the response.


---

# 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.userlane.com/developers/subresource-integrity/getting-started-with-subresource-integrity.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.
