> For the complete documentation index, see [llms.txt](https://help.starkbank.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.starkbank.com/integracao-e-apis/restricao-de-pagadores-na-invoice-via-api.md).

# Restrição de Pagadores na Invoice via API

Entenda como configurar nosso recurso de Allowed Tax ID via API para Invoices.

O recurso de Allowed Tax ID é uma camada avançada de segurança do Stark Bank que permite o controle total sobre a liquidação de suas Invoices. Ao configurar esta regra, o pagamento é processado apenas se o CPF ou CNPJ do pagador corresponder exatamente aos dados previamente autorizados, garantindo que terceiros não autorizados concluam a transação.

{% hint style="warning" %}
A configuração da regra de "Allowed Tax ID" está disponível exclusivamente via API. Não é possível aplicar esta restrição manualmente através do Internet Banking
{% endhint %}

***

#### O que é a regra de Allowed Tax ID?

Esta funcionalidade atua como uma trava de segurança. Caso uma pessoa ou empresa com um documento (Tax ID) diferente do autorizado tente realizar o pagamento da Invoice, a transação será rejeitada automaticamente pela rede bancária.

#### Como aplicar a regra via API

Para restringir os pagadores, o parâmetro `allowed_tax_ids` deve ser incluído dentro do objeto `rules` no momento da requisição de criação da Invoice.

Procedimento para implementação:

1. Identifique o CPF ou CNPJ do pagador autorizado;
2. No código de integração, localize o campo `rules`;
3. Adicione o parâmetro `allowed_tax_ids` enviando uma lista com os valores permitidos;
4. Realize o POST da Invoice para o endpoint correspondente.

**Exemplo de estrutura (JSON):**

JSON

```
{
  "amount": 1000,
  "rules": [
    {
      "key": "allowed_tax_ids",
      "value": ["123.456.789-01", "98.765.432/0001-00"]
    }
  ]
}
```

#### Pontos de Atenção

* Formatação: Os Tax IDs devem ser enviados como strings, incluindo a pontuação padrão (pontos e hifens).
* Múltiplos Pagadores: É possível listar mais de um documento caso queira permitir que um grupo específico de CPFs ou CNPJs realize o pagamento da mesma Invoice.
* Para detalhes adicionais sobre a implementação, consulte nossa [API Stark Bank - Invoice](https://starkbank.com/docs/api#invoice).


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.starkbank.com/integracao-e-apis/restricao-de-pagadores-na-invoice-via-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
