# sync

URL: /business/nouns/integration/sync · Id: `verb:Integration.sync` · Call: `await $.Integration.sync({ … })` (SDK) or the `do` tool at `https://api.sb/mcp`. Inputs says what to pass, Outputs what returns, When it waits who approves.

> Sync exchanges records between a System and its connector, and the declared leader wins every conflict.

Sync exchanges records between a [System](/business/nouns/system) and its connector, and the declared leader wins every conflict.

## Inputs
| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `integration` | [Integration](/business/nouns/integration) | Yes | The connector to sync. |

## Outputs
| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `integration` | [Integration](/business/nouns/integration) | Yes | The Integration with its sync cursor moved. |

## Effects
- Emits [`Integration.synced`](/business/events/Integration.synced).
- Performed by the [Reliability Engineer](/agents/engineering/reliability-engineer).
- In `mirror`, an outside edit to a mirrored field is overwritten and recorded as an Action that ends `refused`.
- In `import`, each outside edit becomes one Change or Action, checked like any other.

## Refuses when
| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The request carries no key, or its key is expired or revoked. | [`unauthorized`](/code/api/errors/unauthorized) | Sign in again, or send a current key as a bearer token. | [Integration.sync](/business/nouns/integration/sync) |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | [Integration.sync](/business/nouns/integration/sync) |
| The record is not in a state that allows this Verb, so the call is refused. | [`refused`](/code/api/errors/refused) | Read the record, run the Verb that moves it to an allowed state, then retry. | [Integration.sync](/business/nouns/integration/sync) |
| The caller sent more requests than its rate allows. | [`rate-limited`](/code/api/errors/rate-limited) | Wait the number of seconds in the `Retry-After` header, then retry. | [Integration.sync](/business/nouns/integration/sync) |

## When it waits
| Gate | Default |
| --- | --- |
| Decision class | Low: two-way, nothing at stake |
| [Delay window](/systems/trust-and-governance/controls/one-way-windows) | None: it runs once review passes. |
| Limit | The call [Limit](/business/nouns/limit) of the [Permission](/business/nouns/permission) it runs under. |
| Over the Limit | It waits `pending` for an [Approval](/business/nouns/approval) from the [Founder](/agents/founding/founder). Approved, it runs; refused, it ends `refused` with [`limit-exceeded`](/code/api/errors/limit-exceeded); unanswered by its deadline, it ends `canceled`. |

## Example

**Ask**

```text
Sync the latest integration.
```

**API**

```bash
curl -X POST https://api.sb/shiftnote.app/integrations/integration_1/sync \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/shiftnote.app",
  "integration": {
    "$id": "https://api.sb/shiftnote.app/integrations/integration_1",
    "$type": "Integration",
    "acquired": "owned",
    "scope": "studio",
    "mode": "mirror",
    "state": "connecting"
  },
  "action": {
    "$id": "https://api.sb/shiftnote.app/actions/action_1",
    "operation": "Integration.sync",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/shiftnote.app/actions/action_1"
  }
}
```

**SDK**

```ts
import { $ } from 'startup-builder'

const integration = await $.Integration.sync({ integration: 'integration_1' })
```

**CLI**

```bash
npx startup-builder do Integration.sync --json '{"integration":"integration_1"}'
```

**MCP**

```json
{
  "name": "do",
  "arguments": {
    "code": "return await $.Integration.sync({ integration: 'integration_1' })"
  }
}
```

Guides that call it: [Sell on AWS Marketplace](/products/offers/sell-on-aws-marketplace).