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

# PDV Mundo as a data source

> Bring your PDV Mundo field execution data to Nekt: points of sale, store visits, route plans, questionnaires and their answers.

PDV Mundo is a trade marketing and field execution platform: promoters visit points of sale (stores), check in and out, work for one or more business units (clients or brands) and fill in questionnaires such as shelf audits. This connector reads your PDV Mundo account through the PDV Mundo GraphQL API and brings the registers (users, products, points of sale, questions and questionnaires), the store visits and the work done in them, the planned visits of the route plans, and every questionnaire answer.

> [!NOTE]
>
> PDV Mundo is not a point-of-sale (cash register) system: its API has no sales, payments, stock or cash register data. The connector only reads data; it never creates, changes or deletes anything in PDV Mundo.

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

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

### 1. Add account access

The connector signs in with a PDV Mundo **API key**. PDV Mundo issues API keys on request:

**1. Request the key**

Contact PDV Mundo support and ask for an API key with read access to your account's data.

**2. Copy the key**

Copy only the key. If PDV Mundo sends it as `Bearer <key>`, either form works.

The following configurations are available:

* **API Key**: The PDV Mundo API key.
* **Start Date**: Earliest date synced by the activity tables (Point of Sale Checks, Business Unit Checks, Work Schedule Items, Questionnaire Answers and Answers) on the first sync and on full syncs. The registers (Users, Products, Points of Sale, Questions and Questionnaires) are always read in full.
* **Lookback Days** (advanced): How many days before the last sync the Questionnaire Answers and Work Schedule Items tables read again on every sync, to catch questionnaires uploaded late from offline devices and planned visits whose status changed. Default: 7.

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.md), 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. For PDV Mundo it also removes planned visits that were deleted or rescheduled in PDV Mundo.

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.

> [!NOTE]
>
> If the API key is not allowed to read some data, the tables that need it are skipped (and not updated) and the others keep syncing; the run log names the skipped tables. Ask PDV Mundo support to extend the key, or deselect those tables.

## Fields by stream

> [!NOTE]
>
> Identifiers are strings. Nested data that varies in shape is stored as JSON in a single column: the questionnaire items (`items`) and the value of each answer (`content`, a JSON array whose objects have a `__typename` of AnswerBoolean, AnswerChoice, AnswerDate, AnswerFile, AnswerNumeric or AnswerText and the value fields of that type). Times marked UTC are in UTC; check-in and check-out times are as recorded by PDV Mundo, with the device time zone in `timezone_in` and `timezone_out`.

### Registers

> [accordion] Users
>
> People with access to your PDV Mundo account: promoters, supervisors and administrators.
>
> Table: `users` · Primary key: `id` · Sync: Incremental (`updated_at`)
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | String | Unique identifier of the user. |
> | `tenant_id` | String | Identifier of the PDV Mundo account (tenant) the user belongs to. |
> | `name` | String | Name of the user (promoter, supervisor or administrator). |
> | `email` | String | Email address of the user (unique). |
> | `email_verified_at` | Datetime | When the user verified the email address (UTC). |
> | `created_at` | Datetime | When the record was created in PDV Mundo (UTC). |
> | `updated_at` | Datetime | When the record was last updated in PDV Mundo (UTC); used as the incremental replication key. |

> [accordion] Products
>
> Products registered in PDV Mundo, with their category.
>
> Table: `products` · Primary key: `id` · Sync: Incremental (`updated_at`)
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | String | Unique identifier of the product. |
> | `name` | String | Name of the product. |
> | `active` | Boolean | Whether the product is active. |
> | `brand_id` | String | Identifier of the product's brand. |
> | `product_category_id` | String | Identifier of the product's category. |
> | `category_name` | String | Name of the product's category (as of the product's last update). |
> | `category_active` | Boolean | Whether the product's category is active (as of the product's last update). |
> | `created_at` | Datetime | When the record was created in PDV Mundo (UTC). |
> | `updated_at` | Datetime | When the record was last updated in PDV Mundo (UTC); used as the incremental replication key. |

