Voters API Endpoints
Complete API reference for voter management endpoints.
List Voters
Retrieve a paginated list of voters.
GET /api/voters
Authorization: Bearer {token}
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
page | integer | 1 | Page number |
per_page | integer | 15 | Items per page (max: 100) |
search | string | - | Search term |
constituency | string | - | Filter by constituency |
booth | string | - | Filter by booth number |
ward | string | - | Filter by ward |
Response
{
"success": true,
"data": {
"data": [
{
"id": 1,
"name": "John Doe",
"phone": "+919876543210",
"constituency": "ABC",
"booth": "123",
"ward": "5"
}
],
"current_page": 1,
"per_page": 15,
"total": 1000,
"last_page": 67
}
}
Get Voter
Retrieve a specific voter by ID.
GET /api/voters/{id}
Authorization: Bearer {token}
Response
{
"success": true,
"data": {
"id": 1,
"name": "John Doe",
"phone": "+919876543210",
"email": "john@example.com",
"constituency": "ABC",
"booth": "123",
"ward": "5",
"address": "123 Main St",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z"
}
}
Create Voter
Create a new voter record.
POST /api/voters
Authorization: Bearer {token}
Content-Type: application/json
{
"name": "John Doe",
"phone": "+919876543210",
"email": "john@example.com",
"constituency": "ABC",
"booth": "123",
"ward": "5",
"address": "123 Main St"
}
Required Fields
name(string): Voter namephone(string): Phone number
Optional Fields
email(string): Email addressconstituency(string): Constituency namebooth(string): Booth numberward(string): Ward numberaddress(string): Address
Response
{
"success": true,
"message": "Voter created successfully",
"data": {
"id": 1,
"name": "John Doe",
"phone": "+919876543210",
"created_at": "2024-01-01T00:00:00Z"
}
}
Update Voter
Update an existing voter record.
PUT /api/voters/{id}
Authorization: Bearer {token}
Content-Type: application/json
{
"name": "John Doe Updated",
"email": "john.updated@example.com"
}
Response
{
"success": true,
"message": "Voter updated successfully",
"data": {
"id": 1,
"name": "John Doe Updated",
"updated_at": "2024-01-02T00:00:00Z"
}
}
Delete Voter
Delete a voter record.
DELETE /api/voters/{id}
Authorization: Bearer {token}
Response
{
"success": true,
"message": "Voter deleted successfully"
}
Bulk Import
Import multiple voters from CSV.
POST /api/voters/import
Authorization: Bearer {token}
Content-Type: multipart/form-data
file: [CSV file]
Response
{
"success": true,
"message": "Voters imported successfully",
"data": {
"imported": 100,
"failed": 5,
"errors": []
}
}
Export Voters
Export voters to CSV.
GET /api/voters/export
Authorization: Bearer {token}
Query Parameters
format: csv (default) or excelfilters: JSON string of filters
Response
Returns CSV or Excel file download.
Next Steps
Need help? Contact Support