API Documentation

Build powerful marketing automation with our REST API. Verify leads, send WhatsApp campaigns, and manage contacts programmatically.

Base URL: https://app.onhandi.com/public/api/v1

Quick Start

  1. 1
    Get your API key from your Profile Settings
  2. 2
    Make your first request using the examples below
  3. 3
    Build something amazing with LeadFlux!
Get API Key

Introduction

The LeadFlux API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON request bodies, returns JSON responses, and uses standard HTTP response codes and authentication.

All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.

Authentication

The LeadFlux API uses API keys to authenticate requests. You can view and manage your API keys in your Profile Settings.

Authentication Methods
# Method 1: X-API-Key Header (Recommended)
curl https://app.onhandi.com/public/api/v1/leads \
  -H "X-API-Key: lf_live_your_api_key_here"

# Method 2: Bearer Token
curl https://app.onhandi.com/public/api/v1/leads \
  -H "Authorization: Bearer lf_live_your_api_key_here"

# Method 3: Query Parameter
curl "https://app.onhandi.com/public/api/v1/leads?api_key=lf_live_your_api_key_here"
Security Notice: Never share your API key or commit it to version control. Use environment variables in production.

Rate Limits

To ensure fair usage and system stability, API requests are rate-limited based on your plan.

Free

10
requests/minute
500 requests/day

Starter

60
requests/minute
10,000 requests/day

Professional

200
requests/minute
50,000 requests/day

Enterprise

1K
requests/minute
500,000 requests/day
When you exceed your rate limit, you'll receive a 429 Too Many Requests response. Check the Retry-After header for wait time.

Errors

LeadFlux uses conventional HTTP response codes to indicate the success or failure of an API request.

Code Description
200Success - Request completed successfully
201Created - Resource created successfully
400Bad Request - Invalid parameters or missing required fields
401Unauthorized - Invalid or missing API key
403Forbidden - API key is inactive or revoked
404Not Found - Resource doesn't exist
409Conflict - Resource already exists (e.g., duplicate phone)
429Too Many Requests - Rate limit exceeded
500Internal Server Error - Something went wrong on our end

Session Management

Manage WhatsApp sessions for sending messages. Each session represents a connected WhatsApp number using the WAHA API.

Base URL: https://app.onhandi.com/public/api/v1/waha
GET /sessions List all WhatsApp sessions

Get all sessions for the authenticated user.

Request
cURL
curl -X GET "https://app.onhandi.com/public/api/v1/waha/sessions" \
  -H "X-API-Key: YOUR_API_KEY"
POST /sessions Create a new WhatsApp session

Creates a new WhatsApp session.

Parameters
NameTypeDescription
namerequiredstringSession name for identification
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/waha/sessions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "name": "My Business API Session"
  }'
GET /sessions/{session_id} Get session status & QR code

Get the details, live status, and QR code for a specific session.

Request
cURL
curl -X GET "https://app.onhandi.com/public/api/v1/waha/sessions/1d816b1c-b28a-4113-b085-a9c52101b909" \
  -H "X-API-Key: YOUR_API_KEY"
DELETE /sessions/{session_id} Delete a WhatsApp session

Permanently delete a WhatsApp session.

Request
cURL
curl -X DELETE "https://app.onhandi.com/public/api/v1/waha/sessions/1d816b1c-b28a-4113-b085-a9c52101b909" \
  -H "X-API-Key: YOUR_API_KEY"

WhatsApp Messaging

Send various types of WhatsApp messages through your connected sessions. All messaging endpoints use the same base URL.

Base URL: https://app.onhandi.com/public/api/v1/waha
POST /send Send Text Message

Send a text message to a WhatsApp number.

Parameters
NameTypeDescription
session_idrequiredstringYour WhatsApp session ID
torequiredstringRecipient phone number (without +)
typerequiredstringMessage type: "text"
messagerequiredstringText message content
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/waha/send" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "session_id": "1d816b1c-b28a-4113-b085-a9c52101b909",
    "to": "254110377776",
    "type": "text",
    "message": "Hello from LeadFlux API!"
  }'
POST /send Send Image

Send an image with optional caption.

Parameters
NameTypeDescription
session_idrequiredstringYour WhatsApp session ID
torequiredstringRecipient phone number
typerequiredstringMessage type: "image"
media_urlrequiredstringURL of the image to send
captionoptionalstringImage caption
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/waha/send" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "session_id": "1d816b1c-b28a-4113-b085-a9c52101b909",
    "to": "254110377776",
    "type": "image",
    "media_url": "https://via.placeholder.com/300",
    "caption": "This is a test image"
  }'