> [accordion] Points of Sale
>
> Stores (points of sale) visited by the field team, with address, location, retail chain, channel, region, banner and contacts.
>
> Table: `point_of_sales` · Primary key: `id` · Sync: Incremental (`updated_at`)
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | String | Unique identifier of the point of sale (store visited by the field team). |
> | `name` | String | Name of the point of sale. |
> | `is_active` | Boolean | Whether the point of sale is active. |
> | `cnpj` | String | CNPJ (Brazilian company registry number) of the point of sale. |
> | `external_code` | String | Code of the point of sale in the customer's own systems. |
> | `chain_external_code` | String | Code of the point of sale's retail chain in the customer's own systems. |
> | `zip_code` | String | Postal code (CEP) of the point of sale. |
> | `address` | String | Street address of the point of sale. |
> | `number` | String | Street number of the point of sale. |
> | `district` | String | District (bairro) of the point of sale. |
> | `complement` | String | Address complement of the point of sale. |
> | `city_id` | String | Identifier of the point of sale's city. |
> | `city_name` | String | Name of the point of sale's city. |
> | `city_ibge_code` | Integer | IBGE code of the point of sale's city. |
> | `state_id` | String | Identifier of the point of sale's state. |
> | `state_name` | String | Name of the point of sale's state. |
> | `state_code` | String | Two-letter code (UF) of the point of sale's state. |
> | `latitude` | Number | Latitude of the point of sale. |
> | `longitude` | Number | Longitude of the point of sale. |
> | `category_id` | String | Identifier of the point of sale's category. |
> | `category_name` | String | Name of the point of sale's category (as of the point of sale's last update). |
> | `chain_id` | String | Identifier of the point of sale's retail chain. |
> | `chain_name` | String | Name of the point of sale's retail chain (as of the point of sale's last update). |
> | `channel_id` | String | Identifier of the point of sale's sales channel. |
> | `channel_name` | String | Name of the point of sale's sales channel (as of the point of sale's last update). |
> | `regional_id` | String | Identifier of the point of sale's region. |
> | `regional_name` | String | Name of the point of sale's region (as of the point of sale's last update). |
> | `flag_id` | String | Identifier of the point of sale's banner (bandeira). |
> | `flag_name` | String | Name of the point of sale's banner (bandeira) (as of the point of sale's last update). |
> | `commercial_responsible_name` | String | Name of the commercial contact at the point of sale. |
> | `commercial_responsible_email` | String | Email of the commercial contact at the point of sale. |
> | `merchandising_responsible_name` | String | Name of the merchandising contact at the point of sale. |
> | `merchandising_responsible_email` | String | Email of the merchandising contact at the point of sale. |
> | `created_at` | Datetime | When the record was created in PDV Mundo (UTC). |
> | `updated_at` | Datetime | When the record was last updated in PDV Mundo (UTC); used as the incremental replication key. |

> [accordion] Questions
>
> Questions used in the questionnaires.
>
> Table: `questions` · Primary key: `id` · Sync: Incremental (`updated_at`)
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | String | Unique identifier of the question. |
> | `text` | String | Text of the question. |
> | `type` | String | Type of answer the question expects (boolean, choice, date, file, numeric, text...). |
> | `created_at` | Datetime | When the record was created in PDV Mundo (UTC). |
> | `updated_at` | Datetime | When the record was last updated in PDV Mundo (UTC); used as the incremental replication key. |

> [accordion] Questionnaires
>
> Questionnaires (audits, surveys and forms) with their items in order. Read in full on every sync. If a question used by an item was deleted in PDV Mundo, that questionnaire's items are loaded without question ids.
>
> Table: `questionnaires` · Primary key: `id` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | String | Unique identifier of the questionnaire. |
> | `name` | String | Name of the questionnaire. |
> | `type` | String | Type of the questionnaire. |
> | `is_justifiable` | Boolean | Whether the questionnaire may be skipped with a justification. |
> | `items` | String (JSON) | Items of the questionnaire in order (JSON array of objects: id, next\_id, is\_required, is\_end and question.id; question texts are in the questions table). |
> | `created_at` | Datetime | When the record was created in PDV Mundo (UTC). |
> | `updated_at` | Datetime | When the questionnaire was last updated in PDV Mundo (UTC). |

### Field activity

