Skip to content

Integration routes: list, update, delete

The Integration Verbs list, update, delete as api.sb routes, with inputs, result, refusals and an example.

Reference for Integration, one group of Integration routes.

Integration.list

Returns Integrations, newest first, one page at a time. Verb page.

Text
GET /{namespace}/integrations

Query: the inputs. Reads only: it emits no Event.

Inputs

InputTypeRequiredDescription
limitintegerAt most this many records, up to 100. The default is 20.
afterstringThe cursor from the previous page.
wherestringA filter over the properties, such as paidAt = null and total.amount > 500.
sortstringProperties to sort by, comma-separated; a leading minus sorts descending.
totalbooleanTrue adds the match count as meta.total, exact up to 10,000 matches and estimated above.
facetsstringProperties to count by value, comma-separated, returned as meta.facets.
fieldsstringProperties to return on each record, comma-separated; $id and $type always return.
includestringRelated records to embed in place of their URLs, comma-separated.
depthintegerHow many levels of related records to embed. The default is 1.
qstringWords to match across the text properties, ranked by relevance.
matchstringRanks the search by words, or meaning; words is the default.

Returns

OutputTypeRequiredDescription
integrationslist of IntegrationrequiredOne page of Integrations.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
curl "https://api.sb/leaseline.app/integrations?limit=20" \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
JSON
{
  "api": "https://api.sb/leaseline.app",
  "$type": "Integration",
  "integrations": [
    {
      "$id": "https://api.sb/leaseline.app/integrations/integration_alVwjQcmRy",
      "$type": "Integration",
      "acquired": "owned",
      "scope": "studio",
      "mode": "mirror",
      "state": "connecting"
    }
  ],
  "meta": {
    "limit": 20,
    "after": "integration_alVwjQcmRy"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/integrations?limit=20",
    "next": "https://api.sb/leaseline.app/integrations?after=integration_alVwjQcmRy"
  }
}

Integration.update

Changes the given properties of an Integration. Verb page.

Text
PATCH /{namespace}/integrations/{id}

Path: id. Body, as JSON: the other inputs. Emits Integration.updated.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Integration.
acquiredstringOne of owned, wrapped, or recruited.
termstextThe terms the Startup holds the right to use and resell it under.
scopestringOne of studio, startup, or customer.
syncstringWhich side leads a sync connector: platform or provider.
modestringHow records move: mirror writes db.sb out to the outside tool; import turns edits there into Changes. db.sb is the record in both.
venuestringThe id of the ad, social or app-store venue the account is on, when it is on one.
accountstringThe outside account’s own id, such as an ad account, a workspace or a repository.
grantsstring[]The outside permissions the account holder approved: the narrowest set its Verbs need.
connectedByPartyWho approved the connection; a Human’s own account is used only under that Human’s Mandate.
environmentstringA test Integration reaches only the upstream’s test account, as a Stripe test account does.
expiresAtdatetimeWhen access lapses unless refreshed.
refreshedAtdatetimeWhen the platform last renewed the outside token.
lastErrorstringThe error slug of the last failed call or refresh, cleared by the next success.
cursorstringWhere the last sync run stopped, so the next run reads only what changed.

Returns

OutputTypeRequiredDescription
integrationIntegrationrequiredThe Integration.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
curl -X PATCH https://api.sb/leaseline.app/integrations/integration_alVwjQcmRy \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"scope":"studio"}'
JSON
{
  "api": "https://api.sb/leaseline.app",
  "integration": {
    "$id": "https://api.sb/leaseline.app/integrations/integration_alVwjQcmRy",
    "$type": "Integration",
    "acquired": "owned",
    "scope": "studio",
    "mode": "mirror",
    "state": "connecting"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Integration.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}

Integration.delete

Deletes an Integration: a soft delete that keeps its history, undone by Thing.restore. Verb page.

Text
DELETE /{namespace}/integrations/{id}

Path: id. Emits Integration.deleted.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Integration.

Returns

OutputTypeRequiredDescription
integrationIntegrationrequiredThe Integration.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
curl -X DELETE https://api.sb/leaseline.app/integrations/integration_alVwjQcmRy \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
JSON
{
  "api": "https://api.sb/leaseline.app",
  "integration": {
    "$id": "https://api.sb/leaseline.app/integrations/integration_alVwjQcmRy",
    "$type": "Integration",
    "acquired": "owned",
    "scope": "studio",
    "mode": "mirror",
    "state": "connecting"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Integration.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}