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

# Mercos as a data source

> Bring data from Mercos to Nekt.

Mercos is a B2B sales platform that helps companies manage their sales force, orders, and customer relationships. It provides tools for sales teams to manage their catalogs, pricing, and customer orders efficiently.

## Configuring Mercos 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 Mercos 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 Mercos:

* **Company Token**: The company token to authenticate against the API service. It can be found on `Minha Conta` -> `Sistema` -> `Integração` -> `Seu Company Token para integração`.
* **Start Date**: The earliest record date to sync (records created or updated after this date will be extracted).

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

### 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 a name for each table (which will contain the fetched data) and the type of sync.

* **Table name**: we suggest a name, but feel free to customize it. You have the option to add a **prefix** 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 determine when to execute a [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 Mercos and their corresponding fields:

<AccordionGroup>
  <Accordion title="Clients">
    Stream for managing customer information.

    Primary key: `id`
    Replication key: `ultima_alteracao`

    * `bairro` - Neighborhood
    * `bloqueado` - Whether the client is blocked
    * `bloqueado_b2b` - Whether blocked in B2B
    * `cep` - Postal code
    * `cidade` - City
    * `cnpj` - Company registration number
    * `complemento` - Address complement
    * `contatos` - Contact information containing:
      * `cargo` - Position/role
      * `emails` - List of email addresses
      * `excluido` - Whether deleted
      * `id` - Contact ID
      * `nome` - Contact name
      * `telefones` - List of phone numbers
    * `emails` - List of email addresses
    * `estado` - State
    * `excluido` - Whether the client is deleted
    * `extras` - Extra information containing:
      * `campo_extra_id` - Extra field ID
      * `nome` - Field name
      * `nome_arquivo` - File name
      * `tipo` - Field type
      * `valor` - Field value
      * `valor_arquivo` - File value
      * `valor_data` - Date value
      * `valor_decimal` - Decimal value
      * `valor_texto` - Text value
    * `id` - The client's system ID
    * `inscricao_estadual` - State registration number
    * `nome_fantasia` - Company trade name
    * `numero` - Street number
    * `observacao` - Additional observations
    * `razao_social` - Company legal name
    * `rua` - Street address
    * `suframa` - SUFRAMA registration number
    * `telefones` - List of phone numbers
    * `tipo` - Client type
    * `ultima_alteracao` - Last modification timestamp
  </Accordion>

  <Accordion title="Orders">
    Stream for managing sales orders.

    Primary key: `id`
    Replication key: `ultima_alteracao`

    * `cliente_id` - Client ID
    * `condicao_pagamento` - Payment terms
    * `condicao_pagamento_id` - Payment terms ID
    * `criador_id` - Creator ID
    * `cupom_de_desconto` - Discount coupon code
    * `data_criacao` - Creation date
    * `data_emissao` - Issue date
    * `endereco_entrega` - Delivery address containing:
      * `bairro` - Neighborhood
      * `cep` - Postal code
      * `cidade` - City
      * `complemento` - Address complement
      * `endereco` - Street address
      * `estado` - State
      * `id` - Address ID
      * `numero` - Street number
    * `extras` - Extra fields containing:
      * `campo_extra_id` - Extra field ID
      * `nome` - Field name
      * `nome_arquivo` - File name
      * `tipo` - Field type
      * `valor` - Field value
      * `valor_arquivo` - File value
      * `valor_data` - Date value
      * `valor_decimal` - Decimal value
      * `valor_texto` - Text value
    * `forma_pagamento_id` - Payment method ID
    * `id` - Order ID
    * `itens` - Order items containing:
      * `cotacao_moeda` - Currency quote
      * `desconto_de_cupom` - Coupon discount
      * `descontos_de_politicas` - Policy discounts (regra\_id, desconto)
      * `descontos_de_promocoes` - Promotional discounts (regra\_id, desconto)
      * `descontos_do_vendedor` - Seller discounts
      * `excluido` - Whether deleted
      * `id` - Item ID
      * `ipi` - IPI tax value
      * `observacoes` - Item observations
      * `preco_liquido` - Net price
      * `preco_tabela` - List price
      * `produto_id` - Product ID
      * `quantidade` - Quantity
      * `st` - ST tax value
      * `subtotal` - Subtotal
      * `tabela_preco_id` - Price table ID
      * `tipo_ipi` - IPI tax type
    * `nome_contato` - Contact name
    * `numero` - Order number
    * `observacoes` - Order observations
    * `status` - Order status
    * `status_b2b` - B2B status
    * `status_faturamento` - Billing status
    * `tipo_pedido_id` - Order type ID
    * `total` - Order total amount
    * `transportadora_id` - Shipping company ID
    * `transportadora_nome` - Shipping company name
    * `ultima_alteracao` - Last modification date
  </Accordion>

  <Accordion title="Products">
    Stream for managing product catalog.

    Primary key: `id`
    Replication key: `ultima_alteracao`

    * `altura` - Height
    * `ativo` - Whether the product is active
    * `codigo` - Product code
    * `comissao` - Commission percentage
    * `comprimento` - Length
    * `excluido` - Whether the product is deleted
    * `exibir_no_b2b` - Whether to display in B2B
    * `id` - The product's system ID
    * `ipi` - IPI tax value
    * `largura` - Width
    * `moeda` - Currency code
    * `multiplo` - Multiple quantity for orders
    * `nome` - The product's name
    * `observacoes` - Product observations and details
    * `peso_bruto` - Gross weight
    * `peso_dimensoes_unitario` - Unit weight dimensions
    * `preco_minimo` - Minimum price
    * `preco_tabela` - List price
    * `precos_especificos` - Whether has specific prices
    * `saldo_estoque` - Stock balance
    * `st` - ST tax value
    * `tipo_ipi` - IPI tax type
    * `ultima_alteracao` - Last modification timestamp
    * `unidade` - Unit of measurement
  </Accordion>
</AccordionGroup>

## Data Model

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

```mermaid theme={null}
graph TD;
    Orders --> Clients;
    Orders --> Products;

    Orders -- "cliente_id" --> Clients;
    Orders -- "produto_id" --> Products;
```

## Skills for agents

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

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