# 3. Привязка самозанятого к маркетплейсу по ИНН

[**https://my.payanyway.ru/npdapi/postbindpartnerwithinn**](https://my.payanyway.ru/npdapi/postbindpartnerwithinn)&#x20;

Принимаемые параметры:

* key - (security\_key) (строка, до 32-х символов)
* inn - ИНН самозанятого (строка до 12-ти символов)
* phone - номер телефона в формате: код страны, код оператора, номер
* signature - подпись запроса (строка, до 32-х символов)

Ответ на запрос:

* requestId - ID запроса - нужен для идентификации url уведомлений, которые придут в ответ на данный запрос (число, до 11-ти знаков)
* methodName - имя запроса (строка, до 32-х символов)
* requestStatus - статус запроса - может иметь одно из значений: NEW (создан новый запрос), ACTIVE - запрос сработал, DONE - запрос завершен и NO\_MESSAGE\_ID (не был получен ID сообщения от АИС “Налог-3” - в этом случае запрос до АИС “Налог-3” будет повторяться автоматически до получения ID сообщения от АИС “Налог-3”, но не более 300-т раз) (строка, до 32-х символов)
* methodId - ID сообщения от АИС “Налог-3” (строка, до 50-ти символов)
* debugData - данные для отладки - массив json, имеющий следующую структуру:
  * token - (строка, до 32-х символов)
  * userIdentity - (строка, до 255-ти символов)
* result - данные с результатами выполнения запроса - массив json, имеющий следующую структуру:
  * Body - json массив
    * GetMessageResponse - json массив
      * ProcessingStatus - (строка, до 32-х символов)
      * Message - json массив
        * PostBindPartnerWithInnResponse - json массив
          * Id - (строка, до 19-ти символов)

Пример ответа:

```
{"requestId":16266,"methodName":"postbindpartnerwithinn","requestStatus":"ACTIVE","methodId":"86da7739-1dfb-4756-be39-f63a550f980e",
"debugData":{"token":"7c0d83e5bd1a4d54af80e462dc131033","userIdentity":"aW5zdGE="},
"result":{"Body":{"GetMessageResponse":{"ProcessingStatus":"COMPLETED","Message":{"PostBindPartnerWithInnResponse":{"Id":"307542"}},"FileLinks":[]}}}}
```

URL - уведомления, которое придут на данный запрос:

Будут отправлены URL - уведомления 2-х типов - оригинальное в формате АИС Налог-3 и уведомление от NPD API с указанием имени нотификации: userlinked / userunlinked (пользователь подключен / отключен).

Структура уведомлений:

1. Уведомление с оригинальными данными от АИС “Налог-3” при успешной привязке:

* requestId - ID запроса (число, до 11-ти знаков)
* requestMessageId - ID сообщения от АИС “Налог-3” (строка, до 50-ти символов)
* debugData
  * token - (строка, до 32-х символов)
  * userIdentity - (строка, до 255-ти символов)
* result - json массив
  * Body - json массив
    * GetMessageResponse - json массив
      * ProcessingStatus - (строка, до 32-х символов)
      * Message - json массив
        * PostBindPartnerWithPhoneResponse - json массив
          * Id - (строка, до 19-ти символов)

Пример:&#x20;

```
{
   "requestId":16265,
   "requestMessageId":"1f5c19a7-017e-4392-959d-fc7e7555dd33",
   "result":{
      "Body":{
         "GetMessageResponse":{
            "ProcessingStatus":"COMPLETED",
            "Message":{
               "PostBindPartnerWithPhoneResponse":{
                  "Id":"307541"
               }
            },
            "FileLinks":[
               
            ]
         }
      }
   },
   "debugData":{
      "token":"7c0d83e5bd1a4d54af80e462dc131033",
      "userIdentity":"aW5zdGE="
   }
}
```

1. Уведомление с оригинальными данными от АИС “Налог-3” при отказе:

* requestId - ID запроса (число, до 11-ти знаков)
* requestMessageId - ID сообщения от АИС “Налог-3” (строка, до 50-ти символов)
* debugData
  * token - (строка, до 32-х символов)
  * userIdentity - (строка, до 255-ти символов)
* result
  * Body - json массив
    * GetMessageResponse - json массив
      * ProcessingStatus - (строка, до 32-х символов)
      * Message - json массив
        * SmzPlatformError - json массив
          * Code - (строка, до 32-х символов)
          * Message - (строка, text 16384 символа)
          * Args - json массив - список пар ключ-значение (может отсутствовать)
            * Key - (строка, до 32-х символов)
            * Value - (строка, text 16384 символа)

Пример:&#x20;

```
{
   "requestId":45,
   "requestMessageId":"3caa99ed-fb66-495f-92a6-cbb84f0d9e40",
   "result":{
      "Body":{
         "GetMessageResponse":{
            "ProcessingStatus":"COMPLETED",
            "Message":{
               "SmzPlatformError":{
                  "Code":"TAXPAYER_ALREADY_BOUND",
                  "Message":"\u041d\u0430\u043b\u043e\u0433\u043e\u043f\u043b\u0430\u0442\u0435\u043b\u044c\u0449\u0438\u043a \u0441 \u0418\u041d\u041d 121501829526 \u0443\u0436\u0435 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u043a \u043f\u0430\u0440\u0442\u043d\u0435\u0440\u0443",
                  "Args":{
                     "Key":"INN",
                     "Value":"121501829526"
                  }
               }
            },
            "FileLinks":[
               
            ]
         }
      }
   },
   "debugData":{
      "token":"4b41d217347a415a8f245f42afc4ba36",
      "userIdentity":"insta"
   }
}
```

Пример при отказе самозанятого от привязки:

```
{
   "requestId":16712,
   "requestMessageId":"5c8e99cc-d6f3-4c84-9288-2cb5624b6987",
   "result":{
      "Body":{
         "GetMessageResponse":{
            "ProcessingStatus":"COMPLETED",
            "Message":{
               "SmzPlatformError":{
                  "Code":"TAXPAYER_UNBOUND",
                  "Message":"\u041f\u0430\u0440\u0442\u043d\u0435\u0440 \u043d\u0435 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u043a \u043d\u0430\u043b\u043e\u0433\u043e\u043f\u043b\u0430\u0442\u0435\u043b\u044c\u0449\u0438\u043a\u0443 c \u0418\u041d\u041d 121501829526",
                  "Args":{
                     "Key":"INN",
                     "Value":"121501829526"
                  }
               }
            },
            "FileLinks":[
               
            ]
         }
      }
   },
   "debugData":{
      "token":"c71f39d39451494c9a06078cef921362",
      "userIdentity":"aW5zdGE="
   }
}
```


---

# 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://docs.payanyway.ru/marketplace/samozanyatye/scenarii-ispolzovaniya-npd-api/3.-privyazka-samozanyatogo-po-inn-delaem-na-forme-vvoda-inn.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.
