> 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-activation-and-deactivation/deactivate-bundle-offline-method.md).

# Deactivate Bundle (Offline Method)

### Deactivate Bundle (Offline Method)

Deactivates a bundle using the offline activation method. Returns the list of affected licenses in response.

***

### Endpoint

* Method: `POST`
* Path: `/api/v4/deactivate_bundle_offline`
* Description: Deactivates a bundle using the offline flow (base64 payload).

### Authentication

See [License API Authorization](/license-api/license-api-authorization.md).

#### Required headers

* `Date` (string) — RFC7231 GMT date string
* `Authorization` (string) — signature or bearer token

#### Recommended headers

* `Accept: application/json`

### Request

#### Body

The request body is a **base64-encoded, stringified JSON object** (see schema below).

{% hint style="danger" %}
If using `multipart/form-data`, the `file` form parameter is mandatory.
{% endhint %}

### Examples

{% tabs %}
{% tab title="curl" %}

```bash
curl --location --request POST '/api/v4/deactivate_bundle_offline' \
--header 'Accept: application/json' \
--header 'Date: string' \
--header 'Authorization: string' \
--data-raw '_BASE64_PAYLOAD_HERE_'
```

{% endtab %}

{% tab title="nodejs" %}

```javascript
var request = require('request');
var options = {
   'method': 'POST',
   'url': '/api/v4/deactivate_bundle_offline',
   'headers': {
      'Accept': 'application/json',
      'Date': 'string',
      'Authorization': 'string'
   },
   body: Buffer.from(JSON.stringify(offline_payload)).toString('base64')
};

request(options, function (error, response) {
   if (error) throw new Error(error);
   console.log(response.body);
});
```

{% endtab %}

{% tab title="javascript (browser / fetch)" %}

```javascript
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Date", "string");
myHeaders.append("Authorization", "string");

var requestOptions = {
   method: 'POST',
   headers: myHeaders,
   body: btoa(JSON.stringify(offline_payload)),
   redirect: 'follow'
};

fetch("/api/v4/deactivate_bundle_offline", requestOptions)
   .then(response => response.text())
   .then(result => console.log(result))
   .catch(error => console.log('error', error));
```

{% endtab %}

{% tab title="python" %}

```python
import requests

url = "/api/v4/deactivate_bundle_offline"

payload = "{\"Payload\":\"Object\"}"
headers = {
   'Accept': 'application/json',
   'Date': 'string',
   'Authorization': 'string'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

{% endtab %}

{% tab title="ruby" %}

```ruby
require "uri"
require "net/http"

url = URI("/api/v4/deactivate_bundle_offline")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["Accept"] = "application/json"
request["Date"] = "string"
request["Authorization"] = "string"
request.body = "{\"Payload\":\"Object\"}"

response = http.request(request)
puts response.read_body
```

{% endtab %}
{% endtabs %}

***

### Schema

#### Request Body

The request body is a string representing a base64-encoded JSON object containing all the required activation data.

{% hint style="danger" %}
If using "multipart/form-data" for the request, the "file" form parameter is mandatory
{% endhint %}

<details>

<summary><strong>Request schema (TypeScript + JSON Schema)</strong></summary>

**TypeScript**

```typescript
type LicenseOfflineActivationObject = ({

  // for key-based licenses:
  license_key: string

} | {

  // for user-based licenses:
  username: string

}) & {

  // required properties:
  hardware_id: string
  product: string
  request_id: string
  signature: string
  date: string
  request: "deactivation"

} & ({
  api_key: string // for API key authorization
} | {
  client_id: string // for OAuth authorization
}) & {

  // optional properties:
  license_id?: number | undefined
  sdk_ver?: string | undefined
}
```

**JSON Schema**

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "allOf": [
    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "license_key": { "type": "string" }
          },
          "required": ["license_key"],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "username": { "type": "string" }
          },
          "required": ["username"],
          "additionalProperties": false
        }
      ]
    },
    {
      "type": "object",
      "properties": {
        "api_key": { "type": "string" },
        "client_id": { "type": "string" },
        "request": { "type": "string" },
        "request_id": { "type": "string" },
        "date": { "type": "string" },
        "signature": { "type": "string" },
        "hardware_id": { "type": "string" },
        "product": { "type": "string" },
        "license_id": { "type": "number" },
        "sdk_ver": { "type": "string" }
      },
     "allOf": [
        { "anyOf": [{ "required": ["api_key"] }, { "required": ["client_id"] }] },
        { "anyOf": [{ "required": ["license_key"] }, { "required": ["username"] }] }
      ],
      "required": ["hardware_id", "product", "date", "signature"],
      "additionalProperties": false
    }
  ]
}
```

