Official SDKs for interacting with the SyftHub API.
| SDK | Language | Directory | Status |
|---|---|---|---|
| Python SDK | Python 3.10+ | sdk/python/ |
Stable |
| TypeScript SDK | TypeScript/Node.js 18+ | sdk/typescript/ |
Stable |
Python:
pip install syfthub-sdk
# or
uv add syfthub-sdkTypeScript:
npm install @syfthub/sdk
# or
yarn add @syfthub/sdkPython:
from syfthub_sdk import SyftHubClient
client = SyftHubClient(base_url="https://hub.syft.com")
user = await client.auth.login("alice", "password")
for endpoint in client.hub.browse():
print(endpoint.name)TypeScript:
import { SyftHubClient } from '@syfthub/sdk';
const client = new SyftHubClient({ baseUrl: 'https://hub.syft.com' });
const user = await client.auth.login('alice', 'password');
for await (const endpoint of client.hub.browse()) {
console.log(endpoint.name);
}Both SDKs provide the same functionality with identical APIs (adjusted for language conventions):
| Feature | Python | TypeScript |
|---|---|---|
| Auth | client.auth.* |
client.auth.* |
| My Endpoints | client.my_endpoints.* |
client.myEndpoints.* |
| Hub | client.hub.* |
client.hub.* |
| Users | client.users.* |
client.users.* |
| Accounting | client.accounting.* |
client.accounting.* |
| Python (snake_case) | TypeScript (camelCase) |
|---|---|
my_endpoints |
myEndpoints |
full_name |
fullName |
get_tokens() |
getTokens() |
is_authenticated |
isAuthenticated |
Python:
for endpoint in client.hub.browse():
print(endpoint.name)TypeScript:
for await (const endpoint of client.hub.browse()) {
console.log(endpoint.name);
}Both SDKs support the same environment variables:
| Variable | Description |
|---|---|
SYFTHUB_URL |
SyftHub API base URL |
SYFTHUB_ACCOUNTING_URL |
Accounting service URL (optional) |
SYFTHUB_ACCOUNTING_EMAIL |
Accounting auth email (optional) |
SYFTHUB_ACCOUNTING_PASSWORD |
Accounting auth password (optional) |
cd sdk/python
uv sync
uv run pytestcd sdk/typescript
npm install
npm run build
npm testMIT