MemorySync
API Reference

Connector Insights

Aggregate counts across every connection, and the organization-wide audit trail of connector activity.

Operations on this page

OperationMethod and pathPythonNode.js
Connector statisticsGET /api/v2/integrations/statsconnections.statsconnections.stats
Connector audit logGET /api/v2/integrations/audit-logsconnections.audit_logsconnections.auditLogs

Authentication and scope

RequirementContract
CredentialAn API key sent as X-API-Key. Connector operations are not end-user scoped.
Read scopeintegrations:read for every GET.
Write scopeintegrations:write for every POST, PUT, PATCH and DELETE.
TenantDerived from the authenticated key. There is no tenant parameter to pass or to get wrong.
X-End-User-IDNot used. A connection belongs to the organization, not to one end user.

1. Read the counts

Aggregates across every connection in the organization: how many connections exist, how many objects they hold, how many memories came out, and when each last synced.

import os
from memorysync import MemorySyncClient
client = MemorySyncClient(
api_key=os.environ["MEMORYSYNC_API_KEY"],
base_url="https://api.memorysync.io",
)
stats = client.connections.stats()
print(stats["total_connections"], stats["connected"], stats["syncing"], stats["errors"])
print(stats["total_objects"], "objects; last sync", stats["last_sync_at"])
print(stats["enabled_providers"], "of", stats["total_providers"], "providers enabled")
GET/api/v2/integrations/stats
200 OK
FieldMeaning
total_providers, enabled_providersThe provider catalog and how much of it is turned on.
total_connections, connected, syncing, errorsConnection counts by state. errors is the one to alert on.
total_objectsObjects held across every connection.
last_sync_atThe most recent sync anywhere in the organization. Nullable.

2. Read the audit trail

Connector activity across the organization: connections created and removed, credentials replaced, purges run, configuration changed. This is the record an access review asks for.

import os
from memorysync import MemorySyncClient
client = MemorySyncClient(
api_key=os.environ["MEMORYSYNC_API_KEY"],
base_url="https://api.memorysync.io",
)
# A bare JSON array, not an object with an entries key.
for entry in client.connections.audit_logs(limit=100):
print(entry["created_at"], entry["event_type"], entry["user_email"], entry["details"])
GET/api/v2/integrations/audit-logs
200 OK
ParameterTypeContract
connection_idintegerOptional; narrow to one connection.
event_typestringOptional; narrow to one event type. The parameter is event_type, not action.
limitintegerOptional. Defaults to 50, capped at 200.
offsetintegerOptional page offset.
FieldMeaning
idThe entry id.
event_type, event_categoryWhat happened, and its grouping.
provider_idWhich provider it concerned. Nullable.
detailsAn object whose shape depends on the event type.
user_emailWho did it, where a user was responsible. Nullable for system activity.
created_atWhen.

Reading these safely

  • Do not use stats as a billing source. Use the billing API for usage against a plan.
  • On a 5xx, show the previous value rather than zero. Zero and unavailable look identical in a chart and mean opposite things.
  • The audit log is append-only and scoped to the organization. It is not a per-object trail — for that use object audit.

Errors and next action

StatusMeaningNext action
401Missing, malformed or inactive API key.Check server configuration without printing the key.
403The key lacks integrations:read or integrations:write.Grant the scope on the key, or use a key that has it.
404The connection, object or job is not visible to this tenant.Confirm the identifier belongs to this organization.
409The connection is in a state that forbids the operation.Read the connection status first and act on it.
429Rate limited, either by MemorySync or by the upstream provider.Back off; do not tighten a polling loop in response.
5xxService failure.Treat a write outcome as uncertain and reconcile by reading the connection back.