</details>

***

### Signature

The `signature` value is constructed by creating a signing string and HMAC-SHA256 signing it with the company shared key (or client secret for OAuth). Build the signing string from these parts in order and with newline separators:

{% stepper %}
{% step %}

### Step

Start with the string: licenseSpring
{% endstep %}

{% step %}

### Step

Add a newline and the string: date:
{% endstep %}

{% step %}

### Step

Add a newline and either the license\_key or username value (whichever is present)
{% endstep %}

{% step %}

### Step

Add a newline and the hardware\_id value
{% endstep %}

{% step %}

### Step

Add a newline and the api\_key (or client\_id) value
{% endstep %}
{% endstepper %}

Then HMAC-SHA256 the complete signing string using the signing key:

* If using API key authorization: signing key = Shared Key
* If using OAuth: signing key = Client Secret

Example (Node.js):

```javascript
import crypto from 'node:crypto';

const activationPayload = {
  // ...payload content...
};

// api_key or client_id depending on authorization type used:
const key = (activationPayload.api_key || activationPayload.client_id);

// if using API key authorization: the signing key is the Shared Key
// if using OAuth: the signing key is the Client Secret
const signingKey = '...';

const signingString =
  'licenseSpring\n' +
  'date: ' + activationPayload.date + '\n' +
  (activationPayload.license_key || activationPayload.username) + '\n' +
  activationPayload.hardware_id + '\n' +
  key;

const signature = crypto
  .createHmac('sha256', signingKey)
  .update(signingString)
  .digest('base64');
```

***

### Finalized payload

Stringify the payload object and encode to base64.

{% tabs %}
{% tab title="JS Browser" %}

```javascript
const activationPayload = {
  // ...payload content...
};
const requestBody = btoa(JSON.stringify(activationPayload));
```

{% endtab %}

{% tab title="nodeJS" %}

```javascript
const activationPayload = {
  // ...payload content...
};
const requestBody = Buffer.from(JSON.stringify(activationPayload)).toString('base64');
```

{% endtab %}
{% endtabs %}

Send the resulting base64 string as the raw request body.

***

### Response Body

Success:

* HTTP 200
* Body: `"license_deactivated"`

Errors:

* HTTP 400 or higher
* Body format:

```json
{
  "status": number,
  "code": "string",
  "message": "string"
}
```

JSON Schema for error responses:

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "status": { "type": "number" },
    "code": { "type": "string" },
    "message": { "type": "string" }
  },
  "required": [
    "status",
    "code",
    "message"
  ],
  "additionalProperties": false
}
```

#### List of exceptions

* missing\_headers (400): some headers are missing
  * when missing authorization or date headers
* missing\_parameters (400): some parameters are missing in the request
  * when no request body at all or no file found in request body
* authorization\_missing\_params (400): some parameters are missing in authorization
  * when request body is not properly base64 encoded
  * when file is missing in request body
  * when license\_key or hardware\_id body parameters are missing
  * when data body parameter is missing
  * when api\_key parameter is missing
* product\_not\_bundle (400): Specified product "{CODE}" is not a bundle

{% hint style="info" %}
If you want to use this API endpoint directly, instead of using SDK (which does most of the heavy lifting), please contact us for additional instructions.
{% endhint %}

***

### License Authorization Method

There are two authorization approaches for products:

* Key-based product licenses
  * Client provides `license_key` in the request body.
  * License response object will contain `license_key`.
  * `product_details.authorization_method` = `license_key`.
* User-based product licenses
  * Requires `username` (and password where applicable).
  * `product_details.authorization_method` = `user`.
  * Response includes a `user` object with license user info.

***

### License Types

The `license_type` property can be:

* Perpetual: `perpetual`
* Time-limited: `time-limited`
* Subscription: `subscription`
* Consumption: `consumption`

For more information see: [License Types](/license-entitlements/license-types.md)

***

### Device variables

The optional `variables` parameter lets you set device variables during activation. For more information see: [Device Variables](/license-api/device-variables.md)

***

### Guide on using Offline Licenses

If any aspect of the offline licensing model remains unclear, see the in-depth guide:\
<https://docs.licensespring.com/license-entitlements/activation-types/offline>


---

# 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:

```
GET https://docs.licensespring.com/license-api/license-activation-and-deactivation/deactivate-bundle-offline-method.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
