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

# Create Loyalty Tags

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

Creates one or more loyalty tag definitions that can be used to tag point entries

Reference: https://docs.navipartner.com/apis/api-reference/memberships/service-misc/create-loyalty-tags

## 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 a CreateLoyaltyTagsRequest.

- `tags` (list of LoyaltyTagDefinition, required) — List of loyalty tags to create. Each tag key must be unique.

## Response

### 200

- `tags` (list of LoyaltyTagDefinition, required) — List of successfully created loyalty tags
- `createdCount` (integer, required) — Number of tags that were created

## Types

### LoyaltyTagDefinition

Defines a loyalty tag that can be attached to point entries

- `key` (string, required) — Unique identifier for the tag (e.g., "SALES-CHANNEL", "REF-NO")
- `description` (string, required) — Human-readable description of what this tag represents

## Examples

**Request**

```json
{
  "tags": [
    {
      "key": "SALES-CHANNEL",
      "description": "Identifies the sales channel where the transaction occurred"
    },
    {
      "key": "REF-NO",
      "description": "External reference number for tracking"
    }
  ]
}
```

**Response**

```json
{
  "tags": [
    {
      "key": "SALES-CHANNEL",
      "description": "Identifies the sales channel where the transaction occurred"
    },
    {
      "key": "REF-NO",
      "description": "External reference number for tracking"
    }
  ],
  "createdCount": 2
}
```

**SDK Code**

```python Create multiple loyalty tags
import requests

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

payload = { "tags": [
        {
            "key": "SALES-CHANNEL",
            "description": "Identifies the sales channel where the transaction occurred"
        },
        {
            "key": "REF-NO",
            "description": "External reference number for tracking"
        }
    ] }
headers = {
    "x-np-api-key": "<NaviPartner API Key>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create multiple loyalty tags
const url = 'https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./membership/loyaltytags';
const options = {
  method: 'POST',
  headers: {'x-np-api-key': '<NaviPartner API Key>', 'Content-Type': 'application/json'},
  body: '{"tags":[{"key":"SALES-CHANNEL","description":"Identifies the sales channel where the transaction occurred"},{"key":"REF-NO","description":"External reference number for tracking"}]}'
};

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

```go Create multiple loyalty tags
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/loyaltytags"

	payload := strings.NewReader("{\n  \"tags\": [\n    {\n      \"key\": \"SALES-CHANNEL\",\n      \"description\": \"Identifies the sales channel where the transaction occurred\"\n    },\n    {\n      \"key\": \"REF-NO\",\n      \"description\": \"External reference number for tracking\"\n    }\n  ]\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 Create multiple loyalty tags
require 'uri'
require 'net/http'

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

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  \"tags\": [\n    {\n      \"key\": \"SALES-CHANNEL\",\n      \"description\": \"Identifies the sales channel where the transaction occurred\"\n    },\n    {\n      \"key\": \"REF-NO\",\n      \"description\": \"External reference number for tracking\"\n    }\n  ]\n}"

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

```java Create multiple loyalty tags
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/loyaltytags")
  .header("x-np-api-key", "<NaviPartner API Key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"tags\": [\n    {\n      \"key\": \"SALES-CHANNEL\",\n      \"description\": \"Identifies the sales channel where the transaction occurred\"\n    },\n    {\n      \"key\": \"REF-NO\",\n      \"description\": \"External reference number for tracking\"\n    }\n  ]\n}")
  .asString();
```

```php Create multiple loyalty tags
<?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/loyaltytags', [
  'body' => '{
  "tags": [
    {
      "key": "SALES-CHANNEL",
      "description": "Identifies the sales channel where the transaction occurred"
    },
    {
      "key": "REF-NO",
      "description": "External reference number for tracking"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-np-api-key' => '<NaviPartner API Key>',
  ],
]);

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

```csharp Create multiple loyalty tags
using RestSharp;

var client = new RestClient("https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./membership/loyaltytags");
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  \"tags\": [\n    {\n      \"key\": \"SALES-CHANNEL\",\n      \"description\": \"Identifies the sales channel where the transaction occurred\"\n    },\n    {\n      \"key\": \"REF-NO\",\n      \"description\": \"External reference number for tracking\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create multiple loyalty tags
import Foundation

let headers = [
  "x-np-api-key": "<NaviPartner API Key>",
  "Content-Type": "application/json"
]
let parameters = ["tags": [
    [
      "key": "SALES-CHANNEL",
      "description": "Identifies the sales channel where the transaction occurred"
    ],
    [
      "key": "REF-NO",
      "description": "External reference number for tracking"
    ]
  ]] 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/loyaltytags")! 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()
```