> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lerian.studio/llms.txt
> Use this file to discover all available pages before exploring further.

# CCS Reports

> Build CCS XML files (ACCS001, ACCS005, ACCS010) for BACEN by combining Lerian CRM and Midaz data through Reporter templates and scheduled generation.

Reporter enables you to generate XML-based CCS (Cadastro de Clientes do Sistema Financeiro Nacional) files as defined by the Central Bank of Brazil (BACEN).

This guide shows how to create automated CCS reports with Reporter: ACCS001, ACCS005, and ACCS010. You combine CRM data (holders and aliases) with Midaz structures.

<Danger>
  CCS reports must strictly follow the layouts defined by BACEN. Reporter lets you automate the XML generation, but you remain responsible for validating the output and ensuring compliance with regulatory requirements.
</Danger>

## What is CCS?

***

The **CCS (Cadastro de Clientes do Sistema Financeiro Nacional)** is a registry that maps **relationships between customers and financial institutions**.

Its purpose is to allow regulators and other authorized entities to identify **where a customer holds financial relationships**.

Institutions must submit CCS reports in XML format, following BACEN’s ACCS schemas. Each file type has a specific function — from daily updates to relationship transfers.

Reporter makes this process automated and standardized, ensuring that CCS submissions are both **technically valid** and **business-aligned**.

## ACCS001: Daily update file

***

### What it is

The ACCS001 is the **daily update file**. It reports inclusions, changes, or exclusions of customer relationships (individual or corporate) with the institution. This is the most frequent CCS file, keeping the registry in sync with daily operations.

### Full template

```
{# reporter:output-encoding=utf-16be #}<?xml version="1.0" encoding="UTF-16"?>
<CCSDOC xmlns="http://www.bcb.gov.br/ccs/ACCS001.xsd">
    <BCARQ>
        <IdentdEmissor>12345678</IdentdEmissor>
        <IdentdDestinatario>00000000</IdentdDestinatario>
        <NomArq>ACCS001</NomArq>
        <NumRemessaArq>12233444</NumRemessaArq>
    </BCARQ>
    <SISARQ>
        <CCSArqAtlzDiaria>
            <Repet_ACCS001_Pessoa>
{%- for alias in plugin_crm.aliases -%}
{%- for holder in plugin_crm.holders -%}
{%- if holder.document == alias.document %}
                <Grupo_ACCS001_Pessoa>
                    <TpOpCCS>I</TpOpCCS>
                    <QualifdrOpCCS>N</QualifdrOpCCS>
                    <TpPessoa>{%- if holder.type == "NATURAL_PERSON" -%}F{%- else -%}J{%- endif -%}</TpPessoa>
                    <CNPJ_CPFPessoa>{{holder.document}}</CNPJ_CPFPessoa>
                    <DtIni>{{alias.banking_details.opening_date}}</DtIni>
                    <DtFim></DtFim>
                </Grupo_ACCS001_Pessoa>
{%- endif -%}
{%- endfor %}
{%- endfor %}
            </Repet_ACCS001_Pessoa>
            <QtdOpCCS>{% count_by plugin_crm.aliases %}</QtdOpCCS>
            <DtMovto>{% date_time "YYYY-MM-dd" %}</DtMovto>
        </CCSArqAtlzDiaria>
    </SISARQ>
</CCSDOC>
```

### Applied logic

Nested loops cross-reference plugin\_crm.aliases (accounts) with plugin\_crm.holders (holders), enabling accurate association between account data and their respective owners.

* The `<TpPessoa>` field is conditional:
  * F for **natural persons**
  * J for **legal entities**
