baton-sdk that connector developers use. The SDK follows an inversion-of-control pattern: you implement interfaces, the SDK calls your methods.
Connector builder interfaces
Connectorbuilder (entry point)
The main interface your connector must implement:ResourceSyncer (core sync)
The primary interface for syncing data:- V2 receives
SyncOpAttrswith session store for caching - V2 returns structured
SyncOpResultsinstead of raw values - V2 is preferred for new connectors
ResourceTargetedSyncer (single resource fetch)
Extension for fetching a single resource by ID:CAPABILITY_TARGETED_SYNC for faster incremental updates.
ResourceProvisioner (grant/revoke)
For connectors that can modify access:Grant() returns list of created grants, useful when one grant creates multiple assignments.
Enables CAPABILITY_PROVISION.
AccountManager (user provisioning)
For creating user accounts (JIT provisioning):*v2.CreateAccountResponse_SuccessResult- Account created successfully*v2.CreateAccountResponse_ActionRequiredResult- User action needed
CAPABILITY_ACCOUNT_PROVISIONING.
ResourceManager (create/delete resources)
For creating and deleting resources:CAPABILITY_RESOURCE_CREATE and CAPABILITY_RESOURCE_DELETE.
CredentialManager (credential rotation)
For rotating credentials:CAPABILITY_CREDENTIAL_ROTATION.
CustomActionManager (custom actions)
For connectors with custom operations:CAPABILITY_ACTIONS.
EventFeed (real-time events)
For streaming events from the target system:CAPABILITY_EVENT_FEED_V2.
Type builders
Resource builder
User trait options
| Status | Meaning |
|---|---|
STATUS_ENABLED | Active user |
STATUS_DISABLED | Suspended user |
STATUS_DELETED | Soft-deleted user |
STATUS_UNSPECIFIED | Unknown status |
| Type | Meaning |
|---|---|
ACCOUNT_TYPE_HUMAN | Human user |
ACCOUNT_TYPE_SERVICE | Service account |
ACCOUNT_TYPE_SYSTEM | System account |
Entitlement builder
Grant builder
Pagination
Token types
Pagination bag
For nested or multi-resource pagination:HTTP client utilities
Creating clients
Caching
Session store
For caching data across pagination calls:Capabilities matrix
Capabilities are automatically detected based on which interfaces you implement:| Capability | Interface required |
|---|---|
CAPABILITY_SYNC | ResourceSyncer |
CAPABILITY_TARGETED_SYNC | ResourceTargetedSyncer |
CAPABILITY_PROVISION | ResourceProvisioner or ResourceProvisionerV2 |
CAPABILITY_ACCOUNT_PROVISIONING | AccountManager |
CAPABILITY_RESOURCE_CREATE | ResourceManager |
CAPABILITY_RESOURCE_DELETE | ResourceManager, ResourceDeleter, or ResourceDeleterV2 |
CAPABILITY_CREDENTIAL_ROTATION | CredentialManager |
CAPABILITY_EVENT_FEED_V2 | EventFeed |
CAPABILITY_TICKETING | TicketManager (with WithTicketingEnabled option) |
CAPABILITY_ACTIONS | CustomActionManager |
Quick reference
Import paths
Common patterns
| Task | Functions |
|---|---|
| Create resource type | resource.NewResourceType(name, traits) |
| Create resource | resource.NewResource(name, type, id, opts...) |
| Add user trait | resource.WithUserTrait(resource.WithEmail(...)) |
| Create entitlement | entitlement.NewAssignmentEntitlement(resource, name) |
| Create grant | grant.NewGrant(resource, entitlement, principal) |
| Handle pagination | pagination.Bag{} with Marshal/Unmarshal |