Get Account Settings
Retrieve all account settings and preferences.Copy
curl -X GET "https://api.tensorone.ai/v2/accounts/settings" \
-H "Authorization: Bearer YOUR_API_KEY"
Response
Copy
{
"notifications": {
"email": {
"enabled": true,
"alerts": {
"cost_alerts": true,
"usage_warnings": true,
"security_notifications": true,
"system_updates": false,
"marketing_emails": false
},
"frequency": "immediate",
"email": "user@example.com"
},
"slack": {
"enabled": true,
"webhook_url": "https://hooks.slack.com/services/...",
"channel": "#tensorone-alerts",
"alerts": {
"endpoint_failures": true,
"cost_thresholds": true,
"cluster_events": true
}
},
"webhook": {
"enabled": false,
"url": null,
"events": [],
"secret": null
}
},
"billing": {
"currency": "USD",
"timezone": "America/Los_Angeles",
"payment_method": {
"type": "credit_card",
"last_four": "4242",
"expires": "12/25",
"brand": "visa"
},
"billing_address": {
"name": "John Doe",
"company": "TechCorp Inc",
"address": "123 Tech Street",
"city": "San Francisco",
"state": "CA",
"zip": "94105",
"country": "US"
},
"auto_recharge": {
"enabled": true,
"threshold": 50.0,
"amount": 200.0
},
"cost_alerts": [
{
"threshold": 500.0,
"period": "monthly",
"enabled": true
}
]
},
"security": {
"two_factor": {
"enabled": true,
"method": "totp",
"backup_codes": 8
},
"api_access": {
"ip_whitelist": ["203.0.113.0/24", "198.51.100.50"],
"require_ip_whitelist": false,
"max_api_keys": 20
},
"session": {
"timeout": 24,
"require_reauth_for_sensitive": true,
"concurrent_sessions": 3
},
"audit": {
"log_api_requests": true,
"log_resource_access": true,
"retention_days": 90
}
},
"integrations": {
"github": {
"enabled": true,
"username": "johndoe",
"repositories": ["johndoe/ml-models", "company/ai-research"]
},
"docker": {
"enabled": true,
"registries": [
{
"url": "registry.hub.docker.com",
"username": "johndoe"
}
]
},
"monitoring": {
"datadog": {
"enabled": false,
"api_key": null
},
"grafana": {
"enabled": true,
"url": "https://grafana.company.com",
"dashboard_id": "tensorone-metrics"
}
}
},
"preferences": {
"timezone": "America/Los_Angeles",
"language": "en",
"theme": "dark",
"date_format": "MM/DD/YYYY",
"number_format": "1,234.56",
"default_region": "us-west-2"
}
}
Update Notification Settings
Configure email, Slack, and webhook notifications.Copy
curl -X PUT "https://api.tensorone.ai/v2/accounts/settings/notifications" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": {
"enabled": true,
"alerts": {
"cost_alerts": true,
"usage_warnings": true,
"security_notifications": true,
"system_updates": false
},
"frequency": "daily_digest"
},
"slack": {
"enabled": true,
"webhook_url": "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX",
"channel": "#ai-alerts",
"alerts": {
"endpoint_failures": true,
"cost_thresholds": true,
"cluster_events": false
}
}
}'
Request Schema
Copy
{
"email": {
"enabled": "boolean (optional)",
"alerts": {
"cost_alerts": "boolean (optional)",
"usage_warnings": "boolean (optional)",
"security_notifications": "boolean (optional)",
"system_updates": "boolean (optional)",
"marketing_emails": "boolean (optional)"
},
"frequency": "string (optional, 'immediate', 'daily_digest', 'weekly_digest')"
},
"slack": {
"enabled": "boolean (optional)",
"webhook_url": "string (optional, valid Slack webhook URL)",
"channel": "string (optional, Slack channel name)",
"alerts": {
"endpoint_failures": "boolean (optional)",
"cost_thresholds": "boolean (optional)",
"cluster_events": "boolean (optional)"
}
},
"webhook": {
"enabled": "boolean (optional)",
"url": "string (optional, webhook URL)",
"events": "array (optional, event types to send)",
"secret": "string (optional, webhook secret for verification)"
}
}
Update Billing Settings
Configure billing preferences, payment methods, and cost alerts.Copy
curl -X PUT "https://api.tensorone.ai/v2/accounts/settings/billing" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"currency": "EUR",
"timezone": "Europe/London",
"auto_recharge": {
"enabled": true,
"threshold": 75.00,
"amount": 300.00
},
"cost_alerts": [
{
"threshold": 250.00,
"period": "weekly",
"enabled": true
},
{
"threshold": 1000.00,
"period": "monthly",
"enabled": true
}
]
}'
Request Schema
Copy
{
"currency": "string (optional, 'USD', 'EUR', 'GBP', 'JPY')",
"timezone": "string (optional, IANA timezone)",
"billing_address": {
"name": "string (optional)",
"company": "string (optional)",
"address": "string (optional)",
"city": "string (optional)",
"state": "string (optional)",
"zip": "string (optional)",
"country": "string (optional, ISO 3166-1 alpha-2)"
},
"auto_recharge": {
"enabled": "boolean (optional)",
"threshold": "number (optional, minimum balance)",
"amount": "number (optional, recharge amount)"
},
"cost_alerts": [
{
"threshold": "number (required, alert threshold)",
"period": "string (required, 'daily', 'weekly', 'monthly')",
"enabled": "boolean (optional, default: true)"
}
]
}
Update Security Settings
Configure two-factor authentication, IP restrictions, and audit settings.Copy
curl -X PUT "https://api.tensorone.ai/v2/accounts/settings/security" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"two_factor": {
"enabled": true,
"method": "totp"
},
"api_access": {
"ip_whitelist": ["203.0.113.0/24", "198.51.100.0/24"],
"require_ip_whitelist": true,
"max_api_keys": 15
},
"session": {
"timeout": 8,
"require_reauth_for_sensitive": true,
"concurrent_sessions": 2
}
}'
Request Schema
Copy
{
"two_factor": {
"enabled": "boolean (optional)",
"method": "string (optional, 'totp', 'sms')"
},
"api_access": {
"ip_whitelist": "array (optional, IP addresses/CIDR blocks)",
"require_ip_whitelist": "boolean (optional)",
"max_api_keys": "number (optional, 1-50)"
},
"session": {
"timeout": "number (optional, hours, 1-168)",
"require_reauth_for_sensitive": "boolean (optional)",
"concurrent_sessions": "number (optional, 1-10)"
},
"audit": {
"log_api_requests": "boolean (optional)",
"log_resource_access": "boolean (optional)",
"retention_days": "number (optional, 30-365)"
}
}
Configure Integrations
Set up and manage third-party service integrations.Copy
curl -X PUT "https://api.tensorone.ai/v2/accounts/settings/integrations" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"github": {
"enabled": true,
"access_token": "ghp_xxxxxxxxxxxxxxxxxxxx",
"repositories": ["user/ml-models", "user/ai-research"]
},
"docker": {
"enabled": true,
"registries": [
{
"url": "registry.hub.docker.com",
"username": "dockeruser",
"access_token": "dckr_pat_xxxxxxxxxxxx"
}
]
}
}'
Available Integrations
- GitHub: Repository access for model versioning
- Docker: Container registry authentication
- Slack: Team notifications and alerts
- DataDog: Monitoring and metrics
- Grafana: Custom dashboards
- Webhook: Custom event notifications
Update User Preferences
Configure display preferences, localization, and default settings.Copy
curl -X PUT "https://api.tensorone.ai/v2/accounts/settings/preferences" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"timezone": "Asia/Tokyo",
"language": "ja",
"theme": "light",
"date_format": "YYYY/MM/DD",
"number_format": "1.234,56",
"default_region": "ap-northeast-1"
}'
Request Schema
Copy
{
"timezone": "string (optional, IANA timezone)",
"language": "string (optional, 'en', 'es', 'fr', 'de', 'ja', 'zh')",
"theme": "string (optional, 'light', 'dark', 'auto')",
"date_format": "string (optional, 'MM/DD/YYYY', 'DD/MM/YYYY', 'YYYY/MM/DD')",
"number_format": "string (optional, '1,234.56', '1.234,56', '1 234,56')",
"default_region": "string (optional, AWS region code)"
}
Test Notification Settings
Test notification configurations before saving.Copy
curl -X POST "https://api.tensorone.ai/v2/accounts/settings/notifications/test" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "slack",
"webhook_url": "https://hooks.slack.com/services/...",
"channel": "#test-channel"
}'
Response
Copy
{
"test": {
"type": "slack",
"status": "success",
"message": "Test notification sent successfully",
"timestamp": "2024-03-20T16:30:00Z",
"response": {
"slack_response": "ok"
}
}
}
Export Settings
Export account settings for backup or migration.Copy
curl -X GET "https://api.tensorone.ai/v2/accounts/settings/export" \
-H "Authorization: Bearer YOUR_API_KEY" \
-G -d "format=json" -d "include_secrets=false"
Query Parameters
format
: Export format (json
,yaml
)include_secrets
: Include encrypted secrets (true
,false
)sections
: Specific sections to export (comma-separated)
Response
Copy
{
"export": {
"timestamp": "2024-03-20T16:30:00Z",
"format": "json",
"include_secrets": false,
"settings": {
"notifications": {...},
"billing": {...},
"security": {...},
"integrations": {...},
"preferences": {...}
},
"metadata": {
"version": "2.0",
"account_id": "acc_1234567890abcdef",
"exported_by": "usr_1234567890abcdef"
}
}
}
Import Settings
Import settings from a backup or template.Copy
curl -X POST "https://api.tensorone.ai/v2/accounts/settings/import" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"settings": {
"notifications": {...},
"preferences": {...}
},
"merge_strategy": "overwrite",
"validate_only": false
}'
Code Examples
Python SDK
Copy
from tensorone import TensorOneAPI
client = TensorOneAPI(api_key="your_api_key")
# Get all settings
settings = client.accounts.settings.get()
print(f"Current theme: {settings.preferences.theme}")
print(f"Email notifications: {settings.notifications.email.enabled}")
# Update notification settings
notifications = client.accounts.settings.update_notifications(
email={
"enabled": True,
"alerts": {
"cost_alerts": True,
"usage_warnings": True,
"security_notifications": True
},
"frequency": "daily_digest"
},
slack={
"enabled": True,
"webhook_url": "https://hooks.slack.com/services/...",
"channel": "#tensorone-alerts",
"alerts": {
"endpoint_failures": True,
"cost_thresholds": True
}
}
)
# Configure billing settings
billing = client.accounts.settings.update_billing(
currency="USD",
auto_recharge={
"enabled": True,
"threshold": 100.00,
"amount": 500.00
},
cost_alerts=[
{"threshold": 250.00, "period": "weekly", "enabled": True},
{"threshold": 1000.00, "period": "monthly", "enabled": True}
]
)
# Update security settings
security = client.accounts.settings.update_security(
two_factor={"enabled": True, "method": "totp"},
api_access={
"ip_whitelist": ["203.0.113.0/24"],
"require_ip_whitelist": True,
"max_api_keys": 10
},
session={
"timeout": 8,
"require_reauth_for_sensitive": True
}
)
# Configure integrations
integrations = client.accounts.settings.update_integrations(
github={
"enabled": True,
"access_token": "ghp_xxxxxxxxxxxxxxxxxxxx",
"repositories": ["user/ml-models"]
},
docker={
"enabled": True,
"registries": [{
"url": "registry.hub.docker.com",
"username": "dockeruser",
"access_token": "dckr_pat_xxxxxxxxxxxx"
}]
}
)
# Update preferences
preferences = client.accounts.settings.update_preferences(
timezone="America/New_York",
theme="dark",
language="en",
default_region="us-east-1"
)
# Test Slack notification
test_result = client.accounts.settings.test_notification(
type="slack",
webhook_url="https://hooks.slack.com/services/...",
channel="#test"
)
print(f"Test result: {test_result.status}")
# Export settings for backup
backup = client.accounts.settings.export(
format="json",
include_secrets=False
)
with open("settings_backup.json", "w") as f:
json.dump(backup.settings, f, indent=2)
JavaScript SDK
Copy
import { TensorOneAPI } from "@tensorone/sdk";
const client = new TensorOneAPI("your_api_key");
// Get current settings
const settings = await client.accounts.settings.get();
console.log(`Current theme: ${settings.preferences.theme}`);
// Update notifications
const notifications = await client.accounts.settings.updateNotifications({
email: {
enabled: true,
alerts: {
costAlerts: true,
usageWarnings: true,
securityNotifications: true,
},
frequency: "immediate",
},
webhook: {
enabled: true,
url: "https://api.myapp.com/tensorone-webhook",
events: ["endpoint.failed", "cost.threshold_exceeded"],
secret: "webhook_secret_key",
},
});
// Configure billing
const billing = await client.accounts.settings.updateBilling({
currency: "EUR",
timezone: "Europe/Berlin",
autoRecharge: {
enabled: true,
threshold: 50.0,
amount: 200.0,
},
costAlerts: [{ threshold: 500.0, period: "monthly", enabled: true }],
});
// Update security settings
const security = await client.accounts.settings.updateSecurity({
twoFactor: { enabled: true, method: "totp" },
apiAccess: {
ipWhitelist: ["192.168.1.0/24", "10.0.0.0/8"],
requireIpWhitelist: false,
maxApiKeys: 20,
},
audit: {
logApiRequests: true,
logResourceAccess: true,
retentionDays: 90,
},
});
// Set up integrations
const integrations = await client.accounts.settings.updateIntegrations({
github: {
enabled: true,
accessToken: "ghp_xxxxxxxxxxxxxxxxxxxx",
repositories: ["org/ml-models", "org/ai-apps"],
},
monitoring: {
datadog: {
enabled: true,
apiKey: "dd_api_key_xxxxxxxxxxxx",
},
},
});
// Update user preferences
const preferences = await client.accounts.settings.updatePreferences({
timezone: "Pacific/Auckland",
language: "en",
theme: "auto",
dateFormat: "DD/MM/YYYY",
defaultRegion: "ap-southeast-2",
});
// Test webhook
const webhookTest = await client.accounts.settings.testNotification({
type: "webhook",
url: "https://api.myapp.com/test-webhook",
secret: "test_secret",
});
console.log(`Webhook test: ${webhookTest.status}`);
// Export settings
const backup = await client.accounts.settings.export({
format: "json",
includeSecrets: false,
sections: ["notifications", "preferences"],
});
console.log("Settings exported:", backup.timestamp);
Error Responses
400 Bad Request
Copy
{
"error": "INVALID_WEBHOOK_URL",
"message": "Webhook URL is not valid or unreachable",
"details": {
"url": "https://invalid-webhook.com/endpoint",
"reason": "Connection timeout"
}
}
402 Payment Required
Copy
{
"error": "PAYMENT_METHOD_REQUIRED",
"message": "Valid payment method required for auto-recharge",
"details": {
"feature": "auto_recharge",
"action": "add_payment_method"
}
}
403 Forbidden
Copy
{
"error": "INSUFFICIENT_PERMISSIONS",
"message": "Billing settings require admin role",
"details": {
"requiredRole": "admin",
"currentRole": "developer"
}
}
422 Unprocessable Entity
Copy
{
"error": "INVALID_IP_WHITELIST",
"message": "IP whitelist contains invalid CIDR blocks",
"details": {
"invalidEntries": ["192.168.1.256/24", "invalid-ip"],
"validFormat": "IPv4 address or CIDR block (e.g., 192.168.1.0/24)"
}
}
Best Practices
Notification Management
- Enable security notifications for all critical events
- Use digest frequencies to avoid notification fatigue
- Test notification channels before relying on them
- Set up multiple notification channels for redundancy
Billing Configuration
- Set conservative cost alerts to avoid surprises
- Use auto-recharge with reasonable thresholds
- Keep billing address information current
- Monitor cost trends and adjust alerts accordingly
Security Settings
- Always enable two-factor authentication
- Use IP whitelisting for highly sensitive accounts
- Set appropriate session timeouts for your organization
- Regularly review audit logs for suspicious activity
Integration Management
- Use dedicated service accounts for integrations
- Rotate integration tokens regularly
- Monitor integration usage and errors
- Document integration configurations for team knowledge
Use Cases
Team Setup and Standardization
Copy
def setup_team_standards():
# Standard notification settings for all team members
standard_notifications = {
"email": {
"enabled": True,
"alerts": {
"cost_alerts": True,
"usage_warnings": True,
"security_notifications": True,
"system_updates": False,
"marketing_emails": False
},
"frequency": "daily_digest"
},
"slack": {
"enabled": True,
"webhook_url": os.getenv("TEAM_SLACK_WEBHOOK"),
"channel": "#tensorone-alerts",
"alerts": {
"endpoint_failures": True,
"cost_thresholds": True,
"cluster_events": True
}
}
}
# Apply to all team members
client.accounts.settings.update_notifications(**standard_notifications)
Security Hardening
Copy
def harden_account_security():
# Enable strict security settings
security_config = {
"two_factor": {"enabled": True, "method": "totp"},
"api_access": {
"ip_whitelist": ["203.0.113.0/24"], # Office network only
"require_ip_whitelist": True,
"max_api_keys": 5
},
"session": {
"timeout": 4, # 4 hour timeout
"require_reauth_for_sensitive": True,
"concurrent_sessions": 1
},
"audit": {
"log_api_requests": True,
"log_resource_access": True,
"retention_days": 365 # Full year retention
}
}
client.accounts.settings.update_security(**security_config)
Cost Management Setup
Copy
def setup_cost_management():
# Progressive cost alerts
cost_alerts = [
{"threshold": 100.00, "period": "weekly", "enabled": True},
{"threshold": 400.00, "period": "monthly", "enabled": True},
{"threshold": 1000.00, "period": "monthly", "enabled": True}
]
billing_config = {
"auto_recharge": {
"enabled": True,
"threshold": 50.00,
"amount": 200.00
},
"cost_alerts": cost_alerts
}
client.accounts.settings.update_billing(**billing_config)
# Set up webhook for real-time cost monitoring
client.accounts.settings.update_notifications(
webhook={
"enabled": True,
"url": "https://cost-monitor.company.com/webhook",
"events": ["cost.threshold_exceeded", "cost.budget_warning"],
"secret": os.getenv("WEBHOOK_SECRET")
}
)
Multi-Environment Configuration
Copy
def configure_for_environment(environment):
if environment == "production":
# Production settings: strict security, detailed monitoring
client.accounts.settings.update_security(
two_factor={"enabled": True},
api_access={"require_ip_whitelist": True},
audit={"retention_days": 365}
)
client.accounts.settings.update_notifications(
email={"frequency": "immediate"},
slack={"alerts": {"endpoint_failures": True}}
)
elif environment == "development":
# Development settings: relaxed security, minimal notifications
client.accounts.settings.update_security(
api_access={"require_ip_whitelist": False},
session={"timeout": 24}
)
client.accounts.settings.update_notifications(
email={"frequency": "daily_digest"},
slack={"alerts": {"endpoint_failures": False}}
)
Authorizations
API key authentication. Use 'Bearer YOUR_API_KEY' format.
Body
application/json
Response
200 - application/json
Settings updated successfully
The response is of type object
.