> [accordion] Point of Sale Checks
>
> Store visits: each check-in and check-out of a promoter at a point of sale, with time, duration, location, distance and photos.
>
> Table: `point_of_sale_checks` · Primary key: `id` · Sync: Incremental (`updated_at`)
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | String | Unique identifier of the store visit check (check-in/check-out at a point of sale). |
> | `point_of_sale_id` | String | Identifier of the point of sale visited. |
> | `user_id` | String | Identifier of the user (promoter) who made the visit. |
> | `datetime_in` | Datetime | Check-in date and time, as recorded by PDV Mundo (see timezone\_in). |
> | `datetime_out` | Datetime | Check-out date and time, as recorded by PDV Mundo (see timezone\_out); empty while the visit is open. |
> | `timezone_in` | String | Time zone of the device at check-in. |
> | `timezone_out` | String | Time zone of the device at check-out. |
> | `elapsed_time` | Integer | Duration of the visit in seconds. |
> | `forced_checkout` | Boolean | Whether the check-out was forced (not done by the promoter). |
> | `distance_in` | Number | Distance between the device and the point of sale at check-in. |
> | `distance_out` | Number | Distance between the device and the point of sale at check-out. |
> | `latitude_in` | Number | Latitude of the device at check-in. |
> | `longitude_in` | Number | Longitude of the device at check-in. |
> | `latitude_out` | Number | Latitude of the device at check-out. |
> | `longitude_out` | Number | Longitude of the device at check-out. |
> | `battery_in` | Integer | Battery level of the device at check-in. |
> | `battery_out` | Integer | Battery level of the device at check-out. |
> | `hash` | String | Unique hash of the check-in. |
> | `hash_out` | String | Unique hash of the check-out. |
> | `file_checkin` | String | Photo taken at check-in (file reference or URL). |
> | `file_checkout` | String | Photo taken at check-out (file reference or URL). |
> | `created_at` | Datetime | When the record was created in PDV Mundo (UTC). |
> | `updated_at` | Datetime | When the record was last updated in PDV Mundo (UTC); used as the incremental replication key. |

> [accordion] Business Unit Checks
>
> The work done for each business unit (client or brand) during a store visit, with start and end times.
>
> Table: `business_unit_checks` · Primary key: `id` · Sync: Incremental (`updated_at`)
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | String | Unique identifier of the business unit check (work done for one business unit during a store visit). |
> | `business_unit_id` | String | Identifier of the business unit (client/brand) the work was done for. |
> | `point_of_sale_check_id` | String | Identifier of the store visit check this work belongs to. |
> | `point_of_sale_id` | String | Identifier of the point of sale (through the store visit check). |
> | `user_id` | String | Identifier of the user (promoter) who did the work. |
> | `work_schedule_id` | String | Identifier of the route plan (work schedule) of the work. |
> | `datetime_in` | Datetime | Start date and time, as recorded by PDV Mundo (see timezone\_in). |
> | `datetime_out` | Datetime | End date and time, as recorded by PDV Mundo (see timezone\_out); empty while open. |
> | `timezone_in` | String | Time zone of the device at the start. |
> | `timezone_out` | String | Time zone of the device at the end. |
> | `battery_in` | Integer | Battery level of the device at the start. |
> | `battery_out` | Integer | Battery level of the device at the end. |
> | `hash` | String | Unique hash of the start. |
> | `hash_out` | String | Unique hash of the end. |
> | `hash_pos_check` | String | Hash of the related store visit check. |
> | `created_at` | Datetime | When the record was created in PDV Mundo (UTC). |
> | `updated_at` | Datetime | When the record was last updated in PDV Mundo (UTC); used as the incremental replication key. |

> [accordion] Business Units
>
> Business units (the clients or brands the field team works for), with contract details and the points of sale they serve. PDV Mundo has no list of business units, so the connector finds them through the business unit checks: a business unit with no check since the start date does not appear.
>
> Table: `business_units` · Primary key: `id` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | String | Unique identifier of the business unit (a client or brand the field team works for). |
> | `name` | String | Name of the business unit. |
> | `contract_value` | Number | Contract value. |
> | `contract_time` | Integer | Contract duration. |
> | `cost_serving_rule_in_min` | Integer | Cost-to-serve rule: minimum minutes. |
> | `cost_serving_rule_alert_min` | Integer | Cost-to-serve rule: alert threshold in minutes. |
> | `cost_serving_rule_out_min` | Integer | Cost-to-serve rule: maximum minutes. |
> | `chain_billing_apportionment_type` | String | How billing is apportioned across retail chains. |
> | `point_of_sale_ids` | Array of strings | Identifiers of the points of sale served for this business unit. |
> | `created_at` | Datetime | When the record was created in PDV Mundo (UTC). |
> | `updated_at` | Datetime | When the business unit was last updated in PDV Mundo (UTC). |

