@sendmailos/sdk 1.3.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -315,6 +315,53 @@ await platform.campaigns.send({
315
315
 
316
316
  **One verified domain = One workspace.** Simple.
317
317
 
318
+ ### Master API Keys
319
+
320
+ Master API keys can access all workspaces in your organization with a single key. Ideal for SaaS platforms that need to manage multiple client workspaces programmatically.
321
+
322
+ #### Recommended Flow for SaaS Platforms
323
+
324
+ ```typescript
325
+ // Your platform backend - when a new client signs up
326
+ const platform = new SendMailOS('sk_live_master_key');
327
+
328
+ // 1. Create workspace first (with your client's data)
329
+ const { workspace } = await platform.workspaces.create({
330
+ name: 'Pizza Palace', // From your user's profile
331
+ industry: 'restaurants', // Optional - can be null
332
+ website: 'https://pizzapalace.com'
333
+ });
334
+
335
+ // 2. Add domain TO that workspace
336
+ const { dns_records } = await platform.domains.create({
337
+ domain: 'pizzapalace.com',
338
+ workspaceId: workspace.id // Link to the workspace
339
+ });
340
+
341
+ // 3. Show DNS records to your user
342
+ // They verify DNS, domain becomes active
343
+
344
+ // 4. Now send emails using workspace_id or domain
345
+ await platform.emails.send({
346
+ to: 'customer@example.com',
347
+ fromEmail: 'hello@pizzapalace.com',
348
+ subject: 'Welcome!',
349
+ html: '<h1>Welcome!</h1>',
350
+ workspaceId: workspace.id
351
+ });
352
+ ```
353
+
354
+ Your end users only see: **"Add domain → Verify DNS → Done"**
355
+
356
+ Behind the scenes: Workspace created with proper settings → Domain linked → Ready to send.
357
+
358
+ **Master Key vs Workspace Key:**
359
+ | Feature | Master Key | Workspace Key |
360
+ |---------|-----------|---------------|
361
+ | Access | All workspaces | Single workspace |
362
+ | workspaceId param | Required | Not needed |
363
+ | Use case | Platform/SaaS backend | Per-client integrations |
364
+
318
365
  ## Agency Workspaces (Advanced)
319
366
 
320
367
  For more control, you can manually manage workspaces:
package/dist/index.d.mts CHANGED
@@ -2,7 +2,7 @@
2
2
  * SendMailOS SDK Types
3
3
  */
4
4
  interface SendMailOSOptions {
5
- /** Base URL for the API (default: https://api.sendmailos.com) */
5
+ /** Base URL for the API (default: https://sendmailos.com) */
6
6
  baseUrl?: string;
7
7
  /** Request timeout in milliseconds (default: 30000) */
8
8
  timeout?: number;
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * SendMailOS SDK Types
3
3
  */
4
4
  interface SendMailOSOptions {
5
- /** Base URL for the API (default: https://api.sendmailos.com) */
5
+ /** Base URL for the API (default: https://sendmailos.com) */
6
6
  baseUrl?: string;
7
7
  /** Request timeout in milliseconds (default: 30000) */
8
8
  timeout?: number;
package/dist/index.js CHANGED
@@ -1001,9 +1001,9 @@ var WebhooksResource = class {
1001
1001
  };
1002
1002
 
1003
1003
  // src/client.ts
1004
- var DEFAULT_BASE_URL = "https://api.sendmailos.com/api/v1";
1004
+ var DEFAULT_BASE_URL = "https://sendmailos.com/api/v1";
1005
1005
  var DEFAULT_TIMEOUT = 3e4;
1006
- var SDK_VERSION = "1.2.0";
1006
+ var SDK_VERSION = "1.3.2";
1007
1007
  var SendMailOS = class {
1008
1008
  constructor(apiKey, options = {}) {
1009
1009
  if (!apiKey) {