Secryn Python SDK — manage secrets, projects, and API keys programmatically
Project description
Secryn Python SDK
Python client for the Secryn secrets management API.
Manage projects, secrets, API keys, and team members programmatically.
Installation
pip install secryn
Requires Python 3.10+.
Quick Start
from secryn import SecrynClient
# Connect to your Secryn instance
client = SecrynClient(base_url="https://api.secryn.xyz/api/v1")
# Cookie-based auth
client.auth.login("user@example.com", "password")
# OR API-key-based auth
client = SecrynClient(
base_url="https://api.secryn.xyz/api/v1",
api_key="sc_...",
)
Usage
All API resources are accessible as namespaced sub-objects with full autocompletion support.
Auth
client.auth.login("user@example.com", "password")
client.auth.register("new@example.com", "secure123")
client.auth.logout() # clears session cookies
client.auth.refresh() # extends JWT session
client.auth.forgot_password("user@example.com")
client.auth.reset_password(token, "new-password")
MFA
setup = client.mfa.setup() # returns secret + QR code URL
client.mfa.enable(token)
client.mfa.confirm(token, mfa_token)
client.mfa.recovery(code, mfa_token)
client.mfa.status() # -> {"enabled": True}
codes = client.mfa.recovery_codes() # -> {"codes": ["...", ...]}
client.mfa.send_backup_code("user@example.com")
client.mfa.disable()
Projects
projects = client.projects.list()
project = client.projects.create("My Project", description="Backend secrets")
info = client.projects.get(project_id)
client.projects.update(project_id, name="Renamed")
client.projects.transfer(project_id, new_owner_id)
client.projects.delete(project_id)
Members & Invites
# Invite someone to a project
client.invites.create(project_id, email="dev@team.com")
# Accept an invitation by slug
client.invites.accept("abc123")
# Manage members
client.members.add_permissions(project_id, member_id, ["READ_SECRETS"])
client.members.remove_permissions(project_id, member_id, ["READ_SECRETS"])
client.members.remove(project_id, member_id)
Secrets
# Create, read, update, delete
secret = client.secrets.create(project_id, "API_KEY", "sk-abc123", notes="Production key")
secret = client.secrets.get(secret_id)
secrets = client.secrets.list(project_id)
client.secrets.update(secret_id, value="sk-new-value")
# Export as .env
dotenv = client.secrets.export_dotenv(project_id) # str
with open(".env", "w") as f:
f.write(dotenv)
client.secrets.delete(secret_id)
API Keys
key = client.api_keys.create("CI/CD Pipeline", permissions=["read"])
keys = client.api_keys.list()
client.api_keys.update(key_id, name="CI Pipeline v2")
client.api_keys.delete(key_id)
Users
profile = client.users.me() # authenticated user
user = client.users.get(user_id)
client.users.update(name="New Name", email="new@example.com")
client.users.delete() # deletes authenticated account
Error Handling
from secryn import SecrynApiError
try:
client.secrets.get("nonexistent")
except SecrynApiError as e:
print(e.status_code) # 404
print(e.code) # "NOT_FOUND"
print(e.message) # "Secret not found"
print(e.details) # Optional structured context
Configuration
| Param | Default | Description |
|---|---|---|
base_url |
http://localhost:3000/api/v1 |
API base URL with /api/v1 prefix |
api_key |
None |
Optional API key for programmatic access |
user_agent |
secryn-sdk-python/1.0.0 |
Custom User-Agent header |
License
Apache 2.0 — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file secryn-1.0.1.tar.gz.
File metadata
- Download URL: secryn-1.0.1.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53572062d97b23c99a89c44af83961a4cceb7b3a16f193d688fdd8c8d07985bc
|
|
| MD5 |
1e48235d47a642db3cc4e0a5b7d94017
|
|
| BLAKE2b-256 |
088f6cc5fb267c4637c1836bf451c3d32f2de2cb01cd994c89ac40fe0494ed39
|
Provenance
The following attestation bundles were made for secryn-1.0.1.tar.gz:
Publisher:
publish-sdk-py.yaml on P4ciuf/secryn
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
secryn-1.0.1.tar.gz -
Subject digest:
53572062d97b23c99a89c44af83961a4cceb7b3a16f193d688fdd8c8d07985bc - Sigstore transparency entry: 1793609349
- Sigstore integration time:
-
Permalink:
P4ciuf/secryn@7945499eb0d54abf6d664c0c6fc9349018a6e456 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/P4ciuf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdk-py.yaml@7945499eb0d54abf6d664c0c6fc9349018a6e456 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file secryn-1.0.1-py3-none-any.whl.
File metadata
- Download URL: secryn-1.0.1-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39537f35c3738837ff29d12cb5a6cf44d8d89efc146da06bf605a7e9d0f8ada8
|
|
| MD5 |
b706f46c057f7d330979dd059cded89e
|
|
| BLAKE2b-256 |
8e8b8c891b6e90fddb6da608e7714522e20a74ef77699ec03690f953d4ac34ec
|
Provenance
The following attestation bundles were made for secryn-1.0.1-py3-none-any.whl:
Publisher:
publish-sdk-py.yaml on P4ciuf/secryn
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
secryn-1.0.1-py3-none-any.whl -
Subject digest:
39537f35c3738837ff29d12cb5a6cf44d8d89efc146da06bf605a7e9d0f8ada8 - Sigstore transparency entry: 1793609512
- Sigstore integration time:
-
Permalink:
P4ciuf/secryn@7945499eb0d54abf6d664c0c6fc9349018a6e456 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/P4ciuf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdk-py.yaml@7945499eb0d54abf6d664c0c6fc9349018a6e456 -
Trigger Event:
workflow_dispatch
-
Statement type: