Skip to Content
We are live but in Staging 🎉
API ReferenceSourceService API

SourceService API

Package: dodil.k3.source.v1

SourceService manages data sources and the credentials used to access them.

What It Is For

  • Create and manage source connectors in a bucket.
  • Store credentials (OAuth2, API keys, PAT, service account, access key).
  • Run OAuth authorization and token exchange flows.

Endpoint Map

Sources

gRPC methodHTTP route
CreateSourcePOST /:bucket/sources
ListSourcesGET /:bucket/sources
GetSourceGET /:bucket/sources/:source_id
UpdateSourcePATCH /:bucket/sources/:source_id
DeleteSourceDELETE /:bucket/sources/:source_id

Credentials

gRPC methodHTTP route
StoreCredentialPOST /admin/credentials
ListCredentialsGET /admin/credentials
GetCredentialGET /admin/credentials/:credential_id
DeleteCredentialDELETE /admin/credentials/:credential_id
ValidateCredentialPOST /admin/credentials/:credential_id/validate
RefreshOAuthTokenPOST /admin/credentials/:credential_id/refresh

OAuth

gRPC methodHTTP route
GetOAuthUrlPOST /admin/oauth/authorize
ExchangeOAuthCodePOST /admin/oauth/token

Key Arguments

Create source

FieldTypeRequiredPurpose
bucketstringyesBucket that owns the source
providerenumyesSource provider type
namestringyesUser-facing source name
descriptionstringnoDescription for operators
root_pathstringnoFolder/prefix to crawl
provider_accountstringnoProvider-specific account locator
sync_interval_secondsint64noAuto-sync cadence (0 manual only)
enabledboolnoSource active status

Supported providers include:

  • SOURCE_PROVIDER_INTERNAL_S3
  • SOURCE_PROVIDER_GOOGLE_DRIVE
  • SOURCE_PROVIDER_SHAREPOINT
  • SOURCE_PROVIDER_CONFLUENCE
  • SOURCE_PROVIDER_GITHUB

Store credential

FieldTypeRequiredPurpose
providerenumyesCredential provider
credential_typeenumyesOAuth2/API key/PAT/access key/service account
display_namestringyesHuman-readable identifier
source_idstringnoOptional source binding
is_primaryboolnoMark as primary credential
credential_dataoneofyesProvider-specific secret payload

OAuth requests

FieldTypeRequiredPurpose
providerenumyesOAuth provider
redirect_uristringnoCallback URI
scopesstring[]noRequested scopes
statestringnoCSRF correlation token

ExchangeOAuthCode adds:

  • code (required)
  • optional source_id
  • optional display_name

Examples

Create a Google Drive source

curl -sS -X POST "https://k3.dev.dodil.io/kb-prod/sources" \ -H "Authorization: Bearer $K3_TOKEN" \ -H "x-organization-id: $K3_ORG" \ -H "Content-Type: application/json" \ -d '{ "bucket": "kb-prod", "provider": "SOURCE_PROVIDER_GOOGLE_DRIVE", "name": "finance-drive", "root_path": "/Q2", "provider_account": "drive-id-123", "sync_interval_seconds": 3600, "enabled": true }'

Store an access-key credential

curl -sS -X POST "https://k3.dev.dodil.io/admin/credentials" \ -H "Authorization: Bearer $K3_TOKEN" \ -H "x-organization-id: $K3_ORG" \ -H "Content-Type: application/json" \ -d '{ "provider": "SOURCE_PROVIDER_INTERNAL_S3", "credential_type": "CREDENTIAL_TYPE_ACCESS_KEY", "display_name": "ceph-readwrite", "access_key": { "access_key_id": "AKIA...", "secret_access_key": "secret", "region": "us-east-1", "endpoint": "https://s3.internal" } }'

Start OAuth and exchange code

curl -sS -X POST "https://k3.dev.dodil.io/admin/oauth/authorize" \ -H "Authorization: Bearer $K3_TOKEN" \ -H "x-organization-id: $K3_ORG" \ -H "Content-Type: application/json" \ -d '{ "provider": "SOURCE_PROVIDER_GOOGLE_DRIVE", "redirect_uri": "https://app.example.com/k3/oauth/callback", "scopes": ["drive.readonly"], "state": "req-123" }' curl -sS -X POST "https://k3.dev.dodil.io/admin/oauth/token" \ -H "Authorization: Bearer $K3_TOKEN" \ -H "x-organization-id: $K3_ORG" \ -H "Content-Type: application/json" \ -d '{ "provider": "SOURCE_PROVIDER_GOOGLE_DRIVE", "code": "<oauth_code>", "redirect_uri": "https://app.example.com/k3/oauth/callback", "display_name": "gdrive-main" }'

Common Use Cases

  1. Onboard a new external repository and schedule periodic sync.
  2. Rotate or validate credentials without recreating the source.
  3. Build provider-specific onboarding UX around OAuth URL and token exchange.

Next: PipelineService