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

# Pernambucanas as a data source

> Bring data from the Pernambucanas marketplace Seller Center to Nekt.

Pernambucanas is one of Brazil's largest retail chains, and its marketplace lets third-party
sellers list and sell products on pernambucanas.com.br. The Seller Center runs on the Omnik
marketplace platform and exposes the seller's orders, catalogue, reference data and
commission settlements through a REST API.

## Configuring Pernambucanas 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 Pernambucanas option from the list of connectors.

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

### 1. Add account access

You'll need an API credential created inside the Pernambucanas Seller Center. Sign in at
[marketplace.pernambucanas.com.br](https://marketplace.pernambucanas.com.br) and go to
**Credential Maintenance**. Creating a credential asks for your Seller Center password and
returns two values, both required below.

The following configurations are available:

* **API Token**: the token issued in Credential Maintenance. It is sent on every request and is stored encrypted.

* **Application ID**: the identifier shown next to the token. The API rejects a token sent without it.

* **Seller Tenant ID**: only needed when the credential belongs to a marketplace operator acting on a seller's behalf. A seller's own credential already resolves to its tenant, so leave this empty in the usual case.

* **Start Date**: the earliest record update date to sync. It applies to the streams that support incremental replication.

* **Marketplace IDs**: the marketplaces whose category tree should be synced. Used only by the `marketplace_categories` stream; leave it empty and that stream is skipped while every other stream runs normally.

* **Environment**: (Default: `production`) the Seller Center environment to read from. Change it only if your account was explicitly given access to a test environment.

* **Lookback Window**: (Default: 0 days) the number of days to re-read before the last synced update date, to pick up records the marketplace updated late.

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

## Good to know

* **Rate limit.** The Seller Center API accepts 100 requests per minute per credential. Nekt stays inside that budget and backs off automatically when the marketplace answers with a rate-limit error, so a large first extraction simply takes longer rather than failing.

* **Page sizes are set by the marketplace.** Orders are returned 50 at a time and every other endpoint 10 at a time. A first full extraction of a large catalogue is therefore slower than the order history of the same account.

* **`Order Financial Details` costs one request per order.** It is the only stream that queries the marketplace once per order, so selecting it makes the run noticeably longer on accounts with a high order volume. Select it when you need commission and settlement data; leave it out otherwise.

* **Nested data is stored as JSON text.** Fields such as `customer_data`, `payment_data` or `images` hold structured content and are stored as JSON strings. Read them in SQL with `JSON_VALUE(customer_data, '$.name')` rather than `customer_data.name`.

* **Streams your credential cannot reach are skipped.** If the credential lacks permission for an endpoint, that stream is skipped with a message in the run log and the rest of the extraction completes normally.

# Streams and Fields

## Available streams

The table below lists every stream, its **slug** (the exact identifier to pass when creating the source via API) and a short description.

| Stream                  | Slug                      | Description                                                                                        |
| ----------------------- | ------------------------- | -------------------------------------------------------------------------------------------------- |
| Orders                  | `orders`                  | Orders placed with the seller, with customer, invoice, delivery, payment and commission data.      |
| Order Items             | `order_items`             | One row per item line of each order, with price, quantity and line-level freight.                  |
| Order Financial Details | `order_financial_details` | Commission, promotional subsidies and settlement entries for each order. One request per order.    |
| Products                | `products`                | Products the seller publishes, with dimensions, tax data and category assignment.                  |
| Product SKUs            | `product_skus`            | Variants of each product, with price, stock, images and marketplace listing status.                |
| Brands                  | `brands`                  | Brands registered by the seller.                                                                   |
| Marketplace Brands      | `marketplace_brands`      | Brands the marketplace recognises for the seller's listings.                                       |
| Variants                | `variants`                | Variant axes such as colour or size, with their allowed values.                                    |
| Marketplace Categories  | `marketplace_categories`  | Marketplace category tree and the attributes each category requires. Requires **Marketplace IDs**. |
| Financial Entries       | `financial_entries`       | Manual financial entries recorded against the seller's settlement cycle.                           |

## Fields by stream

Below you'll find all available data streams from Pernambucanas and their corresponding fields:

<AccordionGroup>
  <Accordion title="Orders">
    Orders placed with the seller on the marketplace. Synced incrementally by `last_update`.

    **Key Fields:**

    * `market_place_id` - Identifier the marketplace assigned to the order (primary key)
    * `id` - Identifier of the order in the seller's own numbering
    * `status` - Current stage of the order (approved, invoiced, sent, delivered, cancelled)
    * `last_update` - Timestamp of the last change, used as the incremental replication key
    * `create_date` - Timestamp the order was first recorded in the Seller Center
    * `last_event` - Name of the most recent event applied to the order

    **Dates and Channel:**

    * `order_date` - Timestamp the customer placed the order
    * `approval_date` - Timestamp the payment was approved
    * `not_approval_date` - Timestamp the payment was refused, when it was
    * `cancel_date` - Timestamp the order was cancelled, when it was
    * `market_place_id_order` - Order identifier as shown to the customer
    * `shipping_id` - Identifier of the shipment the order was dispatched under
    * `sales_channel` - Sales channel the order came through
    * `place_of_sale` - Point of sale credited with the order
    * `exclude_from_seller_index` - Whether the order is left out of the seller's performance index

    **Order Values:**

    * `order_values_items` - Number of item lines in the order
    * `order_values_value` - Total value of the items before discounts and interest
    * `order_values_discount` - Total discount applied
    * `order_values_interest` - Total interest charged
    * `order_values_net_value` - Value after discounts and interest
    * `order_values_gross_value` - Value including freight and every charge

    **Commission:**

    * `commission_percentage` - Percentage charged on the order's products
    * `commission_value` - Amount charged on the order's products
    * `freight_commission_percentage` - Percentage charged on the order's freight
    * `freight_commission_value` - Amount charged on the order's freight
    * `is_external_calculation` - Whether the commission was calculated outside the Seller Center
    * `paid_with_bonus` - Whether the commission was settled with bonus credit

    **Account:**

    * `tenant` - Identifier of the seller account that owns the order
    * `operator` - Identifier of the marketplace operator (the hub)

    **JSON Fields:**

    * `marketplace_data` - Marketplace name, marketplace order ID, site ID and active flag
    * `customer_data` - Buyer name, document, e-mail, address and phone numbers
    * `invoice_data` - Invoice access key, number, series, CFOP, SEFAZ status and XML/DANFE links
    * `delivery_data` - Carrier, tracking code and URL, shipping method, dates, address and exceptions
    * `shipping_data` - Dispatch and expiry dates and the shipping label links
    * `freight_data` - Freight type, charged value, transit time, modal and take rates
    * `platform_data` - Platform that originated the order
    * `payment_data` - Payer, billing address and each payment method with its transaction identifiers
    * `cancellations_data` - History of cancellations applied to the order
    * `devolutions_data` - History of returns, with reason, returned items and reverse logistics
    * `receiving_period` - Delivery window agreed with the buyer
    * `campaigns`, `integrators`, `postage_data`, `credit_information_data`, `price_monitoring_data`, `marketing` - Additional data the marketplace attaches to the order
  </Accordion>

  <Accordion title="Order Items">
    One row per item line of an order. The lines come from the order payload, so this stream
    adds no extra requests to the marketplace.

    **Key Fields:**

    * `market_place_id` - Marketplace identifier of the order (part of the primary key)
    * `item_index` - Position of the line inside the order, starting at 0 (part of the primary key)
    * `order_id` - Identifier of the order in the seller's own numbering
    * `order_last_update` - Timestamp of the last change to the parent order
    * `tenant` - Identifier of the seller account

    **SKU:**

    * `id` - Identifier of the SKU sold on this line
    * `sku` - Seller's SKU code
    * `sku_name` - Name of the SKU as published
    * `sku_original` - Original SKU code, when the marketplace remapped it
    * `gtin` - Global trade item number (EAN/GTIN)
    * `model` - Manufacturer model
    * `product_type` - Product type assigned to the item
    * `product_condition` - Condition of the item sold
    * `active` - Whether the item was active when the order was placed
    * `crossdocking_days` - Days the seller needs to hand the item to the carrier
    * `supplier_code`, `erp_code`, `establishment_code`, `platform_id`, `ref_id` - External codes for the item
    * `moderation_status` - Marketplace moderation status
    * `moderation_date` - Timestamp of the last moderation decision
    * `description`, `description_html` - Descriptions of the item
    * `measurement_unit` - Unit the item is sold in
    * `unit_multiplier` - How many base units one sold unit represents

    **Price and Quantity:**

    * `unit_price` - Price of a single unit before discounts
    * `discount_unit` - Discount applied to a single unit
    * `net_price` - Line value after discounts
    * `gross_price` - Line value including every charge
    * `quantity` - Units sold on this line
    * `returned_quantity` - Units of this line that were returned

    **Stock:**

    * `stock_stock` - Stock balance recorded when the order was placed
    * `stock_min_stock` - Minimum stock configured for the SKU
    * `stock_move` - Whether the order moved the SKU's stock balance

    **JSON Fields:**

    * `freight_data` - Freight attributed to this line, with type, charged value and take rates
    * `product_data` - Product the SKU belongs to, when the marketplace sends it
    * `vendors`, `campaigns`, `operator_campaigns`, `monitored_price_data` - Additional data attached to the line
  </Accordion>

  <Accordion title="Order Financial Details">
    Commission, promotional subsidies and settlement entries for each order. This stream
    queries the marketplace **once per order**, so it makes the run longer on accounts with a
    high order volume.

    **Key Fields:**

    * `market_place_id` - Marketplace identifier of the order (primary key)
    * `order_id` - Identifier of the order in the seller's own numbering

    **Commission:**

    * `itens_commission_percent` - Commission percentage applied to the products
    * `itens_commission_value` - Commission amount charged on the products
    * `freight_commission_percent` - Commission percentage applied to the freight
    * `freight_commission_value` - Commission amount charged on the freight
    * `total_commission_value` - Total commission charged on the order

    **Settlement:**

    * `total_transfer_seller` - Amount to be transferred to the seller for this order
    * `financial_cicle_type` - Settlement cycle the order was assigned to
    * `financial_transfer_days_after_end_cicle` - Days after the cycle closes before the transfer is released

    **JSON Fields:**

    * `commission_origins` - Per-SKU commission breakdown with product and freight percentages and values
    * `discounts` - Promotions applied and how their subsidy was split between marketplace and seller
    * `financial_statements` - Ledger entries generated by the order, with type, status, value, release date and instalment position
  </Accordion>

  <Accordion title="Products">
    Products the seller publishes to the marketplace. Synced incrementally by `last_update`.
    Stock is always requested fresh, so the SKU rows match the Seller Center.

    **Key Fields:**

    * `id` - Unique identifier of the product (primary key)
    * `product_name` - Commercial name of the product
    * `active` - Whether the product is currently active
    * `last_update` - Timestamp of the last change, used as the incremental replication key
    * `create_date` - Timestamp the product was created

    **Description:**

    * `description` - Plain-text description
    * `description_html` - HTML description as published
    * `brand` - Brand the product belongs to
    * `tags` - Tags attached to the product
    * `warranty` - Warranty period offered, in months
    * `variant` - Whether the product is sold in variants (more than one SKU)
    * `unit` - Unit the product is sold in
    * `unit_initials` - Abbreviation of that unit

    **Dimensions:**

    * `product_width`, `product_height`, `product_depth`, `product_gross_weight` - Dimensions of the product itself
    * `package_width`, `package_height`, `package_depth`, `package_gross_weight` - Dimensions of the shipping package

    **Category and Account:**

    * `category_id`, `category_code`, `category_name` - The seller's own category for the product
    * `tenant` - Identifier of the seller account
    * `operator` - Identifier of the marketplace operator (the hub)
    * `account` - Identifier of the seller's account the product belongs to

    **JSON Fields:**

    * `tax_data` - ICMS origin and the NCM code the product is declared under
    * `codes` - Additional codes registered for the product
    * `categories` - Marketplace category paths, up to eight levels per channel
    * `attributes` - Product specifications, with whether the marketplace requires each one
    * `marketplaces` - Marketplaces the product is published to, with commission and active flag
  </Accordion>

  <Accordion title="Product SKUs">
    Variants of each product, with price and stock. The SKUs come from the product payload,
    so this stream adds no extra requests.

    **Key Fields:**

    * `product_id` - Identifier of the parent product (part of the primary key)
    * `id` - Unique identifier of the SKU (part of the primary key)
    * `sku` - Seller's own SKU code
    * `sku_name` - Name of the SKU as published
    * `active` - Whether the SKU is currently active
    * `product_last_update` - Timestamp of the last change to the parent product
    * `tenant` - Identifier of the seller account

    **Price and Stock:**

    * `from_price` - Reference (struck-through) price shown for the SKU
    * `price` - Selling price
    * `cost_price` - Cost price registered by the seller
    * `stock` - Current stock balance
    * `min_stock` - Minimum stock configured

    **Identification:**

    * `gtin` - Global trade item number (EAN/GTIN)
    * `model` - Manufacturer model
    * `product_type` - Product type assigned to the SKU
    * `product_condition` - Condition the SKU is sold in
    * `crossdocking_days` - Days the seller needs to hand the SKU to the carrier
    * `supplier_code`, `erp_code`, `establishment_code` - External codes for the SKU
    * `moderation_status` - Marketplace moderation status of the listing
    * `moderation_date` - Timestamp of the last moderation decision
    * `description`, `description_html` - Descriptions of the SKU

    **Package Dimensions:**

    * `package_width`, `package_height`, `package_depth`, `package_gross_weight` - Dimensions of the shipping package

    **JSON Fields:**

    * `codes` - Additional codes registered for the SKU
    * `errors` - Errors the marketplace returned for this SKU's listing
    * `images` - Images in each rendered size, with the main-image flag and display order
    * `attributes` - Specifications specific to the SKU
    * `marketplaces` - Marketplaces the SKU is published to, with commission and active flag
  </Accordion>

  <Accordion title="Brands">
    Brands registered by the seller. Synced incrementally by `last_update`.

    **Key Fields:**

    * `id` - Unique identifier of the brand (primary key)
    * `code` - Code registered for the brand
    * `name` - Display name of the brand
    * `tenant` - Identifier of the seller account
    * `operator` - Identifier of the marketplace operator (the hub)
    * `create_date` - Timestamp the brand was created
    * `last_update` - Timestamp of the last change, used as the incremental replication key
  </Accordion>

  <Accordion title="Marketplace Brands">
    Brands the marketplace recognises for the seller's listings. Same fields as `brands`.

    **Key Fields:**

    * `id` - Unique identifier of the brand (primary key)
    * `code` - Code registered for the brand
    * `name` - Display name of the brand
    * `tenant` - Identifier of the seller account
    * `operator` - Identifier of the marketplace operator (the hub)
    * `create_date` - Timestamp the brand was created
    * `last_update` - Timestamp of the last change, used as the incremental replication key
  </Accordion>

  <Accordion title="Variants">
    Variant axes such as colour or size. Synced incrementally by `last_update`.

    **Key Fields:**

    * `id` - Unique identifier of the variant axis (primary key)
    * `code` - Code registered for the axis
    * `name` - Display name of the axis, such as Colour or Size
    * `tenant` - Identifier of the seller account
    * `operator` - Identifier of the marketplace operator (the hub)
    * `create_date` - Timestamp the axis was created
    * `last_update` - Timestamp of the last change, used as the incremental replication key

    **JSON Fields:**

    * `values` - Allowed values of the axis, each with its code, name and nickname
  </Accordion>

  <Accordion title="Marketplace Categories">
    The marketplace's category tree and the attributes each category requires. This stream
    only runs when **Marketplace IDs** is filled in; otherwise it is skipped with a note in
    the run log.

    **Key Fields:**

    * `marketplace` - Marketplace whose tree the row belongs to (part of the primary key)
    * `id` - Unique identifier of the category (part of the primary key)
    * `channel` - Sales channel the category belongs to
    * `ean_required` - Whether the marketplace requires an EAN for products in this category
    * `last_update` - Timestamp of the last change, used as the incremental replication key
    * `create_date` - Timestamp the category was created
    * `tenant` - Identifier of the seller account the category was read for
    * `operator` - Identifier of the marketplace operator (the hub)

    **Category Path:**

    * `category_channel` - Channel recorded inside the category path
    * `category_tag` - Tag the marketplace uses for the path
    * `category_id1` … `category_id8` - Identifier of each level of the path
    * `category_name1` … `category_name8` - Name of each level of the path

    **JSON Fields:**

    * `attributes` - Attributes the marketplace defines for the category, with whether each is required and the accepted values
  </Accordion>

  <Accordion title="Financial Entries">
    Manual financial entries recorded against the seller's settlement cycle. The endpoint
    accepts no filters, so this stream is always a full table.

    **Key Fields:**

    * `id` - Unique identifier of the entry (primary key)
    * `type` - Type of the entry, such as a sale or an adjustment
    * `status` - Current status of the entry
    * `value` - Amount of the entry
    * `description` - Description recorded with the entry

    **Cycle and Payment:**

    * `type_of_cycle` - Type of settlement cycle the entry belongs to
    * `financial_cycle_status` - Status of that cycle
    * `beginning_of_cycle` - Event that opens the cycle
    * `end_of_cycle` - Event that closes the cycle
    * `payment_status` - Payment status of the entry
    * `payment_error` - Reason the payment failed, when it did
    * `transfer_date` - Date the amount is transferred to the seller
    * `release_date` - Date the amount is released for transfer
    * `statements` - Statement the entry was consolidated into
    * `statement_id` - Identifier of that statement

    **References:**

    * `order_id` - Order the entry relates to, in the seller's own numbering
    * `marketplace_id` - Marketplace identifier of that order
    * `tenant` - Identifier of the seller account
    * `seller_tenant` - Identifier of the seller the entry settles
    * `operator` - Identifier of the marketplace operator (the hub)
    * `operator_name` - Name of that operator
    * `application_id` - Identifier of the API credential that created the entry
    * `create_date` - Timestamp the entry was created
    * `last_update` - Timestamp of the last change to the entry

    **JSON Fields:**

    * `typed_label` - Classification of the entry, with type identifier, label and description
  </Accordion>
</AccordionGroup>
