> For the complete documentation index, see [llms.txt](https://docs.middle.app/middle-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.middle.app/middle-docs/building-workflows/sync.md).

# Sync

## Turning a sync on or off

To turn a sync on or off:

1. Go to the desired app connection by clicking on the connection in the left-hand menu
2. Go to the record type you'd like to toggle on or off
3. Click the toggle to the right of the desired sync type

## Sync types

There are three types of syncs:

* **Complete transfers** - Grab all the data available from an endpoint or external resource. This sync is common for smaller datasets.
* **Primary key lookups** - Request data for a specific record using a primary identifier. For example, if Middle grabs a record, such as an invoice, and sees a user ID associated with that sale, Middle will perform a sync to grab that user's data.
* **Recent record lookups** - Syncs data from a datetime range. For example, grabbing all sales that have occurred in the past hour, every 20 minutes. The datetime scope and frequency of these syncs are configurable from the developer portal.

{% hint style="info" %}
Recent record lookups [can be setup](/middle-docs/app-development/sync-records.md#recent-record-lookup) with weekly syncs that run on Saturday mornings. These grab records over the previous weekly to ensure Middle doesn't miss anything.
{% endhint %}

## Ad-hoc syncs <a href="#ad-hoc-syncs" id="ad-hoc-syncs"></a>

You are able to initiate a sync manually by triggering an ad-sync.

* For complete transfers, an ad-hoc sync will grab all the data from an endpoint or resource
* For a primary key lookup, you will need to input a primary ID to grab data for
* For recent record updates, you will need to select a datetime range you'd like to get data from.&#x20;

![A recent record poll sync ad-hoc sync](/files/sieP42KbmMdZaxWW6UqS)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.middle.app/middle-docs/building-workflows/sync.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
