# refresh

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

> Refresh renews an Integration’s outside token before it expires; a refused refresh moves it to `needsReauth`.

Refresh renews an [Integration](/business/nouns/integration)’s outside token before it expires; a refused refresh moves it to `needsReauth`.

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

## Outputs
| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `integration` | [Integration](/business/nouns/integration) | Yes | The Integration with a new `refreshedAt`, or in `needsReauth`. |

## Effects
- Emits [`Integration.refreshed`](/business/events/Integration.refreshed).
- Performed by the [Integration Engineer](/agents/engineering/integration-engineer).
- Two-way: it runs at once, in the `try`, `send` and `do` modes.
- On refusal, holds every Action that needs it `pending` with reason `awaitingSource`.
- On refusal, opens a Task for the account holder with a reconnect link.

## Refuses when
| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| 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.refresh](/business/nouns/integration/refresh) |

## 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
Refresh the latest integration.
```

**API**

```bash
curl -X POST https://api.sb/patentpad.com/integrations/integration_1/refresh \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

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

**SDK**

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

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

**CLI**

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

**MCP**

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