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.
| Method | Path | Description |
|---|---|---|
GET | /connectors/custom-sources | List custom sources (Connectors API) |
GET | /custom-sources/{name}/code | Get source.py |
GET | /custom-sources/{name}/config-schema | Get the source’s config fields |
POST | /custom-sources/{name}/test | Test a connection |
POST | /custom-sources/upload | Upload a .py or .zip |
DELETE | /custom-sources/{name} | Delete a source |
GET | /custom-sources/git-sync/status | Git sync settings |
POST | /custom-sources/git-sync | Sync from Git now |
POST | /custom-sources/git-sync/webhook | GitHub or GitLab push webhook |
Get the code
Section titled “Get the code”GET /custom-sources/{name}/code
{ "name": "jsonplaceholder", "code": "from bizon.source.source import AbstractSource\n...", "file_path": "/custom_sources/jsonplaceholder/source.py"}Get the config schema
Section titled “Get the config schema”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.
Test a connection
Section titled “Test a connection”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.
Upload
Section titled “Upload”POST /custom-sources/upload takes a multipart file field.
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 asource.py. The name comes from its top-level folder, or else the zip’s file name. Onlysource.pyis 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
Section titled “Delete”DELETE /custom-sources/{name} removes the whole directory.
{ "message": "Successfully deleted source 'my_api'" }Git sync
Section titled “Git sync”See Git sync for setup.
GET /custom-sources/git-sync/status
Section titled “GET /custom-sources/git-sync/status”{ "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.
POST /custom-sources/git-sync
Section titled “POST /custom-sources/git-sync”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"}POST /custom-sources/git-sync/webhook
Section titled “POST /custom-sources/git-sync/webhook”Receives push events. It requires GIT_SYNC_ENABLED and GIT_SYNC_WEBHOOK_SECRET, or it returns 400.
| Provider | Detected by | Verified with |
|---|---|---|
| GitHub | X-Hub-Signature-256 or X-GitHub-Event | HMAC-SHA256 of the body |
| GitLab | X-Gitlab-Token or X-Gitlab-Event | Token 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".