Introduction
With SafetyKit, you can deploy AI agents to automate risk reviews, onboarding, and investigations. Trusted by leading marketplaces and fintech platforms.
Quickstart: Data API
Section titled “Quickstart: Data API”The Data API lets you ingest data into SafetyKit for processing and analysis. This is perfect for syncing your users, products, transactions, or any entity you want SafetyKit to understand.
from safetykit import Safetykit
# Initialize the client with your API keyclient = Safetykit(api_key="sk_your_api_key")
# Ingest users into the "users" namespaceresponse = client.data.ingest("users", { "data": [ { "id": "user_12345", "email": "alice@example.com", "username": "alice_wonderland", "profile_image": "https://example.com/alice.jpg", "bio": "Just a curious person exploring the world!", "created_at": "2024-01-15T10:30:00Z" } ], "schema": { "profile_image": {"content_type": "image_url"} }})
print(f"✓ Data accepted: {response.request_id}")import Safetykit from "safetykit";
// Initialize the client with your API keyconst client = new Safetykit({ apiKey: "sk_your_api_key",});
// Ingest users into the "users" namespaceconst response = await client.data.ingest("users", { data: [ { id: "user_12345", email: "alice@example.com", username: "alice_wonderland", profile_image: "https://example.com/alice.jpg", bio: "Just a curious person exploring the world!", created_at: "2024-01-15T10:30:00Z", }, ], schema: { profile_image: { content_type: "image_url" }, },});
console.log(`✓ Data accepted: ${response.requestId}`);curl -X POST https://api.safetykit.com/v1/data/users \ -H "Authorization: Bearer sk_your_api_key" \ -H "Content-Type: application/json" \ -d '{ "data": [ { "id": "user_12345", "email": "alice@example.com", "username": "alice_wonderland", "profile_image": "https://example.com/alice.jpg", "bio": "Just a curious person exploring the world!", "created_at": "2024-01-15T10:30:00Z" } ], "schema": { "profile_image": {"content_type": "image_url"} } }'What happens next? SafetyKit processes your data asynchronously. You can set up webhooks to get notified when processing completes.
Quickstart: Decisions API
Section titled “Quickstart: Decisions API”The Decisions API enables real-time policy decisions. Submit content and get back a structured decision with labels and explanations, and a recommended action.
from safetykit import Safetykitimport json
# Initialize the clientclient = Safetykit(api_key="sk_your_api_key")
# Request a decision on a product listingdecision = client.decisions.create({ "type": "product_listing", "content": { "title": "Vintage Camera - Excellent Condition", "description": "Beautiful 1970s film camera, fully working.", "price": 150.00, "image_url": "https://example.com/camera.jpg", "seller_id": "user_12345" }, "metadata": { "marketplace": "main_store", "category": "electronics" }})
print(f"Decision ID: {decision.decision_id}")
# Poll for the result (or use webhooks for async notification)result = client.decisions.get(decision.decision_id)print(json.dumps(result, default=str))import Safetykit from "safetykit";
// Initialize the clientconst client = new Safetykit({ apiKey: "sk_your_api_key",});
// Request a decision on a product listingconst decision = await client.decisions.create({ type: "product_listing", content: { title: "Vintage Camera - Excellent Condition", description: "Beautiful 1970s film camera, fully working.", price: 150.0, image_url: "https://example.com/camera.jpg", seller_id: "user_12345", }, metadata: { marketplace: "main_store", category: "electronics", },});
console.log(`Decision ID: ${decision.decision_id}`);
// Poll for the result (or use webhooks for async notification)const result = await client.decisions.get(decision.decision_id);console.log(JSON.stringify(result));# Create a decision requestcurl -X POST https://api.safetykit.com/v1/decisions \ -H "Authorization: Bearer sk_your_api_key" \ -H "Content-Type: application/json" \ -d '{ "type": "product_listing", "content": { "title": "Vintage Camera - Excellent Condition", "description": "Beautiful 1970s film camera, fully working.", "price": 150.00, "image_url": "https://example.com/camera.jpg", "seller_id": "user_12345" }, "metadata": { "marketplace": "main_store", "category": "electronics" } }'
# Retrieve the decision resultcurl https://api.safetykit.com/v1/decisions/dec_xxxxx \ -H "Authorization: Bearer sk_your_api_key"Install the SDK
Section titled “Install the SDK”Our SDKs handle authentication, retries, and type safety out of the box. If you prefer, you can also use the API directly.
pip install safetykitnpm install safetykitNext steps
Section titled “Next steps”Need help?
Section titled “Need help?”We’re here for you! Contact us at support@safetykit.com.