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

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

Creates a new coupon.

Reference: https://docs.navipartner.com/apis/api-reference/coupon/service-coupon/create-coupon

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

- `couponType` (string, required) — The type of coupon, which links to a template defining its behavior.
- `customerNo` (string, optional) — Optionally assign the coupon to a specific customer.

## Response

### 201

- `id` (UUID, required) — The unique system identifier for the coupon.
- `no` (string, required) — The internal coupon number from the number series.
- `couponType` (string, required) — The type of coupon, which carries the setup in NP Retail.
- `description` (string, required) — A short description of the coupon.
- `referenceNo` (string, required) — A unique, human-readable reference number, often used for barcodes.
- `status` (enum, required) — The current status of the coupon.
  - Allowed values: `ACTIVE`, `CONSUMED`
- `discountType` (enum, required) — The type of discount the coupon provides.
  - Allowed values: `AMOUNT`, `PERCENTAGE`
- `maxUsesPerSale` (integer, required) — The maximum number of times this coupon can be used in a single sale.
- `issueDate` (date, required) — The date the coupon was first issued.
- `discountAmount` (double, optional) — The fixed discount amount, if applicable.
- `discountPercent` (double, optional) — The discount as a percentage, if applicable.
- `maxDiscountAmount` (double, optional) — The maximum discount amount that can be applied.
- `validFrom` (datetime, optional) — The date and time from which the coupon is valid.
- `validUntil` (datetime, optional) — The date and time when the coupon expires.
- `customerNo` (string, optional) — The customer number this coupon is assigned to, if any.
- `remainingQuantity` (double, optional) — The remaining times the coupon can be used, if applicable.

## Examples

**Request**

```json
{
  "couponType": "WELCOME",
  "customerNo": "C00120"
}
```

**Response**

```json
{
  "id": "77a1b3c2-d5e6-f7a8-b9c0-d1e2f3a4b5c6",
  "no": "COUP00123",
  "couponType": "WELCOME",
  "description": "Welcome Discount",
  "referenceNo": "9876543210987",
  "status": "ACTIVE",
  "discountType": "PERCENTAGE",
  "maxUsesPerSale": 1,
  "issueDate": "2025-06-01",
  "discountAmount": null,
  "discountPercent": 10,
  "maxDiscountAmount": 100,
  "validFrom": "2025-06-01T00:00:00Z",
  "validUntil": "2025-08-31T23:59:59Z",
  "customerNo": "C00120",
  "remainingQuantity": 1
}
```

**SDK Code**

```python Create a new coupon
import requests

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

payload = {
    "couponType": "WELCOME",
    "customerNo": "C00120"
}
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 a new coupon
const url = 'https://api.npretail.app/01234567-89ab-cdef-0123-456789abcdef/production/CRONUS%2520International%2520Ltd./coupon';
const options = {
  method: 'POST',
  headers: {'x-np-api-key': '<NaviPartner API Key>', 'Content-Type': 'application/json'},
  body: '{"couponType":"WELCOME","customerNo":"C00120"}'
};

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

```go Create a new coupon
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"couponType\": \"WELCOME\",\n  \"customerNo\": \"C00120\"\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 a new coupon
require 'uri'
require 'net/http'

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

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  \"couponType\": \"WELCOME\",\n  \"customerNo\": \"C00120\"\n}"

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

```java Create a new coupon
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./coupon")
  .header("x-np-api-key", "<NaviPartner API Key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"couponType\": \"WELCOME\",\n  \"customerNo\": \"C00120\"\n}")
  .asString();
```

```php Create a new coupon
<?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./coupon', [
  'body' => '{
  "couponType": "WELCOME",
  "customerNo": "C00120"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-np-api-key' => '<NaviPartner API Key>',
  ],
]);

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

```csharp Create a new coupon
using RestSharp;

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

```swift Create a new coupon
import Foundation

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