Skip to main content
Complete reference for all methods available in the @buena/sdk package.

Installation & Setup

Core API Methods

All API methods are accessed through buena.default.* and return promises.

Lead Management

listLeads(options?)

List all leads with optional filtering and pagination. Parameters:
Returns:
Example:
Errors:
  • 401 - Invalid API key
  • 403 - Insufficient permissions
  • 429 - Rate limit exceeded
  • 500 - Server error

createLead(leadData)

Create a new lead in your database. Parameters:
Returns:
Example:
Errors:
  • 400 - Invalid lead data (missing required fields, invalid email format)
  • 401 - Invalid API key
  • 409 - Lead with email already exists
  • 422 - Validation error (invalid phone format, invalid LinkedIn URL)
  • 429 - Rate limit exceeded
  • 500 - Server error

getLead(leadId)

Retrieve a specific lead by ID. Parameters:
Returns:
Example:
Errors:
  • 401 - Invalid API key
  • 404 - Lead not found
  • 500 - Server error

updateLead(leadId, updateData)

Update an existing lead’s information. Parameters:
Returns:
Example:
Errors:
  • 400 - Invalid update data
  • 401 - Invalid API key
  • 404 - Lead not found
  • 409 - Email already exists (if updating email)
  • 422 - Validation error
  • 500 - Server error

deleteLead(leadId)

Permanently delete a lead from your database. Parameters:
Returns:
Example:
Errors:
  • 401 - Invalid API key
  • 404 - Lead not found
  • 500 - Server error

API Key Management

listApiKeys()

List all API keys for your account. Parameters: None Returns:
Example:
Errors:
  • 401 - Invalid API key
  • 403 - Insufficient permissions
  • 500 - Server error

createApiKey(keyData)

Create a new API key for your account. Parameters:
Returns:
Example:
Errors:
  • 400 - Invalid key data (missing name, invalid permissions)
  • 401 - Invalid API key
  • 403 - Insufficient permissions
  • 422 - Validation error
  • 500 - Server error

System Health

healthCheck()

Check the API system status and your connection. Parameters: None Returns:
Example:
Errors:
  • 500 - Server error
  • 503 - Service unavailable

Error Handling

All methods can throw SDKError exceptions:

Rate Limiting

The API enforces rate limits:
  • 100 requests per minute for most endpoints
  • 20 requests per minute for resource creation (createLead, createApiKey)
Rate limit headers are included in responses:
  • X-RateLimit-Limit - Total requests allowed
  • X-RateLimit-Remaining - Requests remaining
  • X-RateLimit-Reset - Unix timestamp when limit resets

TypeScript Support

The SDK includes full TypeScript definitions:

MCP Integration

The TypeScript SDK includes a built-in MCP (Model Context Protocol) server that enables AI assistants to directly interact with your Buena.ai data.

Starting the MCP Server

AI Assistant Configuration

Claude Desktop Configuration:

Available MCP Tools

The MCP server exposes these tools to AI assistants:

Lead Management Tools

  • buena_list_leads - Search and filter leads
  • buena_create_lead - Create new leads
  • buena_get_lead - Retrieve lead details
  • buena_update_lead - Update lead information
  • buena_delete_lead - Delete leads

API Management Tools

  • buena_list_api_keys - List API keys
  • buena_create_api_key - Create new API keys
  • buena_health_check - Check system status

MCP Usage Examples

Lead Search via AI Assistant:
Batch Lead Creation:
Lead Analysis Workflow:

MCP Server Configuration

Environment Variables:
Configuration File (buena-mcp.config.json):

Testing MCP Integration

Manual Server Test:
Integration Test Script:

Advanced MCP Features

Custom Tool Extensions:
Batch Processing with MCP:

MCP Troubleshooting

Common Issues and Solutions:
  1. Server Won’t Start
  2. AI Assistant Connection Issues
  3. Tool Call Failures
Performance Optimization:
For complete MCP integration documentation and examples, see the MCP Integration Guide.