> For the complete documentation index, see [llms.txt](https://navixy.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://navixy.com/docs/navixy-api/panel-api/resources/dealer/activation_code.md).

# Activation code

API calls for interacting with activation codes used for device registration.

Activation codes in Navixy simplify the device activation process by allowing users to set up devices themselves, ensuring they are configured with the appropriate plan and benefits from the start. These codes can include bonuses, free days, and monetary credits to a user's balance upon activation, and are tied to specific plans.

Depending on the dealer's preference, activation codes can be optional or required. Dealers can choose to restrict device activation to only those they supply, preventing users from adding devices purchased elsewhere without an activation code received from the dealer.

## Activation Code Object

## The ActivationCode object

```json
{"openapi":"3.1.0","info":{"title":"Navixy Admin Panel API","version":"1.2.0"},"components":{"schemas":{"ActivationCode":{"type":"object","description":"An activation code, which lets an end user register a device themselves with a predetermined plan, bonus balance, and free period.","properties":{"code":{"type":"string","description":"The code value."},"tariff_id":{"type":"integer","description":"ID of the plan applied on activation."},"tariff_name":{"type":"string","description":"Name of the plan applied on activation."},"bonus_amount":{"type":"integer","description":"Bonus amount added to the user's balance when a device is activated with this code."},"money_amount":{"type":"integer","description":"Amount of money added to the user's balance on activation."},"free_days":{"type":"integer","description":"Number of free days granted on activation."},"device_type":{"type":"string","description":"Device type the code applies to."},"activated":{"type":"boolean","description":"`true` once the code has been used."},"activation_date":{"type":["string","null"],"description":"When the code was used, or `null` if it has not been activated."},"device_id":{"type":"integer","description":"ID of the device activated with this code. `0` if the code has not been activated."}}}}}}
```

## API actions

API base path: `panel/dealer/activation_code`.

***

*required permissions*: `activation_code: ["read", "create"]`.

## Create activation codes

> Create a batch of activation codes bound to a plan. Activation codes let an end user register a device themselves and have it configured with the correct plan, bonus balance, and free period from the start. The plan referenced by \`tariff\_id\` must belong to the current dealer. Returns the number of codes actually created, which can be lower than requested.

```json
{"openapi":"3.1.0","info":{"title":"Navixy Admin Panel API","version":"1.2.0"},"tags":[{"name":"Dealer","description":"Operations for reading dealer information, managing activation codes, changing the dealer password, and reading or updating panel settings covering service configuration, notification originators, and branding images. All resources under the /panel/dealer/ path."}],"servers":[{"url":"https://api.eu.navixy.com/v2","description":"Navixy production server on European platform"},{"url":"https://api.us.navixy.com/v2","description":"Navixy production server on American platform"},{"url":"https://api.me.navixy.com/v2","description":"Navixy production server on Middle East platform"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{"api_key":{"type":"apiKey","description":"Enter the panel session hash with the \"NVX \" prefix, e.g. \"NVX fa7bf873fab9333144e171372a321b06\". Obtain the hash from the accountAuth operation.","name":"Authorization","in":"header"}},"responses":{"ResponseError":{"description":"Error response object","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"Always false."},"status":{"type":"object","description":"Error status. Present only when an error occurred.","properties":{"code":{"type":"integer","description":"An error code in this API (not a HTTP code)"},"description":{"type":"string","description":"An error description"}}},"errors":{"type":"array","description":"Per-parameter detail, returned with validation failures such as error code 7.","items":{"type":"object","properties":{"parameter":{"type":"string","description":"Name of the parameter that failed validation."},"error":{"type":"string","description":"What was wrong with it."}}}}}}}}}}},"paths":{"/panel/dealer/activation_code/create":{"post":{"tags":["Dealer"],"summary":"Create activation codes","description":"Create a batch of activation codes bound to a plan. Activation codes let an end user register a device themselves and have it configured with the correct plan, bonus balance, and free period from the start. The plan referenced by `tariff_id` must belong to the current dealer. Returns the number of codes actually created, which can be lower than requested.","operationId":"dealerActivationCodeCreate","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["count","tariff_id","bonus_amount","free_days"],"properties":{"count":{"type":"integer","description":"Number of codes to create.","minimum":1},"tariff_id":{"type":"integer","description":"ID of the plan the new codes apply. Must belong to the current dealer."},"bonus_amount":{"type":"integer","description":"Bonus amount added to the user's balance when a device is activated with one of these codes."},"free_days":{"type":"integer","description":"Number of free days granted on activation.","minimum":0}}}}}},"responses":{"200":{"description":"Codes created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"`true` if request finished successfully.","readOnly":true},"count":{"type":"integer","description":"Number of codes actually created.","readOnly":true}}}}}},"400":{"description":"Bad request. The response body carries the API-level error code in `status.code`. Validation failures also include an `errors` array.","$ref":"#/components/responses/ResponseError"},"403":{"description":"Operation not permitted, error code 13: the session lacks the required permission.","$ref":"#/components/responses/ResponseError"},"default":{"$ref":"#/components/responses/ResponseError"}}}}}}
```

#### Errors

* 201 - Not found in the database - when tariff with `tariff_id` not found for a current dealer.

***

*required permissions*: `activation_code: "read"`.

## List activation codes

> List the current dealer's activation codes, with optional text filtering, ordering, and pagination. When \`filter\` is used, a code is returned only if the filter string matches one of \`code\`, \`tariff\_id\`, \`device\_id\`, or \`device\_type\`. Every parameter is optional; calling with no parameters returns the unfiltered list.

```json
{"openapi":"3.1.0","info":{"title":"Navixy Admin Panel API","version":"1.2.0"},"tags":[{"name":"Dealer","description":"Operations for reading dealer information, managing activation codes, changing the dealer password, and reading or updating panel settings covering service configuration, notification originators, and branding images. All resources under the /panel/dealer/ path."}],"servers":[{"url":"https://api.eu.navixy.com/v2","description":"Navixy production server on European platform"},{"url":"https://api.us.navixy.com/v2","description":"Navixy production server on American platform"},{"url":"https://api.me.navixy.com/v2","description":"Navixy production server on Middle East platform"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{"api_key":{"type":"apiKey","description":"Enter the panel session hash with the \"NVX \" prefix, e.g. \"NVX fa7bf873fab9333144e171372a321b06\". Obtain the hash from the accountAuth operation.","name":"Authorization","in":"header"}},"schemas":{"ActivationCode":{"type":"object","description":"An activation code, which lets an end user register a device themselves with a predetermined plan, bonus balance, and free period.","properties":{"code":{"type":"string","description":"The code value."},"tariff_id":{"type":"integer","description":"ID of the plan applied on activation."},"tariff_name":{"type":"string","description":"Name of the plan applied on activation."},"bonus_amount":{"type":"integer","description":"Bonus amount added to the user's balance when a device is activated with this code."},"money_amount":{"type":"integer","description":"Amount of money added to the user's balance on activation."},"free_days":{"type":"integer","description":"Number of free days granted on activation."},"device_type":{"type":"string","description":"Device type the code applies to."},"activated":{"type":"boolean","description":"`true` once the code has been used."},"activation_date":{"type":["string","null"],"description":"When the code was used, or `null` if it has not been activated."},"device_id":{"type":"integer","description":"ID of the device activated with this code. `0` if the code has not been activated."}}}},"responses":{"ResponseError":{"description":"Error response object","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"Always false."},"status":{"type":"object","description":"Error status. Present only when an error occurred.","properties":{"code":{"type":"integer","description":"An error code in this API (not a HTTP code)"},"description":{"type":"string","description":"An error description"}}},"errors":{"type":"array","description":"Per-parameter detail, returned with validation failures such as error code 7.","items":{"type":"object","properties":{"parameter":{"type":"string","description":"Name of the parameter that failed validation."},"error":{"type":"string","description":"What was wrong with it."}}}}}}}}}}},"paths":{"/panel/dealer/activation_code/list":{"post":{"tags":["Dealer"],"summary":"List activation codes","description":"List the current dealer's activation codes, with optional text filtering, ordering, and pagination. When `filter` is used, a code is returned only if the filter string matches one of `code`, `tariff_id`, `device_id`, or `device_type`. Every parameter is optional; calling with no parameters returns the unfiltered list.","operationId":"dealerActivationCodeList","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"filter":{"type":"string","description":"Text filter. Matched against `code`, `tariff_id`, `device_id`, and `device_type`."},"order_by":{"type":"string","description":"Field to order the list by.","enum":["code","activated","tariff_id","tariff_name","device_type","money_amount","bonus_amount","free_days"]},"ascending":{"type":"boolean","description":"Order direction. Ascending when `true`, descending otherwise.","default":true},"offset":{"type":"integer","description":"Starting offset, for pagination.","default":0},"limit":{"type":"integer","description":"Maximum number of records to return, for pagination."}}}}}},"responses":{"200":{"description":"Activation codes","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"`true` if request finished successfully.","readOnly":true},"list":{"type":"array","description":"The matching activation codes.","readOnly":true,"items":{"$ref":"#/components/schemas/ActivationCode"}},"count":{"type":"integer","description":"Total number of matching records, ignoring `offset` and `limit`.","readOnly":true}}}}}},"400":{"description":"Bad request. The response body carries the API-level error code in `status.code`. Validation failures also include an `errors` array.","$ref":"#/components/responses/ResponseError"},"403":{"description":"Operation not permitted, error code 13: the session lacks the required permission.","$ref":"#/components/responses/ResponseError"},"default":{"$ref":"#/components/responses/ResponseError"}}}}}}
```

Entities are returned only if the `filter` string matches one of `code`, `tariff_id`, `device_id`, or `device_type`.

***

Only codes that meet all of the following are changed:

* the `code` is listed in the `codes` parameter,
* it belongs to the current dealer,
* it has not been activated yet,
* it belongs to the same `device_type` as the new plan.

*required permissions*: `activation_code: "update"`.

## Update activation codes

> Change the plan, bonus amount, and free period on a set of existing activation codes. A code is updated only if it is listed in \`codes\`, belongs to the current dealer, has not been activated yet, and has the same \`device\_type\` as the new plan. Returns the number of codes actually updated, which can be lower than the number supplied.

```json
{"openapi":"3.1.0","info":{"title":"Navixy Admin Panel API","version":"1.2.0"},"tags":[{"name":"Dealer","description":"Operations for reading dealer information, managing activation codes, changing the dealer password, and reading or updating panel settings covering service configuration, notification originators, and branding images. All resources under the /panel/dealer/ path."}],"servers":[{"url":"https://api.eu.navixy.com/v2","description":"Navixy production server on European platform"},{"url":"https://api.us.navixy.com/v2","description":"Navixy production server on American platform"},{"url":"https://api.me.navixy.com/v2","description":"Navixy production server on Middle East platform"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{"api_key":{"type":"apiKey","description":"Enter the panel session hash with the \"NVX \" prefix, e.g. \"NVX fa7bf873fab9333144e171372a321b06\". Obtain the hash from the accountAuth operation.","name":"Authorization","in":"header"}},"responses":{"ResponseError":{"description":"Error response object","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"Always false."},"status":{"type":"object","description":"Error status. Present only when an error occurred.","properties":{"code":{"type":"integer","description":"An error code in this API (not a HTTP code)"},"description":{"type":"string","description":"An error description"}}},"errors":{"type":"array","description":"Per-parameter detail, returned with validation failures such as error code 7.","items":{"type":"object","properties":{"parameter":{"type":"string","description":"Name of the parameter that failed validation."},"error":{"type":"string","description":"What was wrong with it."}}}}}}}}}}},"paths":{"/panel/dealer/activation_code/update":{"post":{"tags":["Dealer"],"summary":"Update activation codes","description":"Change the plan, bonus amount, and free period on a set of existing activation codes. A code is updated only if it is listed in `codes`, belongs to the current dealer, has not been activated yet, and has the same `device_type` as the new plan. Returns the number of codes actually updated, which can be lower than the number supplied.","operationId":"dealerActivationCodeUpdate","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["codes","tariff_id","bonus_amount","free_days"],"properties":{"codes":{"type":"array","description":"Codes to update.","items":{"type":"string"},"minItems":1},"tariff_id":{"type":"integer","description":"ID of the new plan. Must belong to the current dealer."},"bonus_amount":{"type":"integer","description":"New bonus amount."},"free_days":{"type":"integer","description":"New free period, in days.","minimum":0}}}}}},"responses":{"200":{"description":"Codes updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"`true` if request finished successfully.","readOnly":true},"count":{"type":"integer","description":"Number of codes actually updated.","readOnly":true}}}}}},"400":{"description":"Bad request. The response body carries the API-level error code in `status.code`. Validation failures also include an `errors` array.","$ref":"#/components/responses/ResponseError"},"403":{"description":"Operation not permitted, error code 13: the session lacks the required permission.","$ref":"#/components/responses/ResponseError"},"default":{"$ref":"#/components/responses/ResponseError"}}}}}}
```

#### Errors

* 201 - Not found in the database - when a plan with `tariff_id` is not found for the current dealer.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://navixy.com/docs/navixy-api/panel-api/resources/dealer/activation_code.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
