Documentation Index Fetch the complete documentation index at: https://mintlify.com/getrupt/sendook/llms.txt
Use this file to discover all available pages before exploring further.
SendookAPI Class
Constructor
new SendookAPI ( apiSecret : string , apiUrl ?: string )
Initializes a new instance of the Sendook API client.
Parameters
apiSecret (string, required): Your Sendook API secret key
apiUrl (string, optional): Custom API URL. Defaults to https://api.sendook.com
Example
import SendookAPI from '@sendook/node' ;
const client = new SendookAPI ( 'your_api_secret' );
Inbox Methods
Access inbox methods via client.inbox.
inbox.create()
Creates a new inbox.
client . inbox . create ( params ?: CreateInboxParams ): Promise < any >
Parameters
interface CreateInboxParams {
name ?: string ; // Name for the inbox
email ?: string ; // Email address (e.g., 'support@sendook.com')
}
Example
const inbox = await client . inbox . create ({
name: 'support' ,
email: 'support@sendook.com'
});
inbox.list()
Returns a list of all inboxes.
client . inbox . list (): Promise < any >
Example
const inboxes = await client . inbox . list ();
inbox.get()
Retrieves a specific inbox by ID.
client . inbox . get ( inboxId : string ): Promise < any >
Parameters
inboxId (string, required): The inbox ID
Example
const inbox = await client . inbox . get ( 'inbox_123' );
inbox.delete()
Deletes an inbox and all its messages.
client . inbox . delete ( inboxId : string ): Promise < any >
Parameters
inboxId (string, required): The inbox ID
Example
await client . inbox . delete ( 'inbox_123' );
Message Methods
Access message methods via client.inbox.message.
inbox.message.send()
Sends an email from an inbox.
client . inbox . message . send ( params : SendMessageParams ): Promise < any >
Parameters
interface SendMessageParams {
inboxId : string ; // The inbox ID to send from
to : string []; // Array of recipient email addresses
cc ?: string []; // Array of CC email addresses (optional)
bcc ?: string []; // Array of BCC email addresses (optional)
labels ?: string []; // Array of labels for categorization (optional)
subject : string ; // Email subject
text : string ; // Plain text content
html : string ; // HTML content
}
Example
const result = await client . inbox . message . send ({
inboxId: 'inbox_123' ,
to: [ 'user@example.com' ],
cc: [ 'manager@example.com' ],
bcc: [ 'archive@example.com' ],
labels: [ 'newsletter' ],
subject: 'Welcome!' ,
text: 'Thanks for signing up.' ,
html: '<h1>Thanks for signing up!</h1>'
});
inbox.message.reply()
Replies to an existing message.
client . inbox . message . reply ( params : ReplyMessageParams ): Promise < any >
Parameters
interface ReplyMessageParams {
inboxId : string ; // The inbox ID
messageId : string ; // The message ID to reply to
text : string ; // Plain text content
html : string ; // HTML content
}
Example
const result = await client . inbox . message . reply ({
inboxId: 'inbox_123' ,
messageId: 'msg_456' ,
text: 'Thanks for your message!' ,
html: '<p>Thanks for your message!</p>'
});
inbox.message.list()
Lists messages in an inbox with optional search query.
client . inbox . message . list ( inboxId : string , query ?: string ): Promise < any >
Parameters
inboxId (string, required): The inbox ID
query (string, optional): Search query to filter messages
Example
// List all messages
const messages = await client . inbox . message . list ( 'inbox_123' );
// Search messages
const results = await client . inbox . message . list (
'inbox_123' ,
'subject:invoice'
);
inbox.message.get()
Retrieves a specific message.
client . inbox . message . get ( inboxId : string , messageId : string ): Promise < any >
Parameters
inboxId (string, required): The inbox ID
messageId (string, required): The message ID
Example
const message = await client . inbox . message . get ( 'inbox_123' , 'msg_456' );
Thread Methods
Access thread methods via client.inbox.thread.
inbox.thread.list()
Lists all threads in an inbox.
client . inbox . thread . list ( inboxId : string ): Promise < any >
Parameters
inboxId (string, required): The inbox ID
Example
const threads = await client . inbox . thread . list ( 'inbox_123' );
inbox.thread.get()
Retrieves a specific thread.
client . inbox . thread . get ( inboxId : string , threadId : string ): Promise < any >
Parameters
inboxId (string, required): The inbox ID
threadId (string, required): The thread ID
Example
const thread = await client . inbox . thread . get ( 'inbox_123' , 'thread_789' );
Domain Methods
Access domain methods via client.domain.
domain.create()
Creates a new custom domain.
client . domain . create ( params : CreateDomainParams ): Promise < any >
Parameters
interface CreateDomainParams {
name : string ; // Domain name (e.g., 'yourdomain.com')
}
Example
const domain = await client . domain . create ({
name: 'yourdomain.com'
});
domain.get()
Retrieves domain details.
client . domain . get ( params : GetDomainParams ): Promise < any >
Parameters
interface GetDomainParams {
domainId : string ; // The domain ID
}
Example
const domain = await client . domain . get ({
domainId: 'domain_123'
});
domain.verify()
Verifies domain DNS configuration.
client . domain . verify ( params : VerifyDomainParams ): Promise < any >
Parameters
interface VerifyDomainParams {
domainId : string ; // The domain ID
}
Example
const result = await client . domain . verify ({
domainId: 'domain_123'
});
domain.dns()
Retrieves DNS records for domain configuration.
client . domain . dns ( params : GetDomainDNSParams ): Promise < any >
Parameters
interface GetDomainDNSParams {
domainId : string ; // The domain ID
}
Example
const dnsRecords = await client . domain . dns ({
domainId: 'domain_123'
});
domain.delete()
Deletes a domain.
client . domain . delete ( params : DeleteDomainParams ): Promise < any >
Parameters
interface DeleteDomainParams {
domainId : string ; // The domain ID
}
Example
await client . domain . delete ({
domainId: 'domain_123'
});
Webhook Methods
Access webhook methods via client.webhook.
webhook.create()
Creates a new webhook.
client . webhook . create ( params : CreateWebhookParams ): Promise < any >
Parameters
interface CreateWebhookParams {
url : string ; // Webhook endpoint URL
events : string []; // Array of event types to subscribe to
}
Available Events
message.received - Triggered when a message is received
message.sent - Triggered when a message is sent
message.delivered - Triggered when a message is delivered
message.bounced - Triggered when a message bounces
message.rejected - Triggered when a message is rejected
Example
const webhook = await client . webhook . create ({
url: 'https://your-app.com/webhooks/sendook' ,
events: [ 'message.received' , 'message.sent' ]
});
webhook.list()
Lists all webhooks.
client . webhook . list (): Promise < any >
Example
const webhooks = await client . webhook . list ();
webhook.get()
Retrieves a specific webhook.
client . webhook . get ( webhookId : string ): Promise < any >
Parameters
webhookId (string, required): The webhook ID
Example
const webhook = await client . webhook . get ( 'webhook_123' );
webhook.test()
Tests a webhook by sending a test event.
client . webhook . test ( webhookId : string ): Promise < any >
Parameters
webhookId (string, required): The webhook ID
Example
const result = await client . webhook . test ( 'webhook_123' );
webhook.delete()
Deletes a webhook.
client . webhook . delete ( webhookId : string ): Promise < any >
Parameters
webhookId (string, required): The webhook ID
Example
await client . webhook . delete ( 'webhook_123' );
API Key Methods
Access API key methods via client.apiKey.
apiKey.create()
Creates a new API key.
client . apiKey . create ( params : CreateApiKeyParams ): Promise < any >
Parameters
interface CreateApiKeyParams {
name : string ; // Name for the API key
}
Example
const apiKey = await client . apiKey . create ({
name: 'Production Key'
});
apiKey.list()
Lists all API keys.
client . apiKey . list (): Promise < any >
Example
const apiKeys = await client . apiKey . list ();
apiKey.get()
Retrieves a specific API key.
client . apiKey . get ( params : GetApiKeyParams ): Promise < any >
Parameters
interface GetApiKeyParams {
apiKeyId : string ; // The API key ID
}
Example
const apiKey = await client . apiKey . get ({
apiKeyId: 'key_123'
});
apiKey.delete()
Deletes an API key.
client . apiKey . delete ( params : DeleteApiKeyParams ): Promise < any >
Parameters
interface DeleteApiKeyParams {
apiKeyId : string ; // The API key ID
}
Example
await client . apiKey . delete ({
apiKeyId: 'key_123'
});
Type Definitions
The SDK exports the following TypeScript types:
Interface Exports
import type {
// Method interfaces
ApiKeyMethods ,
DomainMethods ,
InboxMethods ,
WebhookMethods ,
MessageMethods ,
ThreadMethods ,
// Parameter types
CreateApiKeyParams ,
GetApiKeyParams ,
DeleteApiKeyParams ,
CreateDomainParams ,
GetDomainParams ,
VerifyDomainParams ,
GetDomainDNSParams ,
DeleteDomainParams ,
CreateInboxParams ,
SendMessageParams ,
ReplyMessageParams ,
CreateWebhookParams ,
GetWebhookParams ,
DeleteWebhookParams
} from '@sendook/node' ;
Usage with Types
import SendookAPI from '@sendook/node' ;
import type { SendMessageParams } from '@sendook/node' ;
const client = new SendookAPI ( 'your_api_secret' );
const messageParams : SendMessageParams = {
inboxId: 'inbox_123' ,
to: [ 'user@example.com' ],
subject: 'Hello' ,
text: 'Hello, world!' ,
html: '<p>Hello, world!</p>'
};
await client . inbox . message . send ( messageParams );
Error Handling
All methods return promises that may reject with axios errors. Always use try-catch blocks:
import SendookAPI from '@sendook/node' ;
import { AxiosError } from 'axios' ;
const client = new SendookAPI ( process . env . SENDOOK_API_SECRET ! );
try {
const inbox = await client . inbox . create ({
name: 'support'
});
} catch ( error ) {
if ( error instanceof AxiosError ) {
if ( error . response ) {
// Server responded with error status
console . error ( 'Status:' , error . response . status );
console . error ( 'Data:' , error . response . data );
} else if ( error . request ) {
// Request made but no response received
console . error ( 'No response from server' );
}
} else {
console . error ( 'Error:' , error );
}
}
Common Error Codes
401 - Unauthorized (invalid API key)
404 - Resource not found
422 - Validation error (invalid parameters)
429 - Rate limit exceeded
500 - Internal server error
Next Steps
Installation Learn how to install the SDK
Usage Examples View practical usage examples