Create KUNA Code [Private]

Create a new KUNA Code via API. It is possible to specify the Kuna ID of the recipient, the date until which the code will not be available to the creator for activation, public and private comments.

🚧

Available for Merchant accounts only!

📘

To call any private endpoint, headers should include authorization key(s).

You may use a single API key or a public-private key pair based on your current tasks. Here you may find typical Header configurations for both options.

Method name:/v4/kuna-code
Request type:POST

Data dictionary

NameTypeParameter typeRequiredRangeDescription
idstringBODYNO-id must be a UUID format. If you do not specify id, it will be generated automatically.
recipientstringBODYNO-Kuna ID of the recipient.
nonRefundableBeforestringBODYNO-The date until which the owner of the Kuna Code will not be able to activate it (ISO format).
commentstringBODYNO-Public note to the KUNA Code.
privateCommentstringBODYNO-Private note to the KUNA Code, which is visible only to the owner of the Kuna Code.
amountstringBODYYES-Amount of the KUNA Сode.
currencystringBODYYES-Currency of the KUNA Code.

Exemplary request

const apiKey = "YOUR_API_KEY"; // put here your Api key

const url = "https://api.kuna.io";
const path = "/v4/kuna-code";
const body = {
  id: "d53881e8-2cfc-4fc1-a291-d68d217ddc11",
  recipient: "kunaid-ya4pyttest",
  nonRefundableBefore: "2023-07-07T10:02:11.585Z",
  comment: "Any string",
  privateComment: "Any string that is available only to the creator",
  amount: "10.00",
  currency: "USDT"
};

const options = {
    method: "POST",
    headers: {
        accept: "application/json",
        "Content-Type": "application/json",
        "api-key": apiKey,
    },
    body: JSON.stringify(body),
};

fetch(url + path, options)
    .then((response) => response.json())
    .then((showResponse) => console.log(showResponse.data));
import requests

api_key = "YOUR_API_KEY"  # put here your Api key

url = "https://api.kuna.io"
path = "/v4/kuna-code"
headers = {
    "accept": "application/json",
    "Content-Type": "application/json",
    "api-key": api_key,
}
body = {
    "id": "d53881e8-2cfc-4fc1-a291-d68d217ddc11",
    "recipient": "kunaid-ya4pyttest",
    "nonRefundableBefore": "2023-07-07T10:02:11.585Z",
    "comment": "Any string",
    "privateComment": "Any string that is available only to the creator",
    "amount": "10.00",
    "currency": "USDT"
}

request = requests.post(url + path, headers=headers, json=body)
print(request.json())

How to call private endpoints here

Swagger here

Response

{
    id: 'd53881e8-2cfc-4fc1-a291-d68d217ddc11',                                    // Kuna Code ID.
    amount: 10,                                                                    // Amount of the Kuna Сode.
    asset: 'usdt',                                                                 // Currency of the Kuna Code.
    code: 'hUx93-owczu-LCwSB-X7EQa-TEST1-Jqsit-hMHwJ-uvcBw-XZ5g8-USDT-KCode',      // Secret code key by which it is activated.
    redeemedAt: null,                                                              // Activation date of the Kuna Code.
    nonRefundableBefore: '2023-07-07T10:02:11.585Z',                               // Time until which a code cannot be activated by the owner.
    recipientId: 'kunaid-ya4pyttest',                                              // Kuna ID of the recipient. If 'all' then anyone can activate it.
    status: 'WAIT_CONFIRMATION',                                                   // Status.
    comment: 'Any string',                                                         // Public note.
    privateComment: 'Any string that is available only to the creator',            // Private note.
    createdAt: '2023-07-07T08:39:28.649Z'                                          // Date of the Kuna Code creation.
}