> [accordion] Work Schedule Items
>
> Planned visits from the route plans: which promoter should visit which point of sale on which date, and whether the visit was done (PENDING, DONE or MISSED). Each sync reads from the last sync minus the lookback up to 60 days ahead, so future visits and status changes are refreshed. PDV Mundo computes the status: a visit made offline and uploaded later turns a MISSED visit into DONE, so each sync also goes back to the oldest store visit uploaded since the previous sync. Planned visits deleted or rescheduled in PDV Mundo stay in the table (as PENDING with a past date) until a full sync: schedule a weekly **Additional Full Sync** for this table.
>
> Table: `work_schedule_items` · Primary key: `id` · Sync: Incremental (`date`)
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | String | Unique identifier of the planned visit (route plan item). |
> | `date` | Date | Planned date of the visit; used as the incremental replication key. |
> | `status` | String | Status of the planned visit: PENDING (not done yet, date not passed), DONE (done on the planned date) or MISSED (date passed without a visit). |
> | `user_id` | String | Identifier of the user (promoter) the visit is planned for. |
> | `point_of_sale_id` | String | Identifier of the point of sale to visit. |
> | `point_of_sale_check_id` | String | Identifier of the store visit check made on the planned date, when there is one. |
> | `work_schedule_id` | String | Identifier of the route plan (work schedule) the visit belongs to. |
> | `work_schedule_date` | Date | Date of the route plan. |
> | `work_schedule_status` | String | Status of the route plan. |
> | `work_schedule_start` | Date | Start date of the route plan. |
> | `work_schedule_end` | Date | End date of the route plan. |
> | `work_schedule_is_planned` | Boolean | Whether the route plan is a planned one. |
> | `work_schedule_user_id` | String | Identifier of the user (promoter) of the route plan. |
> | `work_schedule_point_of_sale_id` | String | Identifier of the point of sale of the route plan. |
> | `created_at` | Datetime | When the record was created in PDV Mundo (UTC). |
> | `updated_at` | Datetime | When the planned visit was last updated in PDV Mundo (UTC). |

### Questionnaire answers

> [accordion] Questionnaire Answers
>
> One row per questionnaire filled in, with who filled it in, where and for which business unit. Each sync re-reads the last **Lookback Days** and goes further back when questionnaires filled in offline reach PDV Mundo late.
>
> Table: `questionnaire_answers` · Primary key: `id` · Sync: Incremental (`answered_at`)
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | String | Unique identifier of the filled-in questionnaire. |
> | `questionnaire_id` | String | Identifier of the questionnaire filled in. |
> | `user_id` | String | Identifier of the user (promoter) who filled it in. |
> | `point_of_sale_id` | String | Identifier of the point of sale where it was filled in. |
> | `business_unit_id` | String | Identifier of the business unit (client/brand) it was filled in for. |
> | `product_id` | String | Identifier of the product it refers to, when filled in per product. |
> | `product_category_id` | String | Identifier of the product category it refers to, when filled in per category. |
> | `brand_id` | String | Identifier of the brand it refers to, when filled in per brand. |
> | `tenant_id` | String | Identifier of the PDV Mundo account (tenant). |
> | `answered_at` | Datetime | When the questionnaire was answered (UTC); used as the incremental replication key. |
> | `answered_at_local` | String | When the questionnaire was answered, as recorded with the device's UTC offset (ISO 8601). |

> [accordion] Answers
>
> One row per question answered. The answer itself is in the `content` JSON column (empty when PDV Mundo cannot return it, for example a deleted option; the run log says how many); join with `questionnaire_answers` on `questionnaire_answer_id` and with `questions` on `question_id`.
>
> Table: `answers` · Primary key: `id` · Sync: Incremental (`updated_at`)
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | String | Unique identifier of the answer (one question answered in a questionnaire). |
> | `questionnaire_answer_id` | String | Identifier of the filled-in questionnaire this answer belongs to (questionnaire\_answers.id). |
> | `question_id` | String | Identifier of the question answered. |
> | `questionnaire_item_id` | String | Identifier of the questionnaire item answered. |
> | `product_id` | String | Identifier of the product the answer refers to, when the question is per product. |
> | `product_category_id` | String | Identifier of the product category the answer refers to, when the question is per category. |
> | `brand_id` | String | Identifier of the brand the answer refers to, when the question is per brand. |
> | `type` | String | Type of the answer (boolean, choice, date, file, numeric, text...). |
> | `subtype` | String | Subtype of the answer. |
> | `answered_at` | Datetime | When the question was answered (UTC). |
> | `answered_at_local` | String | When the question was answered, as recorded with the device's UTC offset (ISO 8601). |
> | `content` | String (JSON) | The answer itself (JSON array; each object has \_\_typename AnswerBoolean, AnswerChoice, AnswerDate, AnswerFile, AnswerNumeric or AnswerText and the value fields of that type: boolean, choice/label, date, file\_name/file\_url, number or text, plus additional\_answer where it applies). |
> | `created_at` | Datetime | When the record was created in PDV Mundo (UTC). |
> | `updated_at` | Datetime | When the record was last updated in PDV Mundo (UTC); used as the incremental replication key. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.