POST /send Send Video

Send a video with optional caption.

Parameters
NameTypeDescription
session_idrequiredstringYour WhatsApp session ID
torequiredstringRecipient phone number
typerequiredstringMessage type: "video"
media_urlrequiredstringURL of the video to send
captionoptionalstringVideo caption
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/waha/send" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "session_id": "1d816b1c-b28a-4113-b085-a9c52101b909",
    "to": "254110377776",
    "type": "video",
    "media_url": "https://www.w3schools.com/html/mov_bbb.mp4",
    "caption": "Test Video"
  }'
POST /send Send Document

Send a document file (PDF, DOC, etc.).

Parameters
NameTypeDescription
session_idrequiredstringYour WhatsApp session ID
torequiredstringRecipient phone number
typerequiredstringMessage type: "document"
media_urlrequiredstringURL of the document to send
captionoptionalstringDocument caption/filename
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/waha/send" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "session_id": "1d816b1c-b28a-4113-b085-a9c52101b909",
    "to": "254110377776",
    "type": "document",
    "media_url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
    "caption": "Document File"
  }'
POST /send Send Sticker

Send a WhatsApp sticker.

Parameters
NameTypeDescription
session_idrequiredstringYour WhatsApp session ID
torequiredstringRecipient phone number
typerequiredstringMessage type: "sticker"
media_urlrequiredstringURL of the sticker image
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/waha/send" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "session_id": "1d816b1c-b28a-4113-b085-a9c52101b909",
    "to": "254110377776",
    "type": "sticker",
    "media_url": "https://upload.wikimedia.org/wikipedia/commons/4/4f/La_comuna_y_el_estado.png"
  }'
POST /send Send Location

Send a location pin with coordinates.

Parameters
NameTypeDescription
session_idrequiredstringYour WhatsApp session ID
torequiredstringRecipient phone number
typerequiredstringMessage type: "location"
latituderequiredstringLocation latitude
longituderequiredstringLocation longitude
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/waha/send" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "session_id": "1d816b1c-b28a-4113-b085-a9c52101b909",
    "to": "254110377776",
    "type": "location",
    "latitude": "-1.2841",
    "longitude": "36.8155"
  }'
POST /send Send Contact

Send a contact card (vCard).

Parameters
NameTypeDescription
session_idrequiredstringYour WhatsApp session ID
torequiredstringRecipient phone number
typerequiredstringMessage type: "contact"
namerequiredstringContact name
phonerequiredstringContact phone number
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/waha/send" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "session_id": "1d816b1c-b28a-4113-b085-a9c52101b909",
    "to": "254110377776",
    "type": "contact",
    "name": "John Doe",
    "phone": "254700000000"
  }'
POST /send Send Poll

Send an interactive poll.

Parameters
NameTypeDescription
session_idrequiredstringYour WhatsApp session ID
torequiredstringRecipient phone number
typerequiredstringMessage type: "poll"
questionrequiredstringPoll question
optionsrequiredarrayArray of poll options
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/waha/send" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "session_id": "1d816b1c-b28a-4113-b085-a9c52101b909",
    "to": "254110377776",
    "type": "poll",
    "question": "What is your favorite framework?",
    "options": ["Laravel", "CodeIgniter", "Node.js"]
  }'
POST /send Send Buttons

Send interactive button messages.

Parameters
NameTypeDescription
session_idrequiredstringYour WhatsApp session ID
torequiredstringRecipient phone number
typerequiredstringMessage type: "buttons"
textrequiredstringMessage text
buttonsrequiredarrayArray of button labels
footeroptionalstringFooter text
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/waha/send" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "session_id": "1d816b1c-b28a-4113-b085-a9c52101b909",
    "to": "254110377776",
    "type": "buttons",
    "text": "Do you agree?",
    "footer": "LeadFlux",
    "buttons": ["Yes", "No", "Maybe"]
  }'
POST /send Send List Message

Send interactive list menu messages.

Parameters
NameTypeDescription
session_idrequiredstringYour WhatsApp session ID
torequiredstringRecipient phone number
typerequiredstringMessage type: "list"
titlerequiredstringList title
descriptionrequiredstringList description
buttonTextrequiredstringButton text
sectionsrequiredarrayArray of list sections with rows
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/waha/send" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "session_id": "1d816b1c-b28a-4113-b085-a9c52101b909",
    "to": "254110377776",
    "type": "list",
    "title": "Services Menu",
    "description": "Choose a service:",
    "buttonText": "Select",
    "sections": [
      {
        "title": "Support",
        "rows": [
          {"id": "1", "title": "Call Agent"},
          {"id": "2", "title": "Open Ticket"}
        ]
      }
    ]
  }'

Leads API

Manage leads in your LeadFlux account. Create, update, verify, and organize your leads.

GET /leads List all leads with pagination
Parameters
NameTypeDescription
pageoptionalintegerPage number (default: 1)
limitoptionalintegerResults per page (max: 100, default: 50)
statusoptionalstringFilter by status: WORKING, NOT_WORKING, NO_WEBSITE
qualifieroptionalstringFilter by: QUALIFIED, UNQUALIFIED
Request
cURL
curl -X GET "https://app.onhandi.com/public/api/v1/leads?page=1&limit=50&status=WORKING" \
  -H "X-API-Key: YOUR_API_KEY"
Response
JSON
{
  "success": true,
  "data": {
    "leads": [
      {
        "id": 1,
        "name": "Acme Corp",
        "phone": "254712345678",
        "website": "https://acme.com",
        "website_status": "WORKING",
        "qualifier": "QUALIFIED"
      }
    ],
    "pagination": {
      "current_page": 1,
      "total": 1245,
      "total_pages": 25
    }
  }
}
POST /leads Create a new lead
Parameters
NameTypeDescription
phonerequiredstringPhone number (auto-formatted)
nameoptionalstringContact name (default: "Unknown")
websiteoptionalstringWebsite URL
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/leads" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "254712345678",
    "name": "John Doe",
    "website": "https://example.com"
  }'
GET /leads/{id} Get a specific lead
Request
cURL
curl -X GET "https://app.onhandi.com/public/api/v1/leads/123" \
  -H "X-API-Key: YOUR_API_KEY"
POST /leads/{id} Update a lead
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/leads/123" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "_method": "PUT",
    "name": "John Doe Updated",
    "website": "https://newsite.com"
  }'
DELETE /leads/{id} Delete a lead
Request
cURL
curl -X DELETE "https://app.onhandi.com/public/api/v1/leads/123" \
  -H "X-API-Key: YOUR_API_KEY"
POST /leads/import Import leads from CSV
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/leads/import" \
  -H "X-API-Key: YOUR_API_KEY" \
  -F "file=@/path/to/leads.csv"
POST /leads/verify Verify leads (check websites)

Trigger bulk verification of lead websites. Returns batch ID for tracking.

Parameters
NameTypeDescription
lead_idsoptionalarraySpecific lead IDs to verify (all if empty)
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/leads/verify" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "lead_ids": [1, 2, 3, 4, 5]
  }'

Number Verification API

Verify if phone numbers are registered on WhatsApp before sending messages.

POST /numbers/verify Verify a single phone number
Parameters
NameTypeDescription
phonerequiredstringPhone number to verify
session_idoptionalintegerWhatsApp session ID (uses default if empty)
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/numbers/verify" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "254712345678"
  }'
Response
JSON
{
  "success": true,
  "data": {
    "phone": "254712345678",
    "is_whatsapp": true,
    "whatsapp_jid": "254712345678@s.whatsapp.net",
    "status": "valid"
  }
}
POST /numbers/verify-bulk Bulk verify phone numbers
Parameters
NameTypeDescription
phonesrequiredarrayArray of phone numbers to verify
session_idoptionalintegerWhatsApp session ID
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/numbers/verify-bulk" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "phones": ["254712345678", "254787654321", "254799123456"]
  }'

Contacts API

Manage your contacts and contact groups for campaign targeting.

GET /contacts/list List all contacts
Parameters
NameTypeDescription
pageoptionalintegerPage number (default: 1)
limitoptionalintegerResults per page (default: 50)
group_idoptionalintegerFilter by group ID
searchoptionalstringSearch by name or phone
Request
cURL
curl -X GET "https://app.onhandi.com/public/api/contacts/list?page=1&limit=50&group_id=5" \
  -H "X-API-Key: YOUR_API_KEY"
GET /contacts/get Get a single contact
Request
cURL
curl -X GET "https://app.onhandi.com/public/api/contacts/get?id=123" \
  -H "X-API-Key: YOUR_API_KEY"
