> ## 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.

# Fly ERP as a data source

> Bring data from Fly ERP to Nekt.

Fly ERP is a comprehensive enterprise resource planning system that helps businesses manage their operations, including sales, inventory, financial transactions, and customer relationships.

<img height="30" src="https://mintcdn.com/nekt/-h7AZTSCubO_fl8a/assets/logo/logo-fly-erp.jpeg?fit=max&auto=format&n=-h7AZTSCubO_fl8a&q=85&s=f36e64e0bb10833bdff6fe243f231183" data-path="assets/logo/logo-fly-erp.jpeg" />

## Configuring Fly ERP 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 Fly ERP 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 the following credentials to connect to Fly ERP:

* **API URL**: The base URL of your Fly ERP instance (e.g., [https://empresa.fly](https://empresa.fly) erp.com.br)
* **Auth Token**: The bearer token to authenticate against the Fly ERP API service. Check [this doc](https://documenter.getpostman.com/view/24704188/2s8Yt1r8wu#authentication) to understand how to generate the token.
* **Start Date**: The earliest record date to sync for `Vendas` and `VendasItens` streams.

### 2. Select streams

Choose which data streams you want to sync - you can select all streams or pick specific ones that matter most to you.

> 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 data - which is good if, for example, you want to keep every record ever fetched.
  * Full table: every time the extraction happens, we'll get the current state of the data - which is good if, for example, you don't want to have deleted data in your catalog.

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/runs/scheduling-and-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)**. This will complement the incremental data extractions, ensuring that your data is completely synchronized with your source every once in a while.

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 Fly ERP and their corresponding fields:

<AccordionGroup>
  <Accordion title="Bancos Contas">
    Stream for managing bank accounts and balances.

    Primary key: `id`

    | Field       | Type    | Description              |
    | :---------- | :------ | :----------------------- |
    | `codigo`    | Integer | Bank/account code        |
    | `descricao` | String  | Bank/account description |
    | `id`        | Integer | Bank/account ID          |
    | `id_filial` | Integer | Branch ID                |
    | `saldo`     | Number  | Current balance          |
  </Accordion>

  <Accordion title="Clientes e Fornecedores">
    Stream for managing customer and supplier information.

    Primary key: `id`

    | Field                   | Type    | Description                                               |
    | :---------------------- | :------ | :-------------------------------------------------------- |
    | `bairro`                | String  | Neighborhood                                              |
    | `cep`                   | String  | ZIP code                                                  |
    | `codigo`                | String  | Customer/Supplier code                                    |
    | `codigo_cidade`         | String  | City code                                                 |
    | `contato_nome`          | String  | Contact name                                              |
    | `contato_telefone`      | String  | Contact phone                                             |
    | `contatos`              | Array   | List of contacts (nome, telefone, email, vinculo\_funcao) |
    | `cpf_cnpj`              | String  | CPF/CNPJ (tax ID)                                         |
    | `data_cadastro`         | String  | Registration date                                         |
    | `data_ultima_compra`    | String  | Last purchase date                                        |
    | `email`                 | String  | Email address                                             |
    | `endereco`              | String  | Address                                                   |
    | `enquadramento_pessoa`  | String  | Person classification                                     |
    | `estado`                | String  | State                                                     |
    | `id`                    | Integer | Customer/Supplier ID                                      |
    | `id_condicao_pagamento` | Integer | Payment condition ID                                      |
    | `id_forma_pagamento`    | Integer | Payment method ID                                         |
    | `id_importacao`         | Integer | Import ID                                                 |
    | `id_operacao_saida`     | Integer | Output operation ID                                       |
    | `id_vendedor`           | Integer | Sales representative ID                                   |
    | `ids_vendedores`        | Array   | List of sales representative IDs                          |
    | `ie_rg`                 | String  | State registration/ID                                     |
    | `nome_fantasia`         | String  | Trade name                                                |
    | `ramo_atividade`        | String  | Business activity                                         |
    | `razao_social`          | String  | Company name                                              |
    | `situacao`              | String  | Status (A=Active, I=Inactive)                             |
    | `telefone`              | String  | Primary phone                                             |
    | `telefone2`             | String  | Secondary phone                                           |
  </Accordion>

  <Accordion title="Contas a Pagar">
    Stream for managing payable accounts.

    Primary key: `id`

    | Field                    | Type    | Description                   |
    | :----------------------- | :------ | :---------------------------- |
    | `codigo_banco_conta`     | Integer | Bank account code             |
    | `codigo_categoria`       | Integer | Category code                 |
    | `codigo_fornecedor`      | Integer | Supplier code                 |
    | `codigo_plano_contas`    | Integer | Chart of accounts code        |
    | `data_emissao`           | String  | Issue date                    |
    | `data_ultimo_pagamento`  | String  | Last payment date             |
    | `data_vencimento`        | String  | Due date                      |
    | `descricao_banco_conta`  | String  | Bank account description      |
    | `descricao_categoria`    | String  | Category description          |
    | `descricao_plano_contas` | String  | Chart of accounts description |
    | `id`                     | Integer | Account ID                    |
    | `id_filial`              | Integer | Branch ID                     |
    | `id_fornecedor`          | Integer | Supplier ID                   |
    | `nome_fornecedor`        | String  | Supplier name                 |
    | `numero`                 | String  | Account number                |
    | `numero_nota`            | String  | Invoice number                |
    | `observacao`             | String  | Notes                         |
    | `parcela`                | Integer | Installment number            |
    | `valor`                  | Number  | Account value                 |
    | `valor_aberto`           | Number  | Open amount                   |
    | `valor_desconto_pago`    | Number  | Paid discount amount          |
    | `valor_juros_pago`       | Number  | Paid interest amount          |
    | `valor_pago`             | Number  | Paid amount                   |
  </Accordion>

  <Accordion title="Contas a Receber">
    Stream for managing receivable accounts.

    Primary key: `id`

    | Field                    | Type    | Description                   |
    | :----------------------- | :------ | :---------------------------- |
    | `codigo_banco_conta`     | Integer | Bank account code             |
    | `codigo_categoria`       | Integer | Category code                 |
    | `codigo_cliente`         | Integer | Customer code                 |
    | `codigo_plano_contas`    | Integer | Chart of accounts code        |
    | `cpf_cnpj_cliente`       | String  | Customer CPF/CNPJ             |
    | `data_emissao`           | String  | Issue date                    |
    | `data_ultimo_pagamento`  | String  | Last payment date             |
    | `data_vencimento`        | String  | Due date                      |
    | `descricao_banco_conta`  | String  | Bank account description      |
    | `descricao_categoria`    | String  | Category description          |
    | `descricao_plano_contas` | String  | Chart of accounts description |
    | `id`                     | Integer | Account ID                    |
    | `id_cliente`             | Integer | Customer ID                   |
    | `id_filial`              | Integer | Branch ID                     |
    | `id_nota`                | Integer | Invoice ID                    |
    | `link_boleto`            | String  | Bank slip link                |
    | `link_fatura`            | String  | Invoice link                  |
    | `nome_cliente`           | String  | Customer name                 |
    | `numero`                 | String  | Account number                |
    | `numero_nota`            | String  | Invoice number                |
    | `observacao`             | String  | Notes                         |
    | `parcela`                | Integer | Installment number            |
    | `url_pagamento`          | String  | Payment URL                   |
    | `valor`                  | Number  | Account value                 |
    | `valor_aberto`           | Number  | Open amount                   |
    | `valor_desconto_pago`    | Number  | Paid discount amount          |
    | `valor_juros_calculado`  | Number  | Calculated interest           |
    | `valor_juros_pago`       | Number  | Paid interest amount          |
    | `valor_pago`             | Number  | Paid amount                   |
  </Accordion>

  <Accordion title="Movimentações Financeiras">
    Stream for tracking financial movements.

    Primary key: `id`

    | Field                    | Type    | Description                   |
    | :----------------------- | :------ | :---------------------------- |
    | `codigo`                 | Integer | Transaction code              |
    | `codigo_banco_conta`     | Integer | Bank account code             |
    | `codigo_categoria`       | Integer | Category code                 |
    | `codigo_cliente`         | Integer | Customer code                 |
    | `codigo_plano_contas`    | Integer | Chart of accounts code        |
    | `complemento`            | String  | Additional details            |
    | `data`                   | String  | Transaction date              |
    | `data_emissao`           | String  | Issue date                    |
    | `data_ultimo_pagamento`  | String  | Last payment date             |
    | `data_vencimento`        | String  | Due date                      |
    | `descricao_banco_conta`  | String  | Bank account description      |
    | `descricao_categoria`    | String  | Category description          |
    | `descricao_plano_contas` | String  | Chart of accounts description |
    | `id`                     | Integer | Transaction ID                |
    | `id_cliente`             | Integer | Customer ID                   |
    | `id_contas_a_pagar`      | Integer | Accounts payable ID           |
    | `id_contas_a_receber`    | Integer | Accounts receivable ID        |
    | `id_filial`              | Integer | Branch ID                     |
    | `link_boleto`            | String  | Bank slip link                |
    | `nome_cliente`           | String  | Customer name                 |
    | `nome_filial`            | String  | Branch name                   |
    | `numero`                 | String  | Transaction number            |
    | `numero_nota`            | String  | Invoice number                |
    | `observacao`             | String  | Notes                         |
    | `parcela`                | Integer | Installment number            |
    | `valor`                  | Number  | Transaction value             |
    | `valor_aberto`           | Number  | Open amount                   |
    | `valor_desconto_pago`    | Number  | Paid discount amount          |
    | `valor_juros_calculado`  | Number  | Calculated interest           |
    | `valor_juros_pago`       | Number  | Paid interest amount          |
    | `valor_pago`             | Number  | Paid amount                   |
  </Accordion>

  <Accordion title="Produtos e Grupos">
    Stream for managing product groups and subgroups.

    Primary key: `id_grupo`

    | Field             | Type    | Description                                                                           |
    | :---------------- | :------ | :------------------------------------------------------------------------------------ |
    | `codigo_grupo`    | String  | Group code                                                                            |
    | `descricao_grupo` | String  | Group description                                                                     |
    | `id_grupo`        | Integer | Group ID                                                                              |
    | `subgrupos`       | Array   | Array of subgroups containing: `codigo_subgrupo`, `descricao_subgrupo`, `id_subgrupo` |
  </Accordion>

  <Accordion title="Produtos e Serviços">
    Stream for managing products and services.

    Primary key: `id_produto`

    | Field                  | Type    | Description               |
    | :--------------------- | :------ | :------------------------ |
    | `codigo_alfa_numerico` | String  | Alphanumeric code         |
    | `codigo_numerico`      | String  | Numeric code              |
    | `custo_medio`          | Number  | Average cost              |
    | `custo_ultima_compra`  | Number  | Last purchase cost        |
    | `estoque`              | Number  | Stock quantity            |
    | `id_grupo`             | Integer | Group ID                  |
    | `id_marca`             | Integer | Brand ID                  |
    | `id_produto`           | Integer | Product ID                |
    | `id_subgrupo`          | Integer | Subgroup ID               |
    | `nome_grupo`           | String  | Group name                |
    | `nome_marca`           | String  | Brand name                |
    | `nome_produto`         | String  | Product name              |
    | `nome_subgrupo`        | String  | Subgroup name             |
    | `preco_venda`          | Number  | Sale price                |
    | `quantidade_reservada` | Number  | Reserved quantity         |
    | `referencia_principal` | String  | Main reference            |
    | `tipo`                 | String  | Type (product or service) |
    | `unidade_medida`       | String  | Unit of measure           |
  </Accordion>

  <Accordion title="Vendas">
    Stream for managing sales invoices.

    Primary key: `id_nota`

    | Field                  | Type    | Description           |
    | :--------------------- | :------ | :-------------------- |
    | `codigo_cliente`       | Integer | Customer code         |
    | `data_emissao_nota`    | String  | Issue date            |
    | `id_nota`              | Integer | Invoice ID            |
    | `numero_nota`          | String  | Invoice number        |
    | `numero_pedido_venda`  | String  | Sales order number    |
    | `razao_social_cliente` | String  | Customer company name |
    | `serie_nota`           | String  | Invoice series        |
    | `tipo_nota`            | String  | Invoice type          |
    | `valor_nota`           | Number  | Invoice total value   |
  </Accordion>

  <Accordion title="Vendas Itens">
    Stream for managing sales invoice items.

    Primary key: `id_item`

    | Field                         | Type    | Description                     |
    | :---------------------------- | :------ | :------------------------------ |
    | `codigo_cliente`              | Integer | Customer code                   |
    | `codigo_produto_alfanumerico` | String  | Product alphanumeric code       |
    | `codigo_produto_numerico`     | String  | Product numeric code            |
    | `data_emissao_nota`           | String  | Issue date                      |
    | `id_item`                     | Integer | Item ID                         |
    | `id_nota`                     | Integer | Invoice ID                      |
    | `id_produto`                  | Integer | Product ID                      |
    | `nome_produto`                | String  | Product name                    |
    | `numero_nota`                 | String  | Invoice number                  |
    | `quantidade_item`             | Number  | Item quantity                   |
    | `razao_social_cliente`        | String  | Customer company name           |
    | `serie_nota`                  | String  | Invoice series                  |
    | `tipo_nota`                   | String  | Invoice type                    |
    | `valor_desconto_item`         | Number  | Item discount value             |
    | `valor_desconto_nota_item`    | Number  | Invoice discount value for item |
    | `valor_nota`                  | Number  | Invoice total value             |
    | `valor_total_item`            | Number  | Item total value                |
    | `valor_unitario_item`         | Number  | Item unit value                 |
  </Accordion>

  <Accordion title="Vendedores">
    Stream for managing sales representatives.

    Primary key: `id`

    | Field                         | Type    | Description                     |
    | :---------------------------- | :------ | :------------------------------ |
    | `ativo`                       | Boolean | Active status                   |
    | `cnpj_cpf`                    | String  | CPF/CNPJ                        |
    | `codigo`                      | String  | Sales representative code       |
    | `codigos_condicoes_pagamento` | Array   | List of payment condition codes |
    | `email`                       | String  | Email address                   |
    | `id`                          | Integer | Sales representative ID         |
    | `nome`                        | String  | Sales representative name       |
  </Accordion>
</AccordionGroup>

## Data Model

The following diagram illustrates the relationships between the core data streams in Fly ERP. The arrows indicate the join keys that link the different entities.

```mermaid theme={null}
graph TD;
    subgraph "Core Entities"
        Clientes("Clientes e Fornecedores")
        Produtos("Produtos e Serviços")
        Vendedores("Vendedores")
    end

    subgraph "Sales"
        Vendas("Vendas")
        VendasItens("Vendas Itens")
    end

    subgraph "Financial"
        ContasReceber("Contas a Receber")
        ContasPagar("Contas a Pagar")
        Movimentacoes("Movimentações Financeiras")
    end

    subgraph "Product Organization"
        ProdutosGrupos("Produtos Grupos")
    end

    Vendas -- "codigo_cliente" --> Clientes;
    VendasItens -- "id_nota" --> Vendas;
    VendasItens -- "id_produto" --> Produtos;
    Produtos -- "id_grupo" --> ProdutosGrupos;
    ContasReceber -- "id_cliente" --> Clientes;
    ContasPagar -- "id_fornecedor" --> Clientes;
    Movimentacoes -- "id_cliente" --> Clientes;
    Movimentacoes -- "id_contas_a_receber" --> ContasReceber;
    Movimentacoes -- "id_contas_a_pagar" --> ContasPagar;
    Clientes -- "id_vendedor" --> Vendedores;
```

## Skills for agents

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

<Card title="Download Fly ERP skills file" icon="wand-magic-sparkles" href="/sources/fly-erp.md">
  Fly ERP connector documentation as plain markdown, for use in AI agent contexts.
</Card>
