SDKs
Shroud provides official client libraries for Python and TypeScript. Both wrap the REST API with typed helpers for common workflows like waiting for OTPs and destroying profiles.
Python SDK
Installation
pip install shroud-sdk
Requirements
- Python 3.9+
- No additional runtime dependencies
Basic usage
from shroud import Shroud
client = Shroud(api_key="shr_sk_your_key")
profile = client.profiles.create(
budget=50.00,
capabilities=["card", "phone", "email"]
)
print(profile.card.number)
print(profile.phone.digits)
print(profile.email.address)
otp = client.webhooks.wait_for_sms(profile.phone.id, timeout=30)
print(f"OTP: {otp.code}")
profile.destroy()
Async support
from shroud import AsyncShroud
client = AsyncShroud(api_key="shr_sk_your_key")
async def run_agent():
profile = await client.profiles.create(budget=25.00)
otp = await client.webhooks.wait_for_sms(profile.phone.id)
await profile.destroy()
CrewAI integration
from shroud.integrations import CrewAIToolkit
toolkit = CrewAIToolkit(api_key="shr_sk_your_key")
agent = Agent(tools=toolkit.get_tools())
TypeScript SDK
Installation
npm install @shroud/sdk
Requirements
- Node.js 18+
- TypeScript 5+ recommended
Basic usage
import { Shroud } from '@shroud/sdk';
const client = new Shroud({ apiKey: 'shr_sk_your_key' });
const profile = await client.profiles.create({
budget: 50.0,
capabilities: ['card', 'phone', 'email'],
});
console.log(profile.card.number);
console.log(profile.phone.digits);
console.log(profile.email.address);
const sms = await client.webhooks.waitForSms(profile.phone.id, {
timeout: 30_000,
});
console.log(`OTP: ${sms.extractedOtp}`);
await profile.destroy();
Express webhook handler
import { createWebhookHandler } from '@shroud/sdk';
app.post('/webhooks/shroud', createWebhookHandler({
secret: process.env.SHROUD_WEBHOOK_SECRET!,
onSmsReceived: (event) => {
console.log('OTP received:', event.extractedOtp);
},
onEmailReceived: (event) => {
console.log('Magic link:', event.extractedUrl);
},
}));
Error handling
| Exception | HTTP code | Description |
|---|---|---|
AuthenticationError | 401 | Invalid or expired API key |
BudgetExceededError | 402 | Card transaction exceeds remaining budget |
RateLimitError | 429 | Too many requests, retry after backoff |
ProfileNotFoundError | 404 | Profile has been destroyed or does not exist |