> 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.

# Request Customer Anonymization

POST https://api.npretail.app/{tenant}/{environment}/{company}/customer/requestAnonymize
Content-Type: application/json

Request anonymization of a customer's personal data for GDPR compliance.

This endpoint supports three different ways to identify the customer for anonymization:

**Option 1: Customer Number Only**

* Send only `customerNo` in the request body
* Use for company-level anonymization when no specific contact needs to be identified
* Example: `{ "customerNo": "C00001" }`

**Option 2: Customer Number with Contact Number**

* Send both `customerNo` and `contactNo` in the request body
* Use for person-level anonymization when the customer is linked to a specific contact
* Example: `{ "customerNo": "C00001", "contactNo": "CT00001" }`

**Option 3: Email Address Only**

* Send only `email` in the request body
* The system will locate the customer using the email address
* Example: `{ "email": "customer@example.com" }`

The anonymization process will:

* Verify if the customer exists in the system
* Check if anonymization is allowed (e.g., no active memberships or pending transactions)
* Create an anonymization request entry for audit purposes
* Return the status and relevant identifiers

**Important Notes:**

* The customer must not have any active memberships or pending transactions
* The anonymization process is irreversible once executed
* A response code will indicate the reason if anonymization is not possible
* When using email, customer records must exist

**Use Cases:**

* GDPR "Right to be Forgotten" requests
* Customer account closure with data removal
* Self-service customer data removal via email
* Compliance with data retention policies

Reference: https://docs.navipartner.com/apis/api-reference/customers/service-gdpr/request-anonymize

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

### Body (application/json)

This endpoint expects an AnonymizeCustomerRequest.

- `customerNo` (string, optional) — The customer number. Required unless using email-based lookup.
- `contactNo` (string, optional) — The contact number. Optional; use together with customerNo for person-level anonymization.
- `email` (string, optional) — The email address. Use alone to identify customer by email.

## Response

### 200

- `success` (boolean, required) — Indicates whether the anonymization request was created successfully
- `message` (string, required) — Detailed message describing the result of the anonymization request
- `customerNo` (string, optional) — The customer number that was processed (included when applicable)
- `contactNo` (string, optional) — The contact number that was processed (included when applicable)
- `email` (string, optional) — The email address that was processed (included when using email-based lookup)

## Examples

### ExampleAnonymizeByCustomerNo

Anonymize using only customer number (company-level)

**Request**

```json
{
  "customerNo": "D000188"
}
```

**Response**

```json
{
  "success": true,
  "message": "Anonymization request created successfully",
  "customerNo": "D000188"
}
```

**SDK Code**

```python ExampleAnonymizeByCustomerNo
import requests

url = "https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./customer/requestAnonymize"

payload = { "customerNo": "D000188" }
headers = {
    "x-np-api-key": "<NaviPartner API Key>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript ExampleAnonymizeByCustomerNo
const url = 'https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./customer/requestAnonymize';
const options = {
  method: 'POST',
  headers: {'x-np-api-key': '<NaviPartner API Key>', 'Content-Type': 'application/json'},
  body: '{"customerNo":"D000188"}'
};

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

```go ExampleAnonymizeByCustomerNo
package main

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

