Integration
An Integration is an outside Source connected to a System with credentials, at Studio, Startup, or Customer scope.
Properties
| Property | Type | Required | Description |
|---|---|---|---|
scope | string | required | One of studio, startup, or customer. |
sync | string | Which side leads a sync connector: platform or provider. | |
mode | string | required | How records move: mirror writes db.sb out to the outside tool; import turns edits there into Changes. db.sb is the record in both. |
state | string | required | Where the connected account stands; read fresh before every call. |
venue | string | The id of the ad, social or app-store venue the account is on, when it is on one. | |
account | string | The outside account’s own id, such as an ad account, a workspace or a repository. | |
grants | string[] | The outside permissions the account holder approved: the narrowest set its Verbs need. | |
connectedBy | Party | Who approved the connection; a Human’s own account is used only under that Human’s Mandate. | |
environment | string | A test Integration reaches only the upstream’s test account, as a Stripe test account does. | |
expiresAt | datetime | When access lapses unless refreshed. | |
refreshedAt | datetime | When the platform last renewed the outside token. | |
lastError | string | The error slug of the last failed call or refresh, cleared by the next success. | |
cursor | string | Where the last sync run stopped, so the next run reads only what changed. |
Inherited from Source: 2 properties
| Property | Type | Required | Description |
|---|---|---|---|
acquired | string | required | One of owned, wrapped, or recruited. |
terms | text | The terms the Startup holds the right to use and resell it under. |
Object
{
"$id": "https: //api.sb/ petpantry.shop/ integrations/ integration_1",
"$type": "Integration",
"acquired": "owned",
"terms": "Resale allowed under the provider’s published API terms; 10, 000 calls a month included.",
"scope": "studio",
"sync": "Example sync",
"mode": "mirror",
"state": "connecting",
"venue": "Example venue",
"account": "Example account",
"grants": [
"Example grants"
],
"connectedBy": "party_1",
"environment": "test",
"expiresAt": "2026-10-22T12: 00: 00Z",
"refreshedAt": "2026-10-22T12: 00: 00Z",
"lastError": "Example last error",
"cursor": "Example cursor"
}Relationships
- An Integration connects one System: an Integration connects an outside Source to one System, with credentials at Studio, Startup or Customer scope.
connects, inverseconnectedVia.
Lifecycle
| State | Meaning | Moves to |
|---|---|---|
connecting (first) | Waiting for the account holder to approve the outside account. | connected by Integration.connect; revoked by Integration.revoke |
connected | Calls and syncs run with a live token. | needsReauth by Integration.refresh; paused by Integration.pause; revoked by Integration.revoke |
needsReauth | The upstream refused a refresh, so calls wait until the account holder approves again. | connected by Integration.reconnect; revoked by Integration.revoke |
paused | Every call stops, and the token and cursor are kept. | connected by Integration.resume; revoked by Integration.revoke |
revoked | Its token is revoked with the upstream; every record it brought in stays. | None: it ends here. |
Verbs
createCreates an Integration.POST /{namespace}/integrationsgetReturns one Integration by id.GET /{namespace}/integrations/{id}listReturns Integrations, newest first, one page at a time.GET /{namespace}/integrationsupdateChanges the given properties of an Integration.PATCH /{namespace}/integrations/{id}deleteDeletes an Integration; its history is kept.DELETE /{namespace}/integrations/{id}callCall sends one request to an upstream through an Integration, with its token filled in server-side, for endpoints no Mapping covers.POST /{namespace}/integrations/{integration}/callconnectConnect asks an account holder to approve an outside account for one System and records the grants they approve.POST /{namespace}/integrations/connectpausePause stops every call through an Integration at once and keeps its token and cursor.POST /{namespace}/integrations/{integration}/pausereconnectReconnect re-approves an Integration in place, keeping its id and cursor, so nothing re-imports.POST /{namespace}/integrations/{integration}/reconnectrefreshRefresh renews an Integration’s outside token before it expires; a refused refresh moves it to `needsReauth`.POST /{namespace}/integrations/{integration}/refreshresumeResume restarts a paused Integration from its cursor and releases the Actions that waited on it.POST /{namespace}/integrations/{integration}/resumerevokeRevoke ends an Integration at once: its token is revoked with the upstream, and every record it brought in stays.POST /{namespace}/integrations/{integration}/revokesyncSync exchanges records between a System and its connector, and the declared leader wins every conflict.POST /{namespace}/integrations/{integration}/sync
Permissions
Which Access level may call each Verb. One-way Verbs wait their delay window.
| Operation | owner | admin | member | viewer |
|---|---|---|---|---|
Integration.create | Yes | Yes | Yes | No |
Integration.get | Yes | Yes | Yes | Yes |
Integration.list | Yes | Yes | Yes | Yes |
Integration.update | Yes | Yes | Yes | No |
Integration.delete | Yes | Yes | Yes | No |
Integration.call | Yes | No | No | No |
Integration.connect | Yes | Yes | Yes | No |
Integration.pause | Yes | Yes | Yes | No |
Integration.reconnect | Yes | Yes | Yes | No |
Integration.refresh | Yes | Yes | Yes | No |
Integration.resume | Yes | Yes | Yes | No |
Integration.revoke | Yes | Yes | Yes | No |
Integration.sync | Yes | Yes | Yes | No |
Call it
Sync the latest integration.Example
A bookkeeping service connects each client's bank feed as an Integration at Customer scope. The feed syncs nightly into the client's own Tenant, and db.sb stays the record.