> 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/service-domain/current-account/operacoes/main-1.md).

# Retrieve Current Account Details

| Campo          | Valor                    |
| -------------- | ------------------------ |
| Service Domain | Current Account          |
| BIAN Version   | 14.0.0                   |
| Control Record | Current Account Facility |
| Operation      | Retrieve                 |
| Method         | GET                      |
| API Name       | Current Account API      |
| Versão         | v1.0.0                   |

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

O Serviço para consulta dos detalhes de uma conta corrente permite obter as informações de uma conta corrente (à ordem) previamente registada - dados de identificação, saldo, condicionalismos (limites e taxas), titulares e atributos adicionais de natureza regulatória.

| Campo        | Valor                                               |
| ------------ | --------------------------------------------------- |
| API Name     | Current Account API                                 |
| Versão       | v1.0.0                                              |
| Endpoint     | GET /v1/current-account/{currentAccountId}/retrieve |
| Autenticação | Bearer Token (OAuth 2.0 / OIDC)                     |

## 2. Cabeçalhos HTTP

| Header                          | Obrigatório | Notas                                           |
| ------------------------------- | ----------- | ----------------------------------------------- |
| `Authorization: Bearer {token}` | Sim         | OAuth2 / JWT client\_credentials para M2M       |
| `Accept: application/json`      | Sim         | -                                               |
| `x-channel`                     | Recomendado | Canal de origem (SOP, MOBILE, BACKOFFICE, etc.) |

## 3. Parâmetros do Pedido (Request)

Operação `GET` sem corpo de pedido. Identificação da conta feita via path parameter.

| Campo              | Tipo   | Obrigatório | Descrição                                                     |
| ------------------ | ------ | ----------- | ------------------------------------------------------------- |
| `currentAccountId` | string | Sim         | Identificador da conta corrente a consultar (path parameter). |

## 4. Payload de Resposta (Response - 200 OK)

### 4.1 Exemplo

```json
{
  "accountType": "CurrentAccount",
  "productInstanceReference": {
    "productReference": {
      "productType": "DO_AKZ",
      "productIdentification": {
        "productIdentification": { "identifierValue": "BANKITA" },
        "productIdentificationType": "ProductCode"
      },
      "productComponentReference": {
        "componentCode": "PART_AKZ_B",
        "componentDescription": "Dep. Ordem PARTICULARES - Bankita"
      }
    }
  },
  "currentAccountNumber": {
    "accountIdentificationType": "BBAN",
    "accountIdentification": { "identifierValue": "1234567890987" }
  },
  "accountIdentification": {
    "accountIdentificationType": "IBAN",
    "accountIdentification": { "identifierValue": "AO06004700000123456789098" }
  },
  "accountDate": {
    "accountDateType": "OpeningDate",
    "accountDate": { "dateContent": "2012-04-25" }
  },
  "accountStatus": "Normal",
  "customerAgreementReference": {
    "agreementType": "CustomerAgreement",
    "agreementIdentification": { "identifierValue": "12345678" },
    "involvedParty": {
      "accountInvolvementType": "PartyIsPrimaryOwnerOfAccount",
      "partyReference": {
        "partyName": { "name": "ANGELO AFONSO VIDAL" },
        "partyIdentification": {
          "partyIdentificationType": "PartyIdentificationNumber",
          "partyIdentification": { "identifierValue": "12345" }
        }
      }
    }
  },
  "accountCurrency": {
    "accountCurrencyType": "BaseCurrency",
    "accountCurrency": { "currencyCode": "AKZ" }
  },
  "bankBranchLocationReference": {
    "branchIdentification": { "identifierValue": "123" }
  },
  "accountBalances": [
    { "balanceAmount": { "amountValue": 998996684.02, "amountCurrency": { "currencyCode": "AKZ" } }, "balanceType": "AvailableBalance" },
    { "balanceAmount": { "amountValue": 998996684.02, "amountCurrency": { "currencyCode": "AKZ" } }, "balanceType": "ValueDateBalance" },
    { "balanceAmount": { "amountValue": 147804953.06, "amountCurrency": { "currencyCode": "AKZ" } }, "balanceType": "AverageBalanceByAccountBalance" },
    { "balanceAmount": { "amountValue": 147804953.06, "amountCurrency": { "currencyCode": "AKZ" } }, "balanceType": "AverageBalanceByValueDate" }
  ],
  "linkedAccounts": [
    { "accountIdentification": { "accountIdentificationType": "BBAN", "accountIdentification": { "identifierValue": "1234567890987" } }, "accountType": "CreditorRelatedAccount" },
    { "accountIdentification": { "accountIdentificationType": "BBAN", "accountIdentification": { "identifierValue": "1234567890987" } }, "accountType": "DebtorRelatedAccount" }
  ],
  "limitSettings": {
    "limitType": "Overdraft",
    "limitAmount": { "amountValue": 0, "amountCurrency": { "currencyCode": "AKZ" } },
    "limitCreditDebitIndicator": "Debit",
    "limitAmountType": "Principal",
    "chequeServiceLimit": { "maxNumOfChequesPerMonth": 0 }
  },
  "accountRiskClassification": {
    "riskLevelCode": "C",
    "riskLevelDescription": "Reduzido"
  },
  "accountAdditionalAttribute": [
    { "attributeCode": "ESTGI", "attributeDescription": "Estagio da Operação", "attributeValue": "1" },
    { "attributeCode": "IMPAR", "attributeDescription": "Valor Imparidade", "attributeValue": "0" },
    { "attributeCode": "INSTF", "attributeDescription": "Classificação Instrumento Fin.", "attributeValue": "00 - Custo Amortizado" },
    { "attributeCode": "MODEL", "attributeDescription": "Modelo de Negócio", "attributeValue": "00 - Detenção p/ receber os Fluxos caixa" },
    { "attributeCode": "POCI", "attributeDescription": "Imparidade de Crédito", "attributeValue": "00 - Não" },
    { "attributeCode": "SPPI", "attributeDescription": "Exclusivamente Capital e Juros", "attributeValue": "00 - Cumpre SPPI" },
    { "attributeCode": "SPPIM", "attributeDescription": "Motivo do Pagamento de Juros", "attributeValue": "01 - Receber Cash-flow" },
    { "attributeCode": "INDEXA", "attributeDescription": "CIRC-Indexação", "attributeValue": "00973" },
    { "attributeCode": "LTGJUD", "attributeDescription": "CIRC-Contrato litígio judicial", "attributeValue": "0" },
    { "attributeCode": "MCAPPE", "attributeDescription": "CIRC-Montante capital perdoado", "attributeValue": "0" },
    { "attributeCode": "MJURPE", "attributeDescription": "CIRC-Montante de juro perdoado", "attributeValue": "0" },
    { "attributeCode": "TXACAP", "attributeDescription": "CIRC-Taxa amortização capital", "attributeValue": "0" }
  ]
}
```

