> For the complete documentation index, see [llms.txt](https://docs.licensespring.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.licensespring.com/license-api/license-api-authorization/response-signature-v2.md).

# Response Signature v2

### Overview

Response objects from License API endpoints contain an HTTP header `LicenseSignature` which is an HMAC-SHA256 signature used to verify the integrity and authenticity of the response. This is not the same as the `license_signature` in certain response objects (see [**Response Signature**](/license-api/license-api-authorization/response-signature.md) for that property).

The `LicenseSignature` header signs the entire response object using our private key, which enables you to use our public key to verify the signature.

### Verifying Response Signature v2

You can use the server's public key to verify the `LicenseSignature` header. By validating the signature, you ensure the response originates from LicenseSpring's trusted servers.

Download the server public key from below to implement signature verification using the example provided:

{% file src="/files/xJMFdFtJYBbfnD7KR8VS" %}

### Code Sample

{% code title="verify-response-signature.js" %}

```javascript
import crypto from 'node:crypto'
import dayjs from 'dayjs'
import utc from 'dayjs/plugin/utc.js'

dayjs.extend(utc)

// Header and response received from our servers:
const responseLicenseSignatureHeader = '...';
const responseBody = {
  // ... response object from LicenseSpring's server ...
};

/* 
  NOTE: specifically for the Activate License Offline endpoint, existing
  signatures in the response body need to be removed before calculating
  the v2 signature, like this:
  
  delete responseBody.license_signature;
  delete responseBody.license_signature_v2;
*/

const verifier = crypto.createVerify('RSA-SHA256');
verifier.update(JSON.stringify(response));
const result = verifier.verify(publicKey, responseLicenseSignatureHeader, 'base64');

console.log(result); // will be "true" if signature is valid
```

{% endcode %}


---

# 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.licensespring.com/license-api/license-api-authorization/response-signature-v2.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.
