# Створення API - ключа

> API - ключі видаються виключно фізичним особам. Щоб використовувати API для бізнес - потреб, необхідно призначити довірену особу - представника компанії та отримати API - ключі на її ім'я або призначити довіреною особою того, у кого вже є ключ.
>
> Дані довіреної особи представника вказуються в договорі з Nova Post.

### Як створити ключ клієнту з Європи

1. Створіть обліковий запис [в кабінеті My Nova Post](https://my.novapost.com/)

Зареєструйтесь на my.novapost.com. [Покрокова інструкція з реєстрації](https://novapost.com/uk-pl/my-nova-post-instructions#registration)[ ](https://api-portal-stage.novapost.com/uk/my-nova-post-instructions#registration)

2\. Створіть API-ключ у кабінеті My Nova Post

Перейдіть у розділ «Інтеграції → API-ключі» my.novapost.com та створіть ключ для продакшн-середовища.

Під час створення ключа система автоматично відобразить усі організації, закріплені за вашим акаунтом. Ви можете:&#x20;

* обрати одну або кілька організацій, до яких надається доступ через цей ключ;
* або створити окремі ключі для кожної організації, якщо потрібно розділити доступи між командами чи проєктами.

<figure><img src="/files/lmWHIKH9Vi5Hws9hV4yS" alt=""><figcaption></figcaption></figure>

Ключ одразу з’явиться у списку з інформацією про:&#x20;

* дату створення
* назву
* статус (активний/деактивований)
* організацію
* термін дії

#### **Створення тестового API-ключа — спосіб 1**

На сторінці генерації тестових ключів на порталі Nova Post:

* Укажіть номер телефону, який зареєстрований у вашому особистому кабінеті my.novapost.com та виконайте запит на створення ключа.
* Після успішного запиту буде згенеровано тестовий API-ключ для пісочниці (Stage environment), прив’язаний до фізичної особи без зв’язку з організаціями.

**Спосіб 2**

## Create or renew a test API key (Sandbox only)

> Public endpoint available only in non-production environments (Sandbox) \
> to create or renew a test API key for a client identified by phone.\
> \
> Requirements:\
> \- The phone number must be registered in the Client Portal (EBC): <https://my.novapost.com/\\>
> \- UA key generation is currently not supported\
> \
> Behavior:\
> \- If a key already exists and is Active, a repeated call within the same day \
> &#x20; will return the same key\
> \- If expired, the key will be reactivated with a new expiration date\
> \- If deleted by cleanup, a new key will be created\
> \- Only one active key is allowed per phone, limited to one request per day\
> \
> Next step:\
> After receiving the apiKey, you must generate a temporary JWT by calling \
> \[GET /clients/authorization]\(<https://api-portal.novapost.com/novaposhta-docs/integration-guide/how-to-generate-a-jwt-token>). The JWT is required for all authorized requests. \
> Paste the jwt into the \*\*\[Authorize]\(<https://api.novapost.com/developers/index.html#auth)\\*\\>\* dialog under the \`JWT\` scheme \
> in this documentation to enable Try-it-out.\</br>\
> \
> 🔹\*\*Description of control elements:\*\*\
> \
> \*\*SCHEMA\*\*\</br>\
> Displays the full technical structure of the request or response, including field names, data types, required fields, allowed values, and validation rules.\
> \- \*\*Single line description\*\*\</br>\
> &#x20; A description that fits into a single line; any text that does not fit remains hidden.\
> \- \*\*Multiline description\*\*\</br>\
> &#x20; An expanded description that displays more than one line of text.\
> \
> \*\*EXAMPLE\*\*\</br>\
> Shows a ready-made sample JSON with correctly formatted values to demonstrate how a valid request or response should look.<br>

```json
{"openapi":"3.0.0","info":{"title":"API Nova Post","version":"1.0.0"},"tags":[{"name":"Authorization"}],"servers":[{"description":"sandbox","url":"https://api-stage.novapost.pl/v.1.0/"},{"description":"production","url":"https://api.novapost.com/v.1.0/"}],"security":[],"paths":{"/test-api-keys":{"post":{"tags":["Authorization"],"summary":"Create or renew a test API key (Sandbox only)","description":"Public endpoint available only in non-production environments (Sandbox) \nto create or renew a test API key for a client identified by phone.\n\nRequirements:\n- The phone number must be registered in the Client Portal (EBC): https://my.novapost.com/\n- UA key generation is currently not supported\n\nBehavior:\n- If a key already exists and is Active, a repeated call within the same day \n  will return the same key\n- If expired, the key will be reactivated with a new expiration date\n- If deleted by cleanup, a new key will be created\n- Only one active key is allowed per phone, limited to one request per day\n\nNext step:\nAfter receiving the apiKey, you must generate a temporary JWT by calling \n[GET /clients/authorization](https://api-portal.novapost.com/novaposhta-docs/integration-guide/how-to-generate-a-jwt-token). The JWT is required for all authorized requests. \nPaste the jwt into the **[Authorize](https://api.novapost.com/developers/index.html#auth)** dialog under the `JWT` scheme \nin this documentation to enable Try-it-out.</br>\n\n🔹**Description of control elements:**\n\n**SCHEMA**</br>\nDisplays the full technical structure of the request or response, including field names, data types, required fields, allowed values, and validation rules.\n- **Single line description**</br>\n  A description that fits into a single line; any text that does not fit remains hidden.\n- **Multiline description**</br>\n  An expanded description that displays more than one line of text.\n\n**EXAMPLE**</br>\nShows a ready-made sample JSON with correctly formatted values to demonstrate how a valid request or response should look.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["phone"],"properties":{"phone":{"type":"string","description":"Phone number registered in EBC. Format like 49XXXXXXXXX (no '+'). UA keys generation is currently not supported."}}}}}},"responses":{"200":{"description":"Test API key created or returned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestApiKeyResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Client not found in EBC","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Multiple matching clients found in EBC","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Daily limit exceeded for this user (one request per day)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"$ref":"#/components/responses/Time-out"}}}}},"components":{"schemas":{"TestApiKeyResponse":{"type":"object","additionalProperties":false,"required":["apiKey","createdAt","expDate","status"],"properties":{"apiKey":{"type":"string","description":"Test API key for Stage usage only."},"createdAt":{"type":"string","format":"date-time"},"expDate":{"type":"string","format":"date-time"},"status":{"type":"string","enum":["Active","Expired"]}}},"ErrorResponse":{"type":"object","additionalProperties":false,"required":["success","errors"],"properties":{"success":{"type":"boolean"},"errors":{"type":"array","items":{"type":"string"}}}},"Error":{"type":"object","properties":{"errors":{"type":"object","properties":{"":{"type":"string"}}}}}},"responses":{"Time-out":{"description":"Connection time-out","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}
```

#### Як створити ключ клієнту з України

Генерація ключів в Бізнес - кабінеті України у вкладці [«Налаштування - Безпека».](https://new.novaposhta.ua/dashboard/settings/developers)

{% stepper %}
{% step %}
Авторизуйтесь в бізнес - кабінеті як юридична особа

<figure><img src="/files/C0HVS3jZLqFKWSFJLy1M" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Перейдіть в розділ "Налаштування"

<figure><img src="/files/YiX7DsO0fPx6ASh48haK" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Виберіть розділ "Безпека"

<figure><img src="/files/t6po2Es7oqQkvbcqdMRn" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Натисніть "Створити ключ"

<figure><img src="/files/iP2KzbrAMEuNBTG3wAfC" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Ключ створено. Скопіюйте код для використання API Nova Post.

<figure><img src="/files/yCUXNEmAooBoVjYAHFuH" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

#### Додаткові рекомендації

* Безпека: Зберігайте ваші API ключі в надійному місці та не розголошуйте їх третім особам.
* Тестування: Використовуйте тестове середовище для перевірки інтеграції, перш ніж переходити до продакшн - середовища.
* Контроль доступу: Регулярно перевіряйте список користувачів, які мають доступ до вашого облікового запису та API ключів.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api-portal.novapost.com/novaposhta-docs/documentation/kroki-integraciyi/stvorennya-api-klyucha.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