POST /contacts/create Create a new contact
Parameters
NameTypeDescription
namerequiredstringContact name
phonerequiredstringPhone number
emailoptionalstringEmail address
group_idoptionalintegerGroup ID to assign
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/contacts/create" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "John Doe",
    "phone": "254712345678",
    "email": "john@example.com",
    "group_id": 5
  }'
POST /contacts/update Update a contact
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/contacts/update" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "id": 123,
    "name": "John Doe Updated",
    "email": "newemail@example.com"
  }'
POST /contacts/delete Delete a contact
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/contacts/delete" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"id": 123}'
POST /contacts/toggle-favorite Toggle contact favorite status
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/contacts/toggle-favorite" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"id": 123}'
POST /contacts/bulk-delete Delete multiple contacts
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/contacts/bulk-delete" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "ids": [123, 124, 125]
  }'
POST /contacts/bulk-assign-group Assign contacts to a group
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/contacts/bulk-assign-group" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contact_ids": [123, 124, 125],
    "group_id": 5
  }'
POST /contacts/import Import contacts from CSV
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/contacts/import" \
  -H "X-API-Key: YOUR_API_KEY" \
  -F "file=@/path/to/contacts.csv" \
  -F "group_id=5"
GET /contacts/export Export contacts to CSV
Request
cURL
curl -X GET "https://app.onhandi.com/public/api/contacts/export?format=csv&group_id=5" \
  -H "X-API-Key: YOUR_API_KEY" \
  -o contacts_export.csv

Contact Groups API

Organize contacts into groups for easier campaign targeting.

GET /contacts/groups List all contact groups
Request
cURL
curl -X GET "https://app.onhandi.com/public/api/contacts/groups" \
  -H "X-API-Key: YOUR_API_KEY"
POST /contacts/groups/create Create a new group
Parameters
NameTypeDescription
namerequiredstringGroup name
coloroptionalstringGroup color (hex code)
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/contacts/groups/create" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "VIP Customers",
    "color": "#FF5733"
  }'
POST /contacts/groups/update Update a group
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/contacts/groups/update" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "id": 5,
    "name": "VIP Customers Updated",
    "color": "#33FF57"
  }'
POST /contacts/groups/delete Delete a group
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/contacts/groups/delete" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"id": 5}'

Campaigns API

Create, manage, and launch WhatsApp marketing campaigns.

GET /campaigns List all campaigns
Request
cURL
curl -X GET "https://app.onhandi.com/public/api/v1/campaigns?page=1&limit=20" \
  -H "X-API-Key: YOUR_API_KEY"
GET /campaigns/{id} Get campaign details
Request
cURL
curl -X GET "https://app.onhandi.com/public/api/v1/campaigns/46" \
  -H "X-API-Key: YOUR_API_KEY"
POST /campaigns Create a new campaign
Parameters
NameTypeDescription
namerequiredstringCampaign name
gateway_typerequiredstringGateway: "whatsapp"
gateway_session_idrequiredintegerWhatsApp session ID
recipient_sourcerequiredstringSource: "csv", "groups", "manual"
custom_recipientsoptionalarrayPhone numbers for manual source
message_contentrequiredobjectMessage content object
strategyoptionalstringSending strategy: sequential, random, burst
rate_per_minuteoptionalintegerMessages per minute (default: 10)
anti_ban_enabledoptionalbooleanEnable anti-ban (default: true)
scheduled_atoptionalstringSchedule date/time (ISO 8601)
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/campaigns" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "API Test Campaign",
    "description": "Created via API",
    "gateway_type": "whatsapp",
    "gateway_session_id": 37,
    "recipient_source": "csv",
    "custom_recipients": ["254712345678", "254787654321"],
    "message_content": {
      "type": "text",
      "text": "Hello from LeadFlux API!"
    },
    "strategy": "random",
    "rate_per_minute": 10,
    "anti_ban_enabled": true
  }'
POST /campaigns/{id} Update a campaign
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/campaigns/46" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "_method": "PUT",
    "name": "Updated Campaign Name",
    "scheduled_at": "2026-03-23 10:00:00"
  }'
DELETE /campaigns/{id} Delete a campaign
Request
cURL
curl -X DELETE "https://app.onhandi.com/public/api/v1/campaigns/46" \
  -H "X-API-Key: YOUR_API_KEY"
POST /campaigns/{id}/launch Launch a campaign

Start a draft or scheduled campaign immediately.

Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/campaigns/46/launch" \
  -H "X-API-Key: YOUR_API_KEY"