func main() {

	url := "https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./customer/requestAnonymize"

	payload := strings.NewReader("{\n  \"customerNo\": \"D000188\"\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 ExampleAnonymizeByCustomerNo
require 'uri'
require 'net/http'

url = URI("https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./customer/requestAnonymize")

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  \"customerNo\": \"D000188\"\n}"

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

```java ExampleAnonymizeByCustomerNo
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./customer/requestAnonymize")
  .header("x-np-api-key", "<NaviPartner API Key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"customerNo\": \"D000188\"\n}")
  .asString();
```

```php ExampleAnonymizeByCustomerNo
<?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./customer/requestAnonymize', [
  'body' => '{
  "customerNo": "D000188"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-np-api-key' => '<NaviPartner API Key>',
  ],
]);

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

```csharp ExampleAnonymizeByCustomerNo
using RestSharp;

var client = new RestClient("https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./customer/requestAnonymize");
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  \"customerNo\": \"D000188\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift ExampleAnonymizeByCustomerNo
import Foundation

let headers = [
  "x-np-api-key": "<NaviPartner API Key>",
  "Content-Type": "application/json"
]
let parameters = ["customerNo": "D000188"] 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./customer/requestAnonymize")! 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()
```

### ExampleAnonymizeByCustomerAndContact

Anonymize using customer number and contact number (person-level)

**Request**

```json
{
  "customerNo": "D000188",
  "contactNo": "C1234567890"
}
```

**Response**

```json
{
  "success": true,
  "message": "Anonymization request created successfully",
  "customerNo": "D000188",
  "contactNo": "C1234567890"
}
```

**SDK Code**

```python ExampleAnonymizeByCustomerAndContact
import requests

url = "https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./customer/requestAnonymize"

payload = {
    "customerNo": "D000188",
    "contactNo": "C1234567890"
}
headers = {
    "x-np-api-key": "<NaviPartner API Key>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript ExampleAnonymizeByCustomerAndContact
const url = 'https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./customer/requestAnonymize';
const options = {
  method: 'POST',
  headers: {'x-np-api-key': '<NaviPartner API Key>', 'Content-Type': 'application/json'},
  body: '{"customerNo":"D000188","contactNo":"C1234567890"}'
};

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

```go ExampleAnonymizeByCustomerAndContact
package main

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

func main() {

	url := "https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./customer/requestAnonymize"

	payload := strings.NewReader("{\n  \"customerNo\": \"D000188\",\n  \"contactNo\": \"C1234567890\"\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 ExampleAnonymizeByCustomerAndContact
require 'uri'
require 'net/http'

url = URI("https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./customer/requestAnonymize")

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  \"customerNo\": \"D000188\",\n  \"contactNo\": \"C1234567890\"\n}"

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

```java ExampleAnonymizeByCustomerAndContact
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./customer/requestAnonymize")
  .header("x-np-api-key", "<NaviPartner API Key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"customerNo\": \"D000188\",\n  \"contactNo\": \"C1234567890\"\n}")
  .asString();
```

```php ExampleAnonymizeByCustomerAndContact
<?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./customer/requestAnonymize', [
  'body' => '{
  "customerNo": "D000188",
  "contactNo": "C1234567890"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-np-api-key' => '<NaviPartner API Key>',
  ],
]);

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

```csharp ExampleAnonymizeByCustomerAndContact
using RestSharp;

var client = new RestClient("https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./customer/requestAnonymize");
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  \"customerNo\": \"D000188\",\n  \"contactNo\": \"C1234567890\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift ExampleAnonymizeByCustomerAndContact
import Foundation

let headers = [
  "x-np-api-key": "<NaviPartner API Key>",
  "Content-Type": "application/json"
]
let parameters = [
  "customerNo": "D000188",
  "contactNo": "C1234567890"
] 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./customer/requestAnonymize")! 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()
```

### ExampleAnonymizeByEmail

Anonymize using email address (requires customer to exist)

**Request**

```json
{
  "email": "john.doe@acme.com"
}
```

**Response**

```json
{
  "success": true,
  "message": "Anonymization request created successfully",
  "customerNo": "D000188",
  "email": "john.doe@acme.com"
}
```

**SDK Code**

```python ExampleAnonymizeByEmail
import requests

url = "https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./customer/requestAnonymize"

payload = { "email": "john.doe@acme.com" }
headers = {
    "x-np-api-key": "<NaviPartner API Key>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript ExampleAnonymizeByEmail
const url = 'https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./customer/requestAnonymize';
const options = {
  method: 'POST',
  headers: {'x-np-api-key': '<NaviPartner API Key>', 'Content-Type': 'application/json'},
  body: '{"email":"john.doe@acme.com"}'
};

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

```go ExampleAnonymizeByEmail
package main

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

func main() {

	url := "https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./customer/requestAnonymize"

	payload := strings.NewReader("{\n  \"email\": \"john.doe@acme.com\"\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 ExampleAnonymizeByEmail
require 'uri'
require 'net/http'

url = URI("https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./customer/requestAnonymize")

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  \"email\": \"john.doe@acme.com\"\n}"

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

```java ExampleAnonymizeByEmail
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./customer/requestAnonymize")
  .header("x-np-api-key", "<NaviPartner API Key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"email\": \"john.doe@acme.com\"\n}")
  .asString();
```

```php ExampleAnonymizeByEmail
<?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./customer/requestAnonymize', [
  'body' => '{
  "email": "john.doe@acme.com"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-np-api-key' => '<NaviPartner API Key>',
  ],
]);

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

```csharp ExampleAnonymizeByEmail
using RestSharp;

var client = new RestClient("https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./customer/requestAnonymize");
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  \"email\": \"john.doe@acme.com\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift ExampleAnonymizeByEmail
import Foundation

let headers = [
  "x-np-api-key": "<NaviPartner API Key>",
  "Content-Type": "application/json"
]
let parameters = ["email": "john.doe@acme.com"] 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./customer/requestAnonymize")! 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()
```