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

# Base de Clientes as a data source

> Bring data from Base de Clientes to Nekt.

Base de Clientes is a subscription and billing management platform for Brazilian merchants. It supports recurring billing, receivables, transfers, customer management, contracts, and reporting. Data is extracted via the Base de Clientes REST API using a Bearer token.

<img width="200" src="https://mintcdn.com/nekt/oMlZM4wR39f7Lank/assets/logo/logo-client-base.png?fit=max&auto=format&n=oMlZM4wR39f7Lank&q=85&s=0d93dcf05f64720fc5b41a962932f247" data-path="assets/logo/logo-client-base.png" />

## Configuring Base de Clientes as a Source

In the [Sources](https://app.nekt.ai/sources) tab, click on the "Add source" button located on the top right of your screen. Then, select the **Base de Clientes** option from the list of connectors.

Click **Next** and you'll be prompted to add your access.

### 1. Add account access

You'll need to provide your Base de Clientes API credentials so Nekt can access your data.

The following configurations are available:

* **Auth Token**: (Required) Bearer token for the Base de Clientes API. Obtain it from [suporte@clientbase.com.br](mailto:suporte@clientbase.com.br). This token authenticates all API requests.

* **Start Date**: (Optional) Initial date for incremental sync. Used on the first run when there is no bookmark. Example: `2020-01-01T00:00:00Z`. Streams with incremental sync (billings, banks, recurrences, receivables, transfers, contracts, announcement\_portals) will filter records by `updated_at` greater than this date on the first extraction.

Once you're done, click **Next**.

### 2. Select streams

Choose which data streams you want to sync. For faster extractions, select only the streams that are relevant to your analysis. You can select entire groups of streams or pick specific ones.

> Tip: The stream can be found more easily by typing its name.

Select the streams and click **Next**.

### 3. Configure data streams

Customize how you want your data to appear in your catalog. Select the desired layer where the data will be placed, a folder to organize it inside the layer, a name for each table (which will effectively contain the fetched data), and the type of sync.

* **Layer**: Choose between the existing layers on your catalog. This is where you will find your new extracted tables as the extraction runs successfully.
* **Folder**: A folder can be created inside the selected layer to group all tables being created from this new data source.
* **Table name**: We suggest a name, but feel free to customize it. You have the option to add a **prefix** to all tables at once and make this process faster!
* **Sync Type**: You can choose between INCREMENTAL and FULL\_TABLE.
  * **Incremental**: Every time the extraction happens, we'll get only the new or updated data. Supported for **banks**, **billings**, **contracts**, **receivables**, **recurrences**, **transfers**, and **announcement\_portals** (they use `updated_at` as replication key).
  * **Full table**: Every time the extraction happens, we'll get the current state of the data. Used for **bank\_accounts**, **customers**, **customer\_groups**, **custom\_fields**, **merchant\_users**, and **reports**.

Once you are done configuring, click **Next**.

### 4. Configure data source

Describe your data source for easy identification within your organization, not exceeding 140 characters.

To define your [Trigger](https://docs.nekt.com/get-started/core-concepts/triggers), consider how often you want data to be extracted from this source. This decision usually depends on how frequently you need the new table data updated (every day, once a week, or only at specific times).

Optionally, you can define some additional settings:

* Configure Delta Log Retention and determine for how long we should store old states of this table as it gets updated. Read more about this resource [here](https://docs.nekt.com/get-started/core-concepts/resource-control).
* Determine when to execute an **Additional [Full Sync](https://docs.nekt.com/get-started/core-concepts/types-of-sync#additional-full-sync)**.

Once you are ready, click **Next** to finalize the setup.

### 5. Check your new source

You can view your new source on the [Sources](https://app.nekt.ai/sources) page. If needed, manually trigger the source extraction by clicking on the arrow button. Once executed, your data will appear in your Catalog.

<Warning>For you to be able to see it on your [Catalog](https://app.nekt.ai/catalog), you need at least one successful source run.</Warning>

# Streams and Fields

Below you'll find all available data streams from Base de Clientes and their corresponding fields:

<AccordionGroup>
  <Accordion title="Banks">
    List of banks available in Base de Clientes (incremental by updated\_at).

    **Key Fields:**

    * `uuid` - UUID do banco
    * `compe` - Código COMPE
    * `ispb` - Código ISPB
    * `document` - CNPJ do banco
    * `short_name` - Nome curto do banco
    * `name` - Razão social do banco
    * `url` - URL do banco
    * `merchant_uuid` - UUID do merchant
    * `created_at`, `updated_at` - Datas de criação e atualização
  </Accordion>

  <Accordion title="Bank Accounts">
    Bank accounts of the authenticated merchant.

    **Key Fields:**

    * `uuid` - UUID da conta bancária
    * `agency`, `agency_dv` - Agência e dígito verificador
    * `account`, `account_dv` - Número da conta e dígito
    * `account_type` - Tipo da conta (ex: checking)
    * `active` - Se a conta está ativa
    * `merchant_uuid` - UUID do merchant
    * `bank` - Objeto com dados do banco (uuid, compe, ispb, name, etc.)
    * `created_at`, `updated_at` - Datas
  </Accordion>

  <Accordion title="Billings">
    Invoices of the merchant (incremental by updated\_at).

    **Key Fields:**

    * `uuid`, `merchant_uuid`, `customer_uuid` - Identificadores
    * `amount_billed`, `amount_paid`, `discount_amount`, `interest_fine`, `interest_fee` - Valores (string)
    * `status` - Status da fatura (ex: paid)
    * `due_date`, `date_paid`, `expiration_date`, `competence_date`, `issue_date` - Datas
    * `payment_type`, `discount_policy`, `interest_policy` - Políticas
    * `recurrence_cycle`, `installment_cycle` - Ciclos
    * `dirty`, `antecipated`, `issued`, `viewed`, `can_issue` - Flags
    * `discounts` - Array de descontos (uuid, type, value, amount, policy, days, etc.)
    * `tags` - Array de tags (objetos com uuid, name, color, etc.)
    * `billing_items` - Array de itens (uuid, description, quantity, unit\_price, amount, product, etc.)
    * `payments` - Array de pagamentos
    * `customer`, `merchant` - Objetos aninhados
    * `cancellation_reason`, `metadata`, `nfse` - Objetos adicionais
  </Accordion>

  <Accordion title="Contracts">
    Contracts of the merchant (incremental by updated\_at).

    **Key Fields:**

    * `id`, `uuid` - Identificadores
    * `title`, `description`, `message`, `content` - Textos
    * `start_date`, `end_date`, `expiration_date` - Datas
    * `days_notice` - Dias de aviso prévio
    * `signed_at` - Data de assinatura
    * `status` - Status (ex: current, waiting\_signatures)
    * `merchant_id`, `customer_id`, `contract_model_id` - IDs de relacionamento
    * `customer` - Objeto com dados do cliente
    * `created_at`, `updated_at` - Datas
  </Accordion>

  <Accordion title="Customers">
    Customers of the merchant.

    **Key Fields:**

    * `uuid`, `merchant_uuid`, `customer_uuid` - Identificadores
    * `name`, `nickname`, `document`, `email`, `phone` - Dados de contato
    * `status`, `source` - Status e origem
    * `email_block`, `category`, `category_dirty` - Configurações
    * `metadata`, `custom_fields`, `customer_fields` - JSON strings
    * `documents`, `tags`, `contracts`, `customer_info`, `archive_reasons` - JSON strings
    * `addresses` - Array de endereços (uuid, street, number, city, state, postal\_code, etc.)
    * `customer_groups` - Array de grupos (uuid, name, group\_color, active, icon, etc.)
    * `created_at`, `updated_at` - Datas
  </Accordion>

  <Accordion title="Customer Groups">
    Customer groups of the merchant.

    **Key Fields:**

    * `id`, `uuid` - Identificadores
    * `name`, `active`, `icon`, `group_color` - Dados do grupo
    * `merchant_uuid` - UUID do merchant
    * `customers` - Array de clientes do grupo
    * `created_at`, `updated_at` - Datas
  </Accordion>

  <Accordion title="Custom Fields">
    Custom fields configuration of the merchant.

    **Key Fields:**

    * `uuid` - UUID do custom field
    * `field_type` - Tipo do campo (ex: short\_text, radio)
    * `field_configuration` - Configuração do campo (JSON string)
  </Accordion>

  <Accordion title="Merchant Users">
    Users of the merchant.

    **Key Fields:**

    * `uuid`, `merchant_uuid` - Identificadores
    * `name`, `email`, `phone` - Dados de contato
    * `status`, `role` - Status e papel (ex: admin)
    * `google_access_token`, `google_sub` - Integração Google
    * `shortcuts`, `notification_preferences` - JSON strings
    * `show_nps`, `show_notification_product_updates` - Preferências
    * `virtual_assistant_notification_enabled`, `virtual_assistant_phone` - Assistente virtual
    * `created_at`, `updated_at` - Datas
  </Accordion>

  <Accordion title="Receivables">
    Receivables (recebíveis) of the merchant (incremental by updated\_at).

    **Key Fields:**

    * `uuid`, `billing_uuid`, `payment_uuid`, `transfer_uuid`, `customer_uuid`, `recurrence_uuid`, `merchant_uuid` - Identificadores
    * `amount`, `gross_amount` - Valores (string)
    * `status` - Status (ex: paid)
    * `date_paid`, `expected_on` - Datas
    * `installment` - Dados da parcela (JSON string)
    * `billing` - Objeto com fatura associada (inclui customer, payments)
    * `created_at`, `updated_at` - Datas
  </Accordion>

  <Accordion title="Recurrences">
    Recurring billing definitions (incremental by updated\_at).

    **Key Fields:**

    * `uuid`, `customer_uuid`, `merchant_uuid` - Identificadores
    * `status`, `frequency`, `frequency_type`, `frequency_number` - Configuração
    * `total_cycles`, `current_cycle`, `due_day` - Ciclos
    * `first_due_date` - Primeira data de vencimento
    * `amount`, `discount_amount`, `interest_fine`, `interest_fee` - Valores (string)
    * `payment_type`, `discount_policy`, `interest_policy` - Políticas
    * `credit_card_recurring`, `nfse_scheduled` - Flags
    * `discounts`, `tags`, `billing_items`, `billings`, `recurrence_cards` - Arrays (JSON strings)
    * `bonus`, `installment_plan`, `cancellation_reason` - Objetos/strings
    * `customer` - Objeto com dados do cliente
    * `created_at`, `updated_at` - Datas
  </Accordion>

  <Accordion title="Reports">
    Reports generated by the merchant.

    **Key Fields:**

    * `uuid`, `merchant_uuid` - Identificadores
    * `model` - Modelo do relatório (ex: billing)
    * `filters`, `filters_to_show` - Filtros (JSON strings)
    * `status` - Status (ex: completed, generated)
    * `downloaded` - Se foi baixado
    * `created_at`, `updated_at` - Datas
  </Accordion>

  <Accordion title="Transfers">
    Bank transfers of the merchant (incremental by updated\_at).

    **Key Fields:**

    * `uuid`, `bank_account_uuid`, `merchant_uuid` - Identificadores
    * `amount`, `child_amount` - Valores (string)
    * `description`, `status` - Descrição e status
    * `transfer_date` - Data da transferência
    * `transfer_type`, `transferable_type` - Tipos
    * `transfer_position` - Posição da transferência
    * `report_url` - URL do relatório
    * `created_at`, `updated_at` - Datas
  </Accordion>

  <Accordion title="Announcement Portals">
    Announcements from the portal (comunicados) (incremental by updated\_at).

    **Key Fields:**

    * `uuid`, `merchant_uuid` - Identificadores
    * `announcement_type`, `title`, `message` - Conteúdo
    * `document_file` - Arquivo anexo (JSON string)
    * `customers` - Array de clientes que visualizaram (JSON strings)
    * `customer_groups` - Grupos de clientes (JSON strings)
    * `created_at`, `updated_at` - Datas
  </Accordion>
</AccordionGroup>

# Data Model

The following diagram illustrates the main relationships between Base de Clientes streams. **Merchant** is the central entity; **customers** and **merchant\_users** belong to it. **Billings** and **recurrences** link to customers. **Receivables** tie billings to **transfers**. **Bank accounts** and **banks** support transfers. **Contracts** associate customers with contract models. **Customer groups** group customers. **Reports** and **announcement\_portals** are merchant-scoped.

```mermaid theme={null}
erDiagram
    MerchantUsers ||--o{ Merchants : "belongs to"
    Customers ||--o{ Merchants : "belongs to"
    Billings }o--|| Customers : "customer_uuid"
    Recurrences }o--|| Customers : "customer_uuid"
    Receivables }o--|| Billings : "billing_uuid"
    Receivables }o--o| Transfers : "transfer_uuid"
    Transfers }o--|| BankAccounts : "bank_account_uuid"
    BankAccounts }o--|| Banks : "bank"
    Contracts }o--|| Customers : "customer_id"
    CustomerGroups ||--o{ Customers : "customers"
    BankAccounts }o--|| Banks : "bank"

    Billings {
        string uuid PK
        string customer_uuid FK
        string amount_billed
        string status
        datetime updated_at
    }

    Customers {
        string uuid PK
        string merchant_uuid FK
        string name
        string document
        string status
    }

    Receivables {
        string uuid PK
        string billing_uuid FK
        string transfer_uuid FK
        string amount
        string status
    }

    Recurrences {
        string uuid PK
        string customer_uuid FK
        string amount
        string status
        datetime updated_at
    }

    Transfers {
        string uuid PK
        string bank_account_uuid FK
        string amount
        string status
    }
```

# Implementation Notes

### Authentication

* The tap uses **Bearer token** authentication. The `auth_token` is sent in the `Authorization` header for all API requests.

### Incremental Sync

* Streams with `replication_key = "updated_at"` support incremental sync. On the first run (no bookmark), the tap uses `start_date` from config to filter records. On subsequent runs, the bookmark from state is used.

### Numeric Fields as Strings

* Several amount and value fields (`amount_billed`, `amount_paid`, `amount`, etc.) are stored as strings in the schema because the API can return them as strings or numbers. Use `CAST(column AS DOUBLE)` or equivalent in SQL for aggregations.

### JSON String Fields

* Fields like `metadata`, `custom_fields`, `tags`, `billing_items`, `product`, `paymentable`, and similar are serialized as JSON strings for compatibility with the data lake. Use `JSON_EXTRACT` or equivalent to parse them in queries.

## Skills for agents

<Snippet file="agent-skills-intro.mdx" />

<Card title="Download Base de Clientes skills file" icon="wand-magic-sparkles" href="/sources/client-base.md">
  Base de Clientes connector documentation as plain markdown, for use in AI agent contexts.
</Card>
