The connector only reads. It never approves, cancels, receives or comments on a request.
Configuring Troquecommerce as a Source
In the Sources tab, click on the “Add source” button located on the top right of your screen. Then, select the Troquecommerce option from the list of connectors. Click Next and you’ll be prompted to add your access.1. Add account access
The connector authenticates with an API token of your store.1
Generate the API token
In the Troquecommerce dashboard, open Automações e Integrações › API and click Gerar novo token. A token with READ access is enough. See Troquecommerce’s help article.
2
Fill in the source
Paste the token below exactly as shown, without any prefix.
- API Token: The API token of your store.
- Start Date: Requests last updated before this date are not read.
- Lookback Days (advanced, default 1): Each incremental sync reads again this many days before where the previous sync stopped, to pick up late changes (1 to 30).
2. Select streams
Choose which data streams you want to sync. For faster extractions, select only the streams that are relevant to your analysis.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.
4. Configure data source
Describe your data source for easy identification within your organization, not exceeding 140 characters. To define your Trigger, 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.
- Determine when to execute an 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.
5. Check your new source
You can view your new source on the Sources page. If needed, manually trigger the source extraction by clicking on the arrow button. Once executed, your data will appear in your Catalog.How the data is read
- Requests are read by their last update date: the first sync reads everything updated since the Start Date, and each later sync reads what changed since the previous one (minus the Lookback Days). Whenever Troquecommerce updates a request’s last update date (for example on a status change), the request comes again with its new values.
- Each changed request is read in full, so the first sync of a store with many requests takes a while: about one request to Troquecommerce per exchange or return (two when comments are selected), at up to three per second; about 6 hours for 30,000 requests with comments. For a store with many requests, start with a recent Start Date. If a later sync fails midway, the next one resumes after the last period it completed; a first sync or a Full sync that fails starts over.
- When Reverse Order Comments is selected, requests that are still open (not Finalizado or Cancelado) and were updated in the last 30 days are read again on every sync (at most the 1,000 most recent), so new comments and pending issues are picked up even when nothing else changed in the request. Each one costs two requests per sync. A comment added to an older or already finished request arrives when the request changes again or on a Full sync.
- A request deleted in Troquecommerce stays in your tables as it was last read (the API does not report deletions); it is no longer followed.
- If you select Reverse Order Comments on a source that already exists, run a Full sync to bring the comments of the requests read before.
- Some links are temporary: the shipping label (
tracking_shipping_label_url) and the customer’s photos (reason_image_urls) expire after a while. - The API token needs only READ access, and every table uses the same access: if Troquecommerce refuses the token, the sync stops with a message asking to update the token.
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.Fields by stream
Reverse Orders
Reverse Orders
One row per exchange or return request. Primary key:
id. Incremental by updated_at.Identification and status:id- Unique id of the request in Troquecommerce (UUID)ecommerce_number- Number of the original order in the e-commerce platformecommerce_id- Internal id of the original order in the e-commerce platformstatus- Current status as shown in the dashboard (e.g. Em Análise, Aguardando Envio, Finalizado, Cancelado)reverse_type- Type of the request (Troca, Devolução, Troca e devolução, Sem Reembolso, Vale (Cupom), Estorno…)created_at- When the request was opened (UTC)updated_at- When the request last changed (UTC)cancel_reason- Why the request was canceledis_split_order,is_collect,is_complete,is_exception,is_second_request,is_second_reverse- Flags of the request
client_name,client_email,client_phone,client_document- Customer who opened the requestclient_address- Customer address (JSON)
price- Total value of the items in the requestexchange_value- Part turned into an exchange voucherrefund_value- Part refunded in moneysaved_refund_value,saved_exchange_value,saved_shipping_value- Values saved by an operator in the dashboarddiscount,order_shipping_cost- Discount and shipping of the original order, proportional to the returned itemsretained_value,retained_bonus,retention_level- Values retained by the store and retention rule applied
coupon_code,coupon_description,coupon_ecommerce_id,coupon_validity,coupon_value- Voucher generated for the exchange partcoupon_bonus_code,coupon_bonus_ecommerce_id,coupon_bonus_value- Separate bonus voucher, in stores that split itcoupon_used_on_order- Coupon used in the original order
refund_payment_value,refund_payment_action,refund_payment_is_integrated,refund_payment_created_at- Refund maderefund_payment_giftcard_value,refund_payment_original_method_value,refund_payment_cashback_value,refund_payment_summary- How the refund was splitgateway_transaction_id,gateway_name- Payment gateway of an integrated refundrefund_details_is_pix,refund_details_pix_type,refund_details_pix_key,refund_details_bank_code,refund_details_bank_agency,refund_details_bank_account,refund_details_bank_account_type,refund_details_document,refund_details_refund_method,refund_details_refund_type- Refund details informed by the customer
tracking_status,tracking_courier_company,tracking_courier_tracking_code,tracking_courier_collect_number- Current trackingtracking_created_at,tracking_due_date,tracking_posted_date,tracking_expected_delivery_date,tracking_delivery_date- Tracking datestracking_is_collect,tracking_posting_address,tracking_price,tracking_locker,tracking_url,tracking_shipping_label_url- Shipment detailstracking_return_address_id,tracking_return_address- Return point the package goes to (JSON)
invoices- Return invoices (NFD) registered (JSON)sales_invoices- Sales invoices of the original order (JSON)replaced_items- Items chosen in a direct exchange (JSON)replaced_order_ecommerce_number- Replacement order created in the e-commerce platformsellers- Sellers involved (marketplaces)
Reverse Order Items
Reverse Order Items
One row per item of a request. Primary key:
reverse_order_id + item_key.reverse_order_id- Request the item belongs toitem_key- Key of the item within its request (Troquecommerce gives items no id)item_index- Position of the item in the requestreverse_order_updated_at- Last update of the request when the item was readecommerce_product_id,sku,ean,ref_id,description,image_url- Productquantity,original_quantity,price,price_discount,shipping_price- Quantities and valuesis_exchange,is_removed,is_received,is_retained,is_added_by_operator- Flags of the itemreason,sub_reason,client_comment,organisation_comment,reason_image_urls- Reason given by the customerecommerce_number,seller- Original order and seller of the itemreplaced_item_sku,replaced_item_description- Item chosen in a direct exchange
Reverse Order History
Reverse Order History
One row per event of a request. Primary key:
reverse_order_id + event_key.reverse_order_id- Request the event belongs toevent_key- Key of the event within its requestevent_index- Position of the event in the history (oldest first)reverse_order_updated_at- Last update of the request when the event was readcreated_at- When the event happenedcreated_by- Who performed it (an operator’s email, or a system or integration)description- What happened
Reverse Order Comments
Reverse Order Comments
One row per comment. Primary key:
id.id- Unique id of the commentreverse_order_id- Request the comment belongs toreverse_order_updated_at- Last update of the request when the comment was readcomment,created_at,created_by_email- The comment, when and who wrote it (‘Sistema’ for the API or the system)attachments- Files attached (JSON)pending_id,pending_opened_at,pending_closed_at,pending_type_id,pending_type_name,pending_opened_by_email,pending_closed_by_email- Internal pending issue opened or closed by the comment (pending_closed_atempty while it is open)
Return Addresses
Return Addresses
One row per address registered by the store. Primary key:
address_key. Full table.address_key- The address id (or a hash of its fields when it has none)id,recipient- Id and name of the addressstreet,number,complement,suburb,city,state,zip_code,country- Addressis_main,is_default,is_physical_store,is_distribution_center- Kind of addressemail,phone_number,opening_hours,document,seller_id,organisation_name- Contact and ownerhas_transfer,transfer_name,transfer_deadline,transfer_fee- Transfer service of the return point
Exchange Deadlines
Exchange Deadlines
One row with the store’s general deadlines (Settings › Rules › General deadlines). Full table. Empty when the store has no rules registered.
exchange_deadline_days- Maximum number of days for an exchangerefund_deadline_days- Maximum number of days for a refund
Implementation notes
- Dates are in UTC (ISO 8601). Monetary values keep the API’s exact decimals.
- Nested values (addresses, invoices, attachments) are stored as JSON text.
- The connector does not read the sales invoice lookup (it queries the store’s ERP live for each order) nor the refund proof files (their links expire in 15 minutes).