> For the complete documentation index, see [llms.txt](https://selenium-4.gitbook.io/nexus-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://selenium-4.gitbook.io/nexus-docs/docs/corporate-trust-services/release-captive-account/main.md).

# Release Captive Account

| Campo              | Valor                                                                                                       |
| ------------------ | ----------------------------------------------------------------------------------------------------------- |
| **Service Domain** | Corporate Trust Services                                                                                    |
| **BIAN Version**   | 14                                                                                                          |
| **Operation**      | Release Captive Account                                                                                     |
| **Method**         | POST                                                                                                        |
| **API Name**       | Corporate Trust Services API                                                                                |
| **Endpoint**       | `POST /corporate-trust/{corporateTrustServicesFacilityId}/escrow-arrangement/{escrowArrangementId}/execute` |
| **Autenticação**   | Bearer Token (OAuth2 ou JWT)                                                                                |

***

## 1. Descrição da Operação

A API **Captive Account Release** permite a libertação (descativo) de valores previamente cativados numa conta cativa associada a uma conta corrente.

Esta operação está alinhada ao Service Domain **Corporate Trust Services** definido pelo **BIAN**.

A API permite:

* Libertar valores cativos;
* Validar condições;
* Registrar autorização;
* Atualizar estado do cativo;
* Movimentar valores.

A operação permite libertar valores previamente cativados quando:

* A maturidade é atingida;
* A condição é cumprida;
* O cliente autoriza;
* O contrato permite.

***

## 2. Cabeçalhos HTTP

| Header          | Tipo   | Obrigatório | Descrição                   |
| --------------- | ------ | ----------- | --------------------------- |
| `Authorization` | String | Sim         | Bearer Token                |
| `Content-Type`  | String | Sim         | `application/json`          |
| `Accept`        | String | Sim         | `application/json`          |
| `x-request-id`  | String | Não         | Identificador da requisição |
| `x-channel`     | String | Não         | Canal                       |

**Exemplo de Autorização**

```
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
```

***

## 3. Path Parameters

| Parâmetro                          | Tipo   | Obrigatório | Descrição                                                                                                   |
| ---------------------------------- | ------ | ----------- | ----------------------------------------------------------------------------------------------------------- |
| `corporateTrustServicesFacilityId` | string | Sim         | Identificador da facilidade de Corporate Trust Services (conta cativa) sobre a qual a operação é executada. |
| `escrowArrangementId`              | string | Sim         | Identificador do acordo de escrow/cativo (escrow arrangement) a libertar.                                   |

***

## 4. Payload de Pedido (Request)

### 4.1 Exemplo

```json
{
  "corporateTrustServicesFacilityReference": {
    "financialFacility": "CaptiveAccount"
  },
  "escrowReference": "ESC-2026-AKZ-00123",
  "escrowType": "CaptiveRelease",
  "currentAccountNumber": {
    "accountIdentificationType": "BBAN",
    "accountIdentification": {
      "identifierValue": {
        "value": "8067305810001"
      }
    }
  },
  "accountType": "IndividualCurrentAccount",
  "accountStatus": "Enabled",
  "accountCurrency": {
    "currencyCode": "AKZ"
  },
  "customerAgreementReference": {
    "agreementIdentification": {
      "identifierValue": {
        "value": "80673058"
      }
    },
    "agreementType": "CustomerAgreement"
  },
  "financialAccountingTransaction": {
    "financialAccountingTransactionAmountAndCurrency": {
      "amount": {
        "amountValue": {
          "value": 190000.0
        },
        "amountCurrency": {
          "currencyCode": "AKZ"
        }
      },
      "transactionDirection": "Release",
      "transactionType": "EscrowRelease"
    }
  },
  "preconditions": {
    "conditionValidityPeriod": {
      "fromDateTime": {
        "dateTimeContent": "2026-01-01"
      },
      "toDateTime": {
        "dateTimeContent": "2026-12-31"
      },
      "dateTimeType": "MaturityDate"
    },
    "conditionStatus": "Maturity"
  },
  "partyAuthorization": {
    "authorizationParty": {
      "partyIdentification": {
        "identifierValue": {
          "value": "80673058"
        }
      },
      "partyName": "ANA KAKUTALA"
    },
    "authorizationType": "AccountOwnerConsent",
    "authorizationStatus": "Granted",
    "authorizationDateTime": {
      "dateTimeContent": "2026-03-02"
    },
    "authorizationChannel": "Digital"
  },
  "captiveReleaseDetails": {
    "releaseReason": "MaturityReached",
    "releaseDateTime": {
      "dateTimeContent": "2026-12-31"
    },
    "releaseStatus": "Released",
    "releaseAuthorisedBy": {
      "partyIdentification": {
        "identifierValue": {
          "value": "80673058"
        }
      },
      "partyName": "ANA KAKUTALA"
    },
    "releaseChannel": "Digital"
  }
}
```

### 4.2 Descrição dos Campos

| Campo                            | Tipo   | Obrigatório | Descrição            |
| -------------------------------- | ------ | ----------- | -------------------- |
| `EscrowReference`                | String | Sim         | Referência do cativo |
| `EscrowType`                     | String | Sim         | Tipo                 |
| `CurrentAccountNumber`           | Object | Sim         | Conta                |
| `FinancialAccountingTransaction` | Object | Sim         | Valor                |
| `Preconditions`                  | Object | Sim         | Condições            |
| `PartyAuthorization`             | Object | Sim         | Autorização          |
| `CaptiveReleaseDetails`          | Object | Sim         | Detalhes             |

### 4.3 Tabela de Objetos e Cardinalidade

| Objeto         | Campo                            | Tipo   | Cardinalidade | Descrição   |
| -------------- | -------------------------------- | ------ | ------------- | ----------- |
| CaptiveRelease | `EscrowReference`                | String | 1..1          | Referência  |
| CaptiveRelease | `EscrowType`                     | String | 1..1          | Tipo        |
| CaptiveRelease | `CurrentAccountNumber`           | Object | 1..1          | Conta       |
| CaptiveRelease | `FinancialAccountingTransaction` | Object | 1..1          | Valor       |
| CaptiveRelease | `Preconditions`                  | Object | 1..1          | Condições   |
| CaptiveRelease | `PartyAuthorization`             | Object | 1..1          | Autorização |
| CaptiveRelease | `CaptiveReleaseDetails`          | Object | 1..1          | Detalhes    |

### 4.4 Estrutura de Objetos

**`CurrentAccountNumber`**

| Campo                       | Tipo   | Cardinalidade | Descrição |
| --------------------------- | ------ | ------------- | --------- |
| `AccountIdentificationType` | String | 1..1          | Tipo      |
| `IdentifierValue`           | String | 1..1          | Conta     |

**`FinancialAccountingTransaction`**

| Campo                  | Tipo    | Cardinalidade | Descrição |
| ---------------------- | ------- | ------------- | --------- |
| `AmountValue`          | Decimal | 1..1          | Valor     |
| `CurrencyCode`         | String  | 1..1          | Moeda     |
| `TransactionDirection` | String  | 1..1          | Direção   |
| `TransactionType`      | String  | 1..1          | Tipo      |

**`Preconditions`**

| Campo             | Tipo   | Cardinalidade | Descrição |
| ----------------- | ------ | ------------- | --------- |
| `FromDateTime`    | Date   | 1..1          | Início    |
| `ToDateTime`      | Date   | 1..1          | Fim       |
| `ConditionStatus` | String | 1..1          | Estado    |

**`PartyAuthorization`**

| Campo                   | Tipo   | Cardinalidade | Descrição |
| ----------------------- | ------ | ------------- | --------- |
| `PartyIdentification`   | String | 1..1          | Cliente   |
| `PartyName`             | String | 1..1          | Nome      |
| `AuthorizationType`     | String | 1..1          | Tipo      |
| `AuthorizationStatus`   | String | 1..1          | Estado    |
| `AuthorizationDateTime` | Date   | 1..1          | Data      |
| `AuthorizationChannel`  | String | 1..1          | Canal     |

**`CaptiveReleaseDetails`**

| Campo             | Tipo   | Cardinalidade | Descrição |
| ----------------- | ------ | ------------- | --------- |
| `ReleaseReason`   | String | 1..1          | Motivo    |
| `ReleaseDateTime` | Date   | 1..1          | Data      |
| `ReleaseStatus`   | String | 1..1          | Estado    |
| `ReleaseChannel`  | String | 1..1          | Canal     |

***

## 5. Payload de Resposta (Response — 200 OK)

```json
{
  "escrowReference": "ESC-2026-AKZ-00123",
  "releaseStatus": "Released",
  "releaseDate": "2026-12-31"
}
```

***

## 6. Cenários de Utilização

**Libertação por Maturidade**

Fluxo:

1. Sistema chama API;
2. API valida datas;
3. API valida autorização;
4. API liberta valores;
5. API retorna sucesso.

**Libertação Manual**

Fluxo:

1. Operador autoriza;
2. API executa;
3. API liberta.

**Libertação Automática**

Fluxo:

1. Scheduler detecta maturidade;
2. API executa;
3. API liberta.

***

## 7. Fluxo Sequencial

1. Cliente envia request;
2. API valida token;
3. API valida payload;
4. API valida cativo;
5. API valida condição;
6. API valida autorização;
7. API liberta valor;
8. API atualiza estado;
9. API retorna sucesso.

***

## 8. Códigos HTTP de Resposta

| Código | Descrição             |
| ------ | --------------------- |
| 200    | Sucesso               |
| 400    | Pedido inválido       |
| 401    | Não autorizado        |
| 403    | Proibido              |
| 404    | Cativo não encontrado |
| 409    | Já libertado          |
| 500    | Erro interno          |

***

## 9. Envelope Padrão de Erro

**Cenário: Invalid value**

```json
{
  "error": {
    "status": 400,
    "reason": "INVALID_VALUE",
    "message": "Invalid Srci-Client Id",
    "path": "POST /v1/corporate-trust/988776/escrow-arrangement/initiate",
    "errordetail": [
      {
        "code": "123332",
        "reason": "INVALID_VALUE",
        "message": "Invalid Srci-Client Id"
      }
    ]
  }
}
```

**Cenário: Erro Interno**

```json
{
  "error": {
    "status": 500,
    "reason": "INVALID_STATE",
    "message": "Internal server error. Typically a server bug. The client should report this error to the Mastercard support team",
    "path": "GET /v1/corporate-trust/988776/escrow-arrangement/initiate"
  }
}
```

> Nota: os exemplos de erro acima são os documentados na fonte para este domínio; o campo `path` reflete o valor tal como registado na origem.

### 9.1 Estrutura do Envelope de Erro

| Campo                         | Tipo    | Descrição                                                        |
| ----------------------------- | ------- | ---------------------------------------------------------------- |
| `error.status`                | integer | Código HTTP do erro.                                             |
| `error.reason`                | string  | Código textual de alto nível que identifica a categoria do erro. |
| `error.message`               | string  | Mensagem legível que descreve o problema ocorrido.               |
| `error.path`                  | string  | Método HTTP e caminho do endpoint que originou o erro.           |
| `error.errordetail[]`         | array   | Lista de erros detalhados.                                       |
| `error.errordetail[].code`    | string  | Código do erro.                                                  |
| `error.errordetail[].reason`  | string  | Identificador textual da causa específica do erro.               |
| `error.errordetail[].message` | string  | Mensagem detalhada do erro.                                      |

***

## 10. Regras de Negócio

* Cativo deve existir;
* Deve estar ativo;
* Condição deve ser cumprida;
* Cliente deve autorizar;
* Conta deve existir;
* Conta deve estar ativa.

### 10.1 Tipos de Release

| Tipo              | Descrição    |
| ----------------- | ------------ |
| `MaturityReached` | Maturidade   |
| `ManualRelease`   | Manual       |
| `ContractEnd`     | Fim contrato |

***

## 11. Requisitos Não-Funcionais

* HTTPS obrigatório;
* Bearer Token obrigatório;
* Auditoria obrigatória;
* Logging obrigatório.

***

## 12. Mapeamento BIAN

| BIAN                             | API                              |
| -------------------------------- | -------------------------------- |
| `CorporateTrustServicesFacility` | `Captive`                        |
| `EscrowAccount`                  | `EscrowReference`                |
| `AccountReference`               | `CurrentAccountNumber`           |
| `Agreement`                      | `CustomerAgreementReference`     |
| `Transaction`                    | `FinancialAccountingTransaction` |
| `Authorization`                  | `PartyAuthorization`             |
| `EscrowRelease`                  | `CaptiveReleaseDetails`          |


---

# 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://selenium-4.gitbook.io/nexus-docs/docs/corporate-trust-services/release-captive-account/main.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.
