SDK API Reference
PHP SDK API Reference
Complete API reference for all functions in the PHP SDK
Complete reference for all methods available in the buena/sdk
package.
Installation & Setup
Core API Methods
All API methods are accessed through the DefaultApi
instance.
Lead Management Functions
listLeads($limit, $offset, $sort, $order, $search, $company, $status)
- Purpose: List all leads with optional filtering and pagination
- Parameters:
$limit
(int, optional): Number of leads (default: 50, max: 100)$offset
(int, optional): Pagination offset (default: 0)$sort
(string, optional): Sort field (created_at, updated_at, first_name, last_name)$order
(string, optional): Sort order (asc, desc, default: desc)$search
(string, optional): Search term for name/email$company
(string, optional): Filter by company name$status
(string, optional): Filter by status (active, inactive, contacted)
- Returns: Array of Lead objects with pagination info
- Throws: ApiException on error
createLead($createLeadRequest)
- Purpose: Create a new lead in database
- Parameters:
$createLeadRequest
(CreateLeadRequest): Lead data objectfirst_name
(string, required): Lead’s first namelast_name
(string, required): Lead’s last nameemail
(string, required): Valid email addresscompany
(string, optional): Company namephone
(string, optional): Phone numberlinkedin_url
(string, optional): LinkedIn profile URLjob_title
(string, optional): Job titlelocation
(string, optional): Location/citynotes
(string, optional): Additional notestags
(array, optional): Array of tagscustom_fields
(array, optional): Custom field data
- Returns: Lead object with generated ID and timestamps
- Throws: ApiException on validation error, duplicate email
getLead($leadId)
- Purpose: Retrieve specific lead by ID
- Parameters:
$leadId
(string, required): Unique lead identifier
- Returns: Lead object
- Throws: ApiException if lead not found
updateLead($leadId, $updateLeadRequest)
- Purpose: Update existing lead information
- Parameters:
$leadId
(string, required): Unique lead identifier$updateLeadRequest
(UpdateLeadRequest): Update data object- All fields optional, same as CreateLeadRequest
status
(string, optional): Update status (active, inactive, contacted)
- Returns: Updated Lead object
- Throws: ApiException on validation error, lead not found
deleteLead($leadId)
- Purpose: Permanently delete lead from database
- Parameters:
$leadId
(string, required): Unique lead identifier
- Returns: Success confirmation array
- Throws: ApiException if lead not found
API Key Management Functions
listApiKeys()
- Purpose: List all API keys for account
- Parameters: None
- Returns: Array of ApiKey objects
- Throws: ApiException on insufficient permissions
createApiKey($createApiKeyRequest)
- Purpose: Create new API key for account
- Parameters:
$createApiKeyRequest
(CreateApiKeyRequest): API key dataname
(string, required): Descriptive name for keypermissions
(array, required): Array of permission stringsexpires_at
(DateTime, optional): Expiration datedescription
(string, optional): Key description
- Returns: ApiKey object with full key (only returned on creation)
- Throws: ApiException on validation error
System Health Functions
healthCheck()
- Purpose: Check API system status and connection
- Parameters: None
- Returns: HealthCheck200Response with system status
- Throws: ApiException on server error
Data Models
Lead Object
ApiKey Object
Available Permissions
Error Handling
All methods throw ApiException
with these properties:
getCode()
- HTTP status codegetMessage()
- Error messagegetResponseBody()
- Raw response bodygetResponseHeaders()
- Response headers
Common Error Codes
400
- Bad Request (validation errors)401
- Unauthorized (invalid API key)403
- Forbidden (insufficient permissions)404
- Not Found (resource doesn’t exist)409
- Conflict (duplicate email)422
- Unprocessable Entity (validation error)429
- Too Many Requests (rate limited)500
- Internal Server Error503
- Service Unavailable