Skip to content

Custom Sources API

Custom sources are directories in CUSTOM_SOURCES_DIR, each with a source.py. The API identifies them by directory name. All paths are relative to /api.

MethodPathDescription
GET/connectors/custom-sourcesList custom sources (Connectors API)
GET/custom-sources/{name}/codeGet source.py
GET/custom-sources/{name}/config-schemaGet the source’s config fields
POST/custom-sources/{name}/testTest a connection
POST/custom-sources/uploadUpload a .py or .zip
DELETE/custom-sources/{name}Delete a source
GET/custom-sources/git-sync/statusGit sync settings
POST/custom-sources/git-syncSync from Git now
POST/custom-sources/git-sync/webhookGitHub or GitLab push webhook

GET /custom-sources/{name}/code

{
"name": "jsonplaceholder",
"code": "from bizon.source.source import AbstractSource\n...",
"file_path": "/custom_sources/jsonplaceholder/source.py"
}

GET /custom-sources/{name}/config-schema returns the fields of the source’s config class. The base SourceConfig fields (name, stream, source_file_path, authentication, sync_mode, cursor_field) are left out.

{
"source_name": "buildbetter",
"fields": [
{
"name": "api_key",
"type": "string",
"required": true,
"default": null,
"description": null,
"is_secret": true
}
]
}

type is string, integer, number or boolean. is_secret is true when the field name contains key, secret, password, token, credential or auth. The UI uses it to mask the input.

POST /custom-sources/{name}/test

{
"stream": "posts",
"config": { "api_key": "..." }
}

The API builds the config class from name, stream, source_file_path and the config values, then calls check_connection(). It times out after 30 seconds.

{ "success": true, "message": "Connection successful" }

An unknown source returns 404. Other failures return 200 with success: false.

POST /custom-sources/upload takes a multipart file field.

Terminal window
curl -X POST http://localhost:8000/api/custom-sources/upload \
-F "file=@my_api.py"
  • .py: saved as <name>/source.py. The name is the file name, lowercased, with - replaced by _.
  • .zip: must contain a source.py. The name comes from its top-level folder, or else the zip’s file name. Only source.py is extracted.

The API then imports the file, looks for an AbstractSource subclass and calls streams(). If that fails, the upload is removed and you get 400.

{
"name": "my_api",
"file_path": "/custom_sources/my_api/source.py",
"streams": ["users", "orders"],
"message": "Successfully uploaded source 'my_api'"
}

A source with the same name returns 400. Delete it first to replace it.

DELETE /custom-sources/{name} removes the whole directory.

{ "message": "Successfully deleted source 'my_api'" }

See Git sync for setup.

{
"enabled": true,
"repo_url": "https://github.com/acme/bizon-sources.git",
"branch": "main",
"path": "custom_sources",
"webhook_configured": true
}

repo_url is null when sync is disabled. webhook_configured is true when GIT_SYNC_WEBHOOK_SECRET is set.

Runs a sync and waits for it to finish. It returns 400 if sync is disabled or has no repository URL.

{
"success": true,
"message": "Synced 3 source(s) from main@1a2b3c4d",
"commit_hash": "1a2b3c4d",
"files_updated": 3,
"synced_at": "2026-10-02T10:00:00.123456"
}

Receives push events. It requires GIT_SYNC_ENABLED and GIT_SYNC_WEBHOOK_SECRET, or it returns 400.

ProviderDetected byVerified with
GitHubX-Hub-Signature-256 or X-GitHub-EventHMAC-SHA256 of the body
GitLabX-Gitlab-Token or X-Gitlab-EventToken equals the secret

A bad signature returns 401. A push to the configured branch starts a sync in the background:

{ "status": "sync_triggered", "message": "Sync triggered for branch 'main'" }

Pushes to other branches return "status": "skipped".