> This page is for API Reference.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.navipartner.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.navipartner.com/_mcp/server.

# Terminate Subscription

POST https://api.npretail.app/{tenant}/{environment}/{company}/membership/{membershipId}/subscription/terminate
Content-Type: application/json

Use this endpoint to terminate the subscription for the memebrship.

Reference: https://docs.navipartner.com/apis/api-reference/memberships/service-subscription/terminate-subscription

## Authentication

- `x-np-api-key` header (required) — API Key authentication via header

## Request

### Path parameters

- `tenant` (string, required) — Your Entra Tenant ID. [More details.](/paths#1-tenant)
- `environment` (string, required) — Your Business Central Environment. [More details.](/paths#2-environment)
- `company` (string, required) — Your Business Central Company. [More details.](/paths#3-company)
- `membershipId` (UUID, required) — Unique identifier for a membership.

### Body (application/json)

This endpoint expects a SubscriptionTerminationRequest.

- `terminationDate` (date, optional) — The date to terminate the subscription by. If not included, the system calculates the earliest valid termination date from the configured notice period, commitment end, and billing cycle, counting the notice period from the current date. A date earlier than that is rejected with a 400 rather than adjusted, so a client that calculates its own date has to be ready for the request to fail. Omitting the field avoids that entirely.

## Response

### 200

- `id` (UUID, required) — Unique identifier for a subscription.
- `blocked` (boolean, required) — Defines if the subscription is blocked and therefore not useable for renewing the membership.
- `autoRenew` (enum, required) — Indicates the auto-renewal state
  - Allowed values: `NO`, `YES_INTERNAL`, `YES_EXTERNAL`, `TERMINATION_REQUESTED`
- `startedAt` (datetime, optional) — Defines the date the subscription was started.
- `committedUntil` (date, optional) — Defines the date that the subscription is committed until. It's not possible to terminate the subscription before this date.
- `terminateAt` (date, optional) — Defines the date the membership will be terminated if it has been requested to terminate.
- `terminationRequestedAt` (datetime, optional) — Defines the date and time termination was requested.
- `terminationReason` (enum, optional) — Defines the reason for a termination.
  - Allowed values: `CUSTOMER_INITIATED`, `FORCED_TERMINATION`
- `usableUntilDate` (date, optional) — The last date the membership remains usable if auto-renewal is cancelled now, inclusive. Terminating only switches auto-renewal off and does not shorten the period already paid for, so this is the end of that period, or of the last period a notice period forces a renewal into. It is not the date the termination itself takes effect: that is reported separately as terminateAt. Null when it cannot be determined, for example when auto-renewal is off or is managed externally. Informational only: do not send this value back as a terminationDate when terminating - omit that field and the server applies its own earliest acceptable date.
- `renewalRequiredBeforeTermination` (boolean, optional) — True when the notice period runs past the end of the paid period, so the membership renews, and is charged, once more before it can be terminated. Null whenever usableUntilDate is null, since there is then no termination to describe.
- `nextRenewalAttemptDate` (date, optional) — The next date an automatic renewal payment will be attempted. Null when no further attempt is planned, for example when auto-renewal is off or every scheduled attempt is already in the past.

## Examples

**Request**

```json
{
  "terminationDate": "2025-12-17"
}
```

**Response**

```json
{
  "id": "7b6e8265-70f2-4429-a536-4a455f07c296",
  "blocked": false,
  "autoRenew": "TERMINATION_REQUESTED",
  "startedAt": "2025-06-17T16:34:00.000Z",
  "committedUntil": "2025-12-17",
  "terminateAt": "2025-12-17",
  "terminationRequestedAt": "2025-06-17T15:47:00Z",
  "terminationReason": "CUSTOMER_INITIATED",
  "usableUntilDate": "2025-12-17",
  "renewalRequiredBeforeTermination": false
}
```

**SDK Code**

```python SubscriptionTerminationRequested
import requests

url = "https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./membership/9f6ccdd4-b5d7-4c22-ba41-51dbb95353ca/subscription/terminate"

payload = { "terminationDate": "2025-12-17" }
headers = {
    "x-np-api-key": "<NaviPartner API Key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript SubscriptionTerminationRequested
const url = 'https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./membership/9f6ccdd4-b5d7-4c22-ba41-51dbb95353ca/subscription/terminate';
const options = {
  method: 'POST',
  headers: {'x-np-api-key': '<NaviPartner API Key>', 'Content-Type': 'application/json'},
  body: '{"terminationDate":"2025-12-17"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go SubscriptionTerminationRequested
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./membership/9f6ccdd4-b5d7-4c22-ba41-51dbb95353ca/subscription/terminate"

	payload := strings.NewReader("{\n  \"terminationDate\": \"2025-12-17\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-np-api-key", "<NaviPartner API Key>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby SubscriptionTerminationRequested
require 'uri'
require 'net/http'

url = URI("https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./membership/9f6ccdd4-b5d7-4c22-ba41-51dbb95353ca/subscription/terminate")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-np-api-key"] = '<NaviPartner API Key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"terminationDate\": \"2025-12-17\"\n}"

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

```java SubscriptionTerminationRequested
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./membership/9f6ccdd4-b5d7-4c22-ba41-51dbb95353ca/subscription/terminate")
  .header("x-np-api-key", "<NaviPartner API Key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"terminationDate\": \"2025-12-17\"\n}")
  .asString();
```

```php SubscriptionTerminationRequested
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./membership/9f6ccdd4-b5d7-4c22-ba41-51dbb95353ca/subscription/terminate', [
  'body' => '{
  "terminationDate": "2025-12-17"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-np-api-key' => '<NaviPartner API Key>',
  ],
]);

echo $response->getBody();
```

```csharp SubscriptionTerminationRequested
using RestSharp;

var client = new RestClient("https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./membership/9f6ccdd4-b5d7-4c22-ba41-51dbb95353ca/subscription/terminate");
var request = new RestRequest(Method.POST);
request.AddHeader("x-np-api-key", "<NaviPartner API Key>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"terminationDate\": \"2025-12-17\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift SubscriptionTerminationRequested
import Foundation

let headers = [
  "x-np-api-key": "<NaviPartner API Key>",
  "Content-Type": "application/json"
]
let parameters = ["terminationDate": "2025-12-17"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./membership/9f6ccdd4-b5d7-4c22-ba41-51dbb95353ca/subscription/terminate")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```