# Retenção

# Retenção | Schema V1 | 2025 - ∞

##### **Tipo Envio: Diário**

---

##### **Objeto Raiz**

<figure class="wp-block-table is-style-stripes" id="bkmrk-campo-informa%C3%A7%C3%B5es-ti"><table class="has-fixed-layout" style="width: 100%; height: 118.297px;"><thead><tr style="height: 29.7969px;"><td style="width: 26.3382%; height: 29.7969px;">**Campo**</td><td style="width: 73.6618%; height: 29.7969px;">**Informações**</td></tr></thead><tbody><tr style="height: 63.3906px;"><td style="width: 26.3382%; height: 63.3906px;">`timestamp`</td><td style="width: 73.6618%; height: 63.3906px;">Campo utilizado para **ordenar** a validação das informações enviadas. Caso sejam enviados **múltiplos payloads** do mesmo tipo, a ordenação ocorrerá da **<span style="color: rgb(186, 55, 42);">data mais antiga para a mais recente</span>**</td></tr><tr style="height: 25.1094px;"><td style="width: 26.3382%; height: 25.1094px;">`elementos`</td><td style="width: 73.6618%; height: 25.1094px;">–</td></tr></tbody></table>

</figure>---

##### **Item**  


<table class="min-w-full border-collapse text-sm leading-[1.7] whitespace-normal" id="bkmrk-campo-chave-informa%C3%A7" style="width: 100%; height: 281.438px;"><thead><tr style="height: 29.7969px;"><td class="text-text-100 border-b-0.5 border-border-300/60 py-2 pr-4 align-top font-bold" style="width: 24.1955%; height: 29.7969px;">**Campo**</td><td class="text-text-100 border-b-0.5 border-border-300/60 py-2 pr-4 align-top font-bold" style="width: 7.38975%; height: 29.7969px;">**Chave**</td><td class="text-text-100 border-b-0.5 border-border-300/60 py-2 pr-4 align-top font-bold" style="width: 68.4148%; height: 29.7969px;">**Informações**</td></tr></thead><tbody><tr style="height: 30.1094px;"><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top" style="width: 24.1955%; height: 30.1094px;">`codigoUnidadeOrcamentaria`</td><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top align-center" style="width: 7.38975%; height: 30.1094px;">✅</td><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top" style="width: 68.4148%; height: 30.1094px;">Código da **unidade orçamentária** cadastrada pela Unidade Gestora para o exercício</td></tr><tr style="height: 30.1094px;"><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top" style="width: 24.1955%; height: 30.1094px;">`numeroEmpenho`</td><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top align-center" style="width: 7.38975%; height: 30.1094px;">✅</td><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top" style="width: 68.4148%; height: 30.1094px;">–</td></tr><tr style="height: 30.1094px;"><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top" style="width: 24.1955%; height: 30.1094px;">`numeroPaganmento`</td><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top align-center" style="width: 7.38975%; height: 30.1094px;">✅</td><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top" style="width: 68.4148%; height: 30.1094px;">–</td></tr><tr style="height: 30.1094px;"><td style="width: 24.1955%; height: 30.1094px;">`numeroRetencao`</td><td class="align-center" style="width: 7.38975%; height: 30.1094px;">✅</td><td style="width: 68.4148%; height: 30.1094px;">–</td></tr><tr style="height: 24.3906px;"><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top" style="width: 24.1955%; height: 24.3906px;">`tipoRetencao`</td><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top align-center" style="width: 7.38975%; height: 24.3906px;">✅</td><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top" style="width: 68.4148%; height: 24.3906px;">**[Tabela Tipo Retenção](https://docs.tcepb.tc.br/books/tabelas-de-dominio/page/tipo-retencao)**</td></tr><tr style="height: 30.1094px;"><td style="width: 24.1955%; height: 30.1094px;">`dataRetencao`</td><td class="align-center" style="width: 7.38975%; height: 30.1094px;">–</td><td style="width: 68.4148%; height: 30.1094px;">–</td></tr><tr style="height: 30.1094px;"><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top" style="width: 24.1955%; height: 30.1094px;">`valorRetencao`</td><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top align-center" style="width: 7.38975%; height: 30.1094px;">–</td><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top" style="width: 68.4148%; height: 30.1094px;">–</td></tr><tr style="height: 46.5938px;"><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top" style="width: 24.1955%; height: 46.5938px;">`action`</td><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top align-center" style="width: 7.38975%; height: 46.5938px;">–</td><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top" style="width: 68.4148%; height: 46.5938px;">Define a operação a ser realizada com a informação, seja ela **criação, atualização ou exclusão**</td></tr></tbody></table>

##### **Schema**

```
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Retenções",
  "description": "Schema para envio de retenções por unidade gestora",
  "type": "object",
  "properties": {
    "timestamp": {
      "type": "string",
      "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])T([01]\\d|2[0-3]):([0-5]\\d):([0-5]\\d)\\.\\d{3,6}$",
      "examples": ["2025-09-11T15:30:00.123456"]
    },
    "elementos": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "object",
        "properties": {
          "codigoUnidadeOrcamentaria": {
            "type": "string",
            "minLength": 5,
            "maxLength": 5,
            "pattern": "^[0-9]+$"
          },
          "numeroEmpenho": {
            "type": "string",
            "minLength": 7,
            "maxLength": 7,
            "pattern": "^[0-9]+$"
          },
          "numeroPagamento": {
            "type": "string",
            "minLength": 7,
            "maxLength": 7,
            "pattern": "^[0-9]+$"
          },
          "numeroRetencao": {
            "type": "string",
            "minLength": 7,
            "maxLength": 7,
            "pattern": "^[0-9]+$"
          },
          "tipoRetencao": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1,
            "pattern": "^[0-9]+$"
          },
          "dataRetencao": {
            "type": "string",
            "format": "date"
          },
          "valorRetencao": {
            "type": "number",
            "exclusiveMinimum": 0
          },
          "action": {
            "type": "string",
            "enum": ["CREATE", "UPDATE", "DELETE"]
          }
        },
        "required": [
          "codigoUnidadeOrcamentaria",
          "numeroEmpenho",
          "numeroPagamento",
          "numeroRetencao",
          "tipoRetencao",
          "dataRetencao",
          "valorRetencao",
          "action"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": ["timestamp", "elementos"],
  "additionalProperties": false
}
```

---

##### **Exemplo de Payload**

```
{
  "timestamp": "2025-09-11T15:30:00.123456",
  "elementos": [
    {
      "codigoUnidadeOrcamentaria": "17050",
      "numeroEmpenho": "0001234",
      "numeroPagamento": "0000001",
      "numeroRetencao": "0000001",
      "tipoRetencao": "1",
      "dataRetencao": "2025-09-11",
      "valorRetencao": 1500.00,
      "action": "CREATE"
    }
  ]
}
```