### 4.2 Objecto Raiz

| Campo                         | Tipo          | Obrigatório | Descrição                                                 |
| ----------------------------- | ------------- | ----------- | --------------------------------------------------------- |
| `accountType`                 | string (enum) | Sim         | Tipo de conta (ex: `CurrentAccount`).                     |
| `productInstanceReference`    | object        | Sim         | Referência ao produto contratado associado à conta.       |
| `currentAccountNumber`        | object        | Sim         | Número interno da conta.                                  |
| `accountIdentification`       | object        | Sim         | Identificação externa/normalizada da conta (IBAN).        |
| `accountDate`                 | object        | Sim         | Data relevante da conta (ex: abertura).                   |
| `accountStatus`               | string (enum) | Sim         | Estado actual da conta.                                   |
| `customerAgreementReference`  | object        | Sim         | Contrato associado.                                       |
| `accountCurrency`             | object        | Sim         | Moeda base da conta.                                      |
| `bankBranchLocationReference` | object        | Sim         | Agência/balcão de domiciliação da conta.                  |
| `accountBalances`             | array         | Sim         | Lista de saldos da conta por tipo.                        |
| `linkedAccounts`              | array         | Não         | Contas relacionadas.                                      |
| `limitSettings`               | object        | Não         | Condicionalismo de limite (ex: descoberto autorizado).    |
| `accountRiskClassification`   | object        | Não         | Classificação de risco da conta.                          |
| `accountAdditionalAttribute`  | array         | Não         | Contentor de extensibilidade para atributos regulatórios. |

### 4.3 Objecto: `productInstanceReference.productReference`

| Campo                                                         | Tipo   | Obrigatório | Descrição                                                                    |
| ------------------------------------------------------------- | ------ | ----------- | ---------------------------------------------------------------------------- |
| `productType`                                                 | string | Sim         | Código interno do tipo de produto (ex: `DO_AKZ`).                            |
| `productIdentification.productIdentification.identifierValue` | string | Sim         | Código comercial do produto (ex: `BANKITA`).                                 |
| `productIdentification.productIdentificationType`             | string | Sim         | Tipo de identificador do produto (ex: `ProductCode`).                        |
| `productComponentReference.componentCode`                     | string | Sim         | Código do componente de produto.                                             |
| `productComponentReference.componentDescription`              | string | Não         | Descrição comercial do componente (ex: "Dep. Ordem PARTICULARES - Bankita"). |

### 4.4 Objecto: `currentAccountNumber` / `accountIdentification`

| Campo                                   | Tipo          | Obrigatório | Descrição                                                                                    |
| --------------------------------------- | ------------- | ----------- | -------------------------------------------------------------------------------------------- |
| `accountIdentificationType`             | string (enum) | Sim         | Tipo de identificador (`BBAN` em `currentAccountNumber`; `IBAN` em `accountIdentification`). |
| `accountIdentification.identifierValue` | string        | Sim         | Valor do identificador da conta.                                                             |

### 4.5 Objecto: `accountDate`

| Campo                     | Tipo              | Obrigatório | Descrição                            |
| ------------------------- | ----------------- | ----------- | ------------------------------------ |
| `accountDateType`         | string (enum)     | Sim         | Tipo de data (ex: `OpeningDate`).    |
| `accountDate.dateContent` | string (ISO 8601) | Sim         | Valor da data. Formato `YYYY-MM-DD`. |

### 4.6 Objecto: `customerAgreementReference`

| Campo                                                                                  | Tipo          | Obrigatório | Descrição                                                             |
| -------------------------------------------------------------------------------------- | ------------- | ----------- | --------------------------------------------------------------------- |
| `agreementType`                                                                        | string        | Sim         | Tipo de acordo (ex: `CustomerAgreement`).                             |
| `agreementIdentification.identifierValue`                                              | string        | Sim         | Número do contrato associado à conta.                                 |
| `involvedParty.accountInvolvementType`                                                 | string (enum) | Sim         | Papel do interveniente na conta (ex: `PartyIsPrimaryOwnerOfAccount`). |
| `involvedParty.partyReference.partyName.name`                                          | string        | Sim         | Nome do titular.                                                      |
| `involvedParty.partyReference.partyIdentification.partyIdentificationType`             | string (enum) | Sim         | Tipo de identificação da entidade.                                    |
| `involvedParty.partyReference.partyIdentification.partyIdentification.identifierValue` | string        | Sim         | Número de identificação da entidade.                                  |

### 4.7 Objecto: `accountCurrency` / `bankBranchLocationReference`

| Campo                                                              | Tipo          | Obrigatório | Descrição                             |
| ------------------------------------------------------------------ | ------------- | ----------- | ------------------------------------- |
| `accountCurrencyType`                                              | string (enum) | Sim         | Tipo de moeda (ex: `BaseCurrency`).   |
| `accountCurrency.currencyCode`                                     | string        | Sim         | Código de moeda da conta (ex: `AKZ`). |
| `bankBranchLocationReference.branchIdentification.identifierValue` | string        | Sim         | Código do balcão de domiciliação.     |

### 4.8 Objecto: `accountBalances[]`

| Campo                                       | Tipo          | Obrigatório | Descrição                                                                                                             |
| ------------------------------------------- | ------------- | ----------- | --------------------------------------------------------------------------------------------------------------------- |
| `balanceAmount.amountValue`                 | BigDecimal    | Sim         | Valor do saldo.                                                                                                       |
| `balanceAmount.amountCurrency.currencyCode` | string        | Sim         | Moeda do saldo.                                                                                                       |
| `balanceType`                               | string (enum) | Sim         | Tipo de saldo: `AvailableBalance`, `ValueDateBalance`, `AverageBalanceByAccountBalance`, `AverageBalanceByValueDate`. |

### 4.9 Objecto: `linkedAccounts[]`

| Campo                                                         | Tipo          | Obrigatório | Descrição                                                                     |
| ------------------------------------------------------------- | ------------- | ----------- | ----------------------------------------------------------------------------- |
| `accountIdentification.accountIdentificationType`             | string (enum) | Sim         | Tipo de identificador da conta ligada (ex: `BBAN`).                           |
| `accountIdentification.accountIdentification.identifierValue` | string        | Sim         | Número da conta ligada.                                                       |
| `accountType`                                                 | string (enum) | Sim         | Papel da conta ligada (ex: `CreditorRelatedAccount`, `DebtorRelatedAccount`). |

### 4.10 Objecto: `limitSettings`

| Campo                                        | Tipo          | Obrigatório | Descrição                                     |
| -------------------------------------------- | ------------- | ----------- | --------------------------------------------- |
| `limitType`                                  | string (enum) | Sim         | Tipo de limite (ex: `Overdraft`).             |
| `limitAmount.amountValue`                    | BigDecimal    | Sim         | Valor do limite.                              |
| `limitAmount.amountCurrency.currencyCode`    | string        | Sim         | Moeda do limite.                              |
| `limitCreditDebitIndicator`                  | string (enum) | Sim         | Indicador (`Debit`/`Credit`).                 |
| `limitAmountType`                            | string        | Sim         | Tipo de montante do limite (ex: `Principal`). |
| `chequeServiceLimit.maxNumOfChequesPerMonth` | integer       | Não         | Número máximo de cheques autorizados por mês. |

### 4.11 Objecto: `accountRiskClassification`

| Campo                  | Tipo          | Obrigatório | Descrição                                     |
| ---------------------- | ------------- | ----------- | --------------------------------------------- |
| `riskLevelCode`        | string (enum) | Sim         | Código do nível de risco (ver tabela 4.11.1). |
| `riskLevelDescription` | string        | Sim         | Descrição correspondente ao código de risco.  |

**4.11.1 Tabela de Classificação de Risco (`AccountRisks`)**

| Código | Descrição      |
| ------ | -------------- |
| A      | Nulo           |
| B      | Muito Reduzido |
| C      | Reduzido       |
| D      | Moderado       |
| E      | Elevado        |
| F      | Muito Elevado  |
| G      | Perda          |

### 4.12 Objecto: `accountAdditionalAttribute[]`

Contentor de extensibilidade - segue o padrão `attributeCode` / `attributeDescription` / `attributeValue` para campos regulatórios.

| Campo                  | Tipo   | Obrigatório | Descrição                                                  |
| ---------------------- | ------ | ----------- | ---------------------------------------------------------- |
| `attributeCode`        | string | Sim         | Código curto do atributo (ex: `ESTGI`, `IMPAR`, `INDEXA`). |
| `attributeDescription` | string | Sim         | Descrição legível do atributo.                             |
| `attributeValue`       | string | Sim         | Valor do atributo.                                         |

## 5. Códigos HTTP de Resposta

| Código | Estado                | Descrição                                            |
| ------ | --------------------- | ---------------------------------------------------- |
| 200    | OK                    | Conta corrente encontrada e devolvida com sucesso.   |
| 400    | Bad Request           | Parâmetro `currentAccountId` inválido ou malformado. |
| 401    | Unauthorized          | Token ausente, expirado ou inválido.                 |
| 500    | Internal Server Error | Erro inesperado no sistema.                          |
| 502    | Bad Gateway           | Resposta inválida ou indisponibilidade do serviço.   |
| 504    | Gateway Timeout       | Timeout na chamada do serviço.                       |

## 6. Envelope Padrão de Erro - Exemplo

```json
{
  "status": 400,
  "reason": "BAD_REQUEST",
  "message": "Conta corrente não encontrada para o identificador indicado.",
  "path": "/v1/current-account/{currentAccountId}",
  "errordetail": [
    {
      "code": "GB1234",
      "reason": "ACCOUNT_NOT_FOUND",
      "message": "currentAccountId 'XXXXXXXX' não corresponde a nenhuma conta activa."
    }
  ]
}
```

### 6.1 Estrutura do Envelope de Erro

| Campo                   | Tipo    | Descrição                                                               |
| ----------------------- | ------- | ----------------------------------------------------------------------- |
| `status`                | integer | Código HTTP do erro.                                                    |
| `reason`                | string  | Código textual de alto nível que identifica a categoria do erro.        |
| `message`               | string  | Mensagem legível que descreve o problema ocorrido.                      |
| `path`                  | string  | Caminho do endpoint que originou o erro.                                |
| `errordetail[]`         | array   | Lista de erros detalhados. Pode estar ausente em erros genéricos (500). |
| `errordetail[].code`    | string  | Código específico do domínio (ex: `CA-404-001`).                        |
| `errordetail[].reason`  | string  | Identificador textual da causa específica do erro.                      |
| `errordetail[].message` | string  | Mensagem detalhada com valores concretos quando aplicável.              |

## 7. Requisitos Não-Funcionais

| Requisito    | Detalhe                                                                  |
| ------------ | ------------------------------------------------------------------------ |
| HTTPS / TLS  | Obrigatório TLS 1.2 ou superior em todas as comunicações.                |
| Bearer Token | Obrigatório. Pedidos sem token ou com token inválido retornam 401.       |
| Auditoria    | Registo persistente obrigatório de todas as consultas (log estruturado). |
