# Connect a data source

> Authorise a source, choose its scope, and map it onto the ontology.

## 1. Authorise

Open **Data**, choose **Add source**, and authorise with an account that has the access you need. The connection can only ever read what that account can read, so prefer a service account that will not leave the company.

## 2. Scope

Choose the objects to bring across. Narrow first: a small first sync finishes quickly and makes mapping problems obvious.

## 3. Map

Map each object onto an entity type. Two systems can map onto the same type, which is what lets one question span both.

## 4. Sync

The first sync reads everything in scope and is the slowest. Later syncs read only what changed.

```ts
const sync = await frontal.sources.sync({ sourceId: "src_123" });
```

## When a sync fails

The run names the stage that stopped and what the source returned. Expired authorisation is the most common cause by a wide margin.