* **Fixed values in this example:**
  * `<TpOpCCS>` = I (Inclusion)

    This scenario sets the field to I. The field must still reflect the actual operation that you report.\
    Valid values according to BACEN are:

    * I = **Inclusion** (new accounts in the institution's database)
    * A = **Update** (changes to existing account information)
    * E = **Exclusion** (the original record must be disregarded)
  * `<QualifdrOpCCS>` = N (Normal)

    Similarly, this field should represent the correct qualifier for the account.\
    Valid values include:

    * N = **Normal**
    * P = **Popular**
    * C = **Conglomerate**
* **Functions used:**
  * count\_by plugin\_crm.aliases counts alias records per account.
  * date\_time "YYYY-MM-dd" dynamically inserts the current date in the specified format.

### Rendered example

```
<?xml version="1.0" encoding="UTF-16"?>
<CCSDOC xmlns="http://www.bcb.gov.br/ccs/ACCS001.xsd">
    <BCARQ>
        <IdentdEmissor>12345678</IdentdEmissor>
        <IdentdDestinatario>00000000</IdentdDestinatario>
        <NomArq>ACCS001</NomArq>
        <NumRemessaArq>12233444</NumRemessaArq>
    </BCARQ>
    <SISARQ>
        <CCSArqAtlzDiaria>
            <Repet_ACCS001_Pessoa>
                <Grupo_ACCS001_Pessoa>
                    <TpOpCCS>I</TpOpCCS>
                    <QualifdrOpCCS>N</QualifdrOpCCS>
                    <TpPessoa>F</TpPessoa>
                    <CNPJ_CPFPessoa>12345678900</CNPJ_CPFPessoa>
                    <DtIni>2025-02-01</DtIni>
                    <DtFim></DtFim>
                </Grupo_ACCS001_Pessoa>
            </Repet_ACCS001_Pessoa>
            <QtdOpCCS>1</QtdOpCCS>
            <DtMovto>2025-02-01</DtMovto>
        </CCSArqAtlzDiaria>
    </SISARQ>
</CCSDOC>
```

## ACCS005: Relationship detail file

***

### What it is

You generate the ACCS005 with Reporter when BACEN requests **detailed information on client relationships**. It lists all the links between a customer and financial assets (BDVs — Bens, Direitos e Valores). It can also include **related persons** such as partners or legal representatives.

### Full template

```
{# reporter:output-encoding=utf-16be #}<?xml version="1.0" encoding="UTF-16"?>
<CCSDOC xmlns="http://www.bcb.gov.br/ccs/ACCS005.xsd">
    <BCARQ>
        <IdentdEmissor>12345678</IdentdEmissor>
        <IdentdDestinatario>00000001</IdentdDestinatario>
        <NomArq>ACCS005</NomArq>
        <NumRemessaArq>{% date_time "YYYYMMddHHmm" %}</NumRemessaArq>
    </BCARQ>
    <SISARQ>
        <CCSArqInfDettRelctPessoa>
            <CNPJBaseEntRespons>{{plugin_crm.holders.0.document|slice:':8'}}</CNPJBaseEntRespons>
            <NumCtrlCCSOr>000000</NumCtrlCCSOr>
            <Repet_CCS0005_BDV>
                {%- for account in midaz_onboarding.account %}
                {%- for alias in plugin_crm.aliases %}
                {%- if alias.account_id == account.id %}
                {%- for holder in plugin_crm.holders %}
                {%- if holder.document == alias.document %}
                <Grupo_CCS0005_BDV>
                    <SitInfDettPessoa></SitInfDettPessoa>
                    <Grupo_CCS0005_Part>
                        <CNPJBasePart>{{holder.document|slice:"0:8"}}</CNPJBasePart>
                        <TpBDV>{% if account.type == "deposit" %}1{% elif account.type == "savings" %}2{% elif account.type == "payment" %}3{% else %}6{% endif %}</TpBDV>
                        {%- if alias.banking_details.branch %}
                        <AgIF>{{alias.banking_details.branch}}</AgIF>
                        {%- endif %}
                        {%- if alias.banking_details.type == "CACC" %}
                        <CtCli>{{alias.banking_details.account}}</CtCli>
                        {%- elif alias.banking_details.type == "payment" %}
                        <CtPgto>{{alias.banking_details.account}}</CtPgto>
                        {%- endif %}
                        <TpVincBDV>1</TpVincBDV>
                        <NomPessoa>{{holder.name}}</NomPessoa>
                        <DtIni>{{alias.banking_details.opening_date}}</DtIni>
                        <DtFim></DtFim>
                        {%- if holder.type == "NATURAL_PERSON" and holder.natural_person %}
                        <Repet_CCS0005_Vincd>
                            <Grupo_CCS0005_Vincd>
                                <Grupo_CCS0005_PessoaVincd>
                                    <TpVinc>3</TpVinc>
                                    <CNPJ_CPFPessoaVincd>{{holder.document}}</CNPJ_CPFPessoaVincd>
                                    <NomPessoaVincd>{{holder.natural_person.mother_name}}</NomPessoaVincd>
                                    <DtIniVinc>{{alias.banking_details.opening_date}}</DtIniVinc>
                                    <DtFimVinc></DtFimVinc>
                                </Grupo_CCS0005_PessoaVincd>
                            </Grupo_CCS0005_Vincd>
                        </Repet_CCS0005_Vincd>
                        {%- endif %}
                    </Grupo_CCS0005_Part>
                </Grupo_CCS0005_BDV>
                {%- endif %}
                {%- endfor %}
                {%- endif %}
                {%- endfor %}
                {%- endfor %}
            </Repet_CCS0005_BDV>
            <DtMovto>{% date_time "YYYY-MM-dd" %}</DtMovto>
        </CCSArqInfDettRelctPessoa>
    </SISARQ>
</CCSDOC>
```

### Applied logic

The logic applies nested loops to iterate through **accounts**, **aliases**, and **holders**, enabling structured extraction of all relevant entities.

* The `<TpBDV>` field uses conditional logic to determine the account type:
  * 1 = deposit
  * 2 = savings
  * 3 = payment
  * 6 = others
* For CNPJ extraction, slice:"0:8" retrieves only the first 8 digits (base of the CNPJ).
* Reporter renders the `<Repet_CCS0005_Vincd>` tag only when the account holder is a natural person **and** has associated individuals (e.g., an attorney or legal representative).

The example below includes the **mother’s name** as a placeholder for a vinculated person. That tag does not refer to the mother. The example shows the feature in action.

* The `date_time` function dynamically generates timestamps at runtime, ensuring the report reflects the current execution context.

### Rendered example

```
<?xml version="1.0" encoding="UTF-16"?>
<CCSDOC xmlns="http://www.bcb.gov.br/ccs/ACCS005.xsd">
    <BCARQ>
        <IdentdEmissor>12345678</IdentdEmissor>
        <IdentdDestinatario>00000001</IdentdDestinatario>
        <NomArq>ACCS005</NomArq>
        <NumRemessaArq>202502011230</NumRemessaArq>
    </BCARQ>
    <SISARQ>
        <CCSArqInfDettRelctPessoa>
            <CNPJBaseEntRespons>12345678</CNPJBaseEntRespons>
            <NumCtrlCCSOr>000000</NumCtrlCCSOr>
            <Repet_CCS0005_BDV>
                <Grupo_CCS0005_BDV>
                    <SitInfDettPessoa></SitInfDettPessoa>
                    <Grupo_CCS0005_Part>
                        <CNPJBasePart>12345678</CNPJBasePart>
                        <TpBDV>1</TpBDV>
                        <AgIF>001</AgIF>
                        <CtCli>12345-6</CtCli>
                        <TpVincBDV>1</TpVincBDV>
                        <NomPessoa>João Silva</NomPessoa>
                        <DtIni>2020-01-01</DtIni>
                        <DtFim></DtFim>
                        <Repet_CCS0005_Vincd>
                            <Grupo_CCS0005_Vincd>
                                <Grupo_CCS0005_PessoaVincd>
                                    <TpVinc>3</TpVinc>
                                    <CNPJ_CPFPessoaVincd>12345678900</CNPJ_CPFPessoaVincd>
                                    <NomPessoaVincd>Maria Silva</NomPessoaVincd>
                                    <DtIniVinc>2020-01-01</DtIniVinc>
                                    <DtFimVinc></DtFimVinc>
                                </Grupo_CCS0005_PessoaVincd>
                            </Grupo_CCS0005_Vincd>
                        </Repet_CCS0005_Vincd>
                    </Grupo_CCS0005_Part>
                </Grupo_CCS0005_BDV>
            </Repet_CCS0005_BDV>
            <DtMovto>2025-02-01</DtMovto>
        </CCSArqInfDettRelctPessoa>
    </SISARQ>
</CCSDOC>
```

## ACCS010: Relationship transfer file

***

### What it is

You generate the ACCS010 with Reporter when institutions **transfer client relationships**, which is common in portfolio sales or mergers. It lists the transferred relationships and identifies the **new responsible institution**.

### Full template

```
{# reporter:output-encoding=utf-16be #}<?xml version="1.0" encoding="UTF-16"?>
<CCSDOC xmlns="http://www.bcb.gov.br/ccs/ACCS010.xsd">
    <BCARQ>
        <IdentdEmissor>12345678</IdentdEmissor>
        <IdentdDestinatario>00000000</IdentdDestinatario>
        <NomArq>ACCS010</NomArq>
        <NumRemessaArq>{% date_time "YYYYMMdd" %}0001</NumRemessaArq>
    </BCARQ>
    <SISARQ>
        <CCSArqTransRelac>
            <CNPJBaseNovRespons>12345679</CNPJBaseNovRespons>
            {%- for alias in plugin_crm.aliases %}
            {%- for holder in plugin_crm.holders %}
            {%- if alias.holder_id == holder._id and (holder.type == "LEGAL_PERSON" or holder.type == "NATURAL_PERSON") %}
            <Repet_ACCS010_Pessoa>
                <CNPJBasePart></CNPJBasePart>
                <TpPessoa>{% if holder.type == "NATURAL_PERSON" %}F{% else %}J{% endif %}</TpPessoa>
                <CNPJ_CPFPessoa>{{holder.document}}</CNPJ_CPFPessoa>
                <DtIni>{{alias.banking_details.opening_date}}</DtIni>
                <DtFim></DtFim>
            </Repet_ACCS010_Pessoa>
            {%- endif %}
            {%- endfor %}
            {%- endfor %}
            <QtdOpCCS>{% count_by plugin_crm.aliases %}</QtdOpCCS>
        </CCSArqTransRelac>
    </SISARQ>
</CCSDOC>
```

### Applied logic

* **Dual loops** iterate through aliases and holders.
* `<TpPessoa>` defines whether the holder is natural (**F**) or legal (**J**).
* `<CNPJBaseNovRespons>` identifies the **new responsible institution**.
* `<QtdOpCCS>` uses count\_by to ensure the number of reported relationships matches the dataset.
* Dates (`<DtIni>` and `<DtFim>`) track relationship validity.

### Rendered example

```
<?xml version="1.0" encoding="UTF-16"?>
<CCSDOC xmlns="http://www.bcb.gov.br/ccs/ACCS010.xsd">
    <BCARQ>
        <IdentdEmissor>12345678</IdentdEmissor>
        <IdentdDestinatario>00000000</IdentdDestinatario>
        <NomArq>ACCS010</NomArq>
        <NumRemessaArq>202502010001</NumRemessaArq>
    </BCARQ>
    <SISARQ>
        <CCSArqTransRelac>
            <CNPJBaseNovRespons>87654321</CNPJBaseNovRespons>
            <Repet_ACCS010_Pessoa>
                <CNPJBasePart>12345678</CNPJBasePart>
                <TpPessoa>F</TpPessoa>
                <CNPJ_CPFPessoa>12345678900</CNPJ_CPFPessoa>
                <DtIni>2019-05-10</DtIni>
                <DtFim></DtFim>
            </Repet_ACCS010_Pessoa>
            <QtdOpCCS>1</QtdOpCCS>
        </CCSArqTransRelac>
    </SISARQ>
</CCSDOC>
```

<Warning>
  While Reporter provides the technical automation, institutions must ensure the **accuracy and consistency of the data** submitted to BACEN. Always validate rendered XML against the official schema before submission, and involve accounting or compliance teams in the review process.
</Warning>