POST /campaigns/{id}/pause Pause a running campaign
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/campaigns/46/pause" \
  -H "X-API-Key: YOUR_API_KEY"
POST /campaigns/{id}/resume Resume a paused campaign
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/campaigns/46/resume" \
  -H "X-API-Key: YOUR_API_KEY"
POST /campaigns/preview-recipients Preview recipient count

Calculate how many recipients match a filter before creating a campaign.

Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/campaigns/preview-recipients" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "source": "groups",
    "filter": {
      "group_ids": [1, 2]
    }
  }'
GET /campaigns/{id}/analytics Get campaign analytics
Request
cURL
curl -X GET "https://app.onhandi.com/public/api/campaigns/46/analytics?period=all" \
  -H "X-API-Key: YOUR_API_KEY"
Response
JSON
{
  "success": true,
  "data": {
    "total": 1000,
    "sent": 850,
    "delivered": 820,
    "read": 450,
    "failed": 30,
    "pending": 150,
    "delivery_rate": 96.5,
    "read_rate": 54.8
  }
}
GET /campaigns/strategies Get available strategies
Request
cURL
curl -X GET "https://app.onhandi.com/public/api/campaigns/strategies" \
  -H "X-API-Key: YOUR_API_KEY"
Response
JSON
{
  "success": true,
  "data": {
    "strategies": [
      {"id": "sequential", "name": "Sequential", "description": "Send one by one"},
      {"id": "random", "name": "Random", "description": "Randomized delays"},
      {"id": "burst", "name": "Burst", "description": "Fast sending for small lists"}
    ],
    "message_types": ["text", "image", "video", "document"]
  }
}

API Key Management

Create and manage API keys for programmatic access.

GET /api-keys List all API keys
Request
cURL
curl -X GET "https://app.onhandi.com/public/api/v1/api-keys" \
  -H "X-API-Key: YOUR_API_KEY"
POST /api-keys Create a new API key
Parameters
NameTypeDescription
key_nameoptionalstringName for this key
rate_limit_per_minuteoptionalintegerRequests per minute (10-1000)
rate_limit_per_dayoptionalintegerRequests per day (500-500000)
expires_atoptionalstringExpiration date (ISO 8601)
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/api-keys" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "key_name": "Production Key",
    "rate_limit_per_minute": 100,
    "rate_limit_per_day": 50000
  }'
Important: The API key will only be shown once in the response. Store it securely!
POST /api-keys/revoke Revoke an API key
Request
cURL
curl -X POST "https://app.onhandi.com/public/api/v1/api-keys/revoke" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"id": 5}'

Code Examples

PHP Example
PHP
<?php
$apiKey = 'lf_live_your_api_key';
$baseUrl = 'https://app.onhandi.com/public/api/v1';

// List leads
$ch = curl_init("$baseUrl/leads");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['X-API-Key: ' . $apiKey]
]);
$response = curl_exec($ch);
$leads = json_decode($response, true);

// Create lead
$ch = curl_init("$baseUrl/leads");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        'X-API-Key: ' . $apiKey,
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'phone' => '254712345678',
        'name' => 'John Doe'
    ])
]);
$response = curl_exec($ch);
?>
Python Example
Python
import requests

API_KEY = 'lf_live_your_api_key'
BASE_URL = 'https://app.onhandi.com/public/api/v1'
HEADERS = {'X-API-Key': API_KEY}

# List leads
response = requests.get(f'{BASE_URL}/leads', headers=HEADERS)
leads = response.json()

# Create lead
response = requests.post(
    f'{BASE_URL}/leads',
    headers=HEADERS,
    json={'phone': '254712345678', 'name': 'John Doe'}
)

# Verify number
response = requests.post(
    f'{BASE_URL}/numbers/verify',
    headers=HEADERS,
    json={'phone': '254712345678'}
)
JavaScript (Node.js) Example
Node.js
const axios = require('axios');

const API_KEY = 'lf_live_your_api_key';
const BASE_URL = 'https://app.onhandi.com/public/api/v1';

const api = axios.create({
    baseURL: BASE_URL,
    headers: { 'X-API-Key': API_KEY }
});

// List leads
const leads = await api.get('/leads');

// Create lead
const newLead = await api.post('/leads', {
    phone: '254712345678',
    name: 'John Doe'
});

// Verify number
const verification = await api.post('/numbers/verify', {
    phone: '254712345678'
});