Complete API documentation for the Family Tree application
The Family Tree API provides comprehensive endpoints for managing family tree data, including persons, relationships, images, and authentication. The API supports both MySQL database storage and JSON file fallback.
All responses are in JSON format. Successful responses include the requested data, while errors include an error field with a descriptive message.
Most endpoints require authentication via JWT token in the Authorization header: Authorization: Bearer <token>
Register a new user account
| Field | Type | Required | Description |
|---|---|---|---|
| full_name | string | Yes | Full name (First M Last) |
| password | string | Yes | User password (min 6 characters) |
| string | Yes | Unique email address |
{
"id": "uuid",
"username": "John William Doe",
"email": "john@example.com",
"created_at": "2024-01-01T00:00:00.000Z"
}
Authenticate user and get JWT token
| Field | Type | Required | Description |
|---|---|---|---|
| string | Yes | Email address | |
| password | string | Yes | Password |
{
"token": "jwt_token_here",
"user": {
"id": "uuid",
"username": "John William Doe",
"email": "john@example.com"
}
}
Get all users (admin only)
[
{
"id": "uuid",
"username": "johndoe",
"email": "john@example.com",
"can_write": false,
"created_at": "2024-01-01T00:00:00.000Z"
}
]
Get current user details
{
"user": {
"id": "uuid",
"username": "johndoe",
"email": "john@example.com",
"can_write": false
}
}
Update user details (admin only)
| Parameter | Type | Description |
|---|---|---|
| id | string | User UUID |
| Field | Type | Description |
|---|---|---|
| can_write | boolean | Write permissions |
Delete user (admin only, cannot delete admin)
Change user password
| Field | Type | Required | Description |
|---|---|---|---|
| currentPassword | string | Yes | Current password |
| newPassword | string | Yes | New password |
Get all persons in the family tree
[
{
"id": "uuid",
"first": "John",
"middle": "William",
"last": "Doe",
"birth": {
"date": "01/15/1980",
"place": "New York, NY"
},
"death": null,
"burial": null,
"residence": {
"address": "123 Main St",
"city": "Anytown",
"state": "CA",
"zip": "12345"
},
"img": ["image1.jpg", "image2.jpg"],
"hasMarried": true
}
]
Get detailed information for a specific person
| Parameter | Type | Description |
|---|---|---|
| id | string | Person UUID |
Create a new person
| Field | Type | Description |
|---|---|---|
| first | string | First name |
| middle | string | Middle name |
| last | string | Last name |
| birth_date | string | Birth date (MM/DD/YYYY) |
| birth_place | string | Birth place |
| death_date | string | Death date (MM/DD/YYYY) |
| death_place | string | Death place |
| burial_date | string | Burial date (MM/DD/YYYY) |
| burial_place | string | Burial place |
| residence_address | string | Residence address |
| residence_city | string | Residence city |
| residence_state | string | Residence state |
| residence_zip | string | Residence ZIP code |
| avatar | file | Profile avatar image |
| images | file[] | Additional images (up to 20) |
Update an existing person
Same parameters as POST, all fields optional for partial updates
Delete a person and all associated data
Delete a specific image from a person
| Parameter | Type | Description |
|---|---|---|
| imagePath | string | Path to the image file to delete |
Get basic person information (legacy endpoint)
Get all parents of a person
| Parameter | Type | Description |
|---|---|---|
| id | string | Person UUID |
[
{
"id": "parent-uuid",
"first": "John",
"middle": "William",
"last": "Doe",
"name": "John William Doe",
"birth": {
"date": "01/15/1950",
"place": "New York, NY"
},
"death": null,
"created_at": "2024-01-01T00:00:00.000Z"
}
]
Get all children of a person
| Parameter | Type | Description |
|---|---|---|
| id | string | Person UUID |
[
{
"id": "child-uuid",
"first": "Jane",
"middle": null,
"last": "Doe",
"name": "Jane Doe",
"birth": {
"date": "01/15/1980",
"place": "New York, NY"
},
"death": null,
"created_at": "2024-01-01T00:00:00.000Z"
}
]
Get all grandchildren of a person
Get all grandparents of a person
Get complete family tree starting from a person
{
"id": "uuid",
"first": "John",
"last": "Doe",
"birth": { "date": "01/15/1980" },
"children": [
{
"id": "child-uuid",
"first": "Jane",
"last": "Doe",
"birth": { "date": "01/15/2005" },
"children": []
}
],
"partners": [],
"siblings": [],
"parents": []
}
Get all connections or connections for a specific person
| Parameter | Type | Description |
|---|---|---|
| personId | string | Optional: Get connections for specific person |
[
{
"id": "uuid",
"from_person_id": "person1-uuid",
"to_person_id": "person2-uuid",
"connection_type": "partner",
"created_at": "2024-01-01T00:00:00.000Z"
}
]
Create a new connection between persons
| Field | Type | Required | Description |
|---|---|---|---|
| fromId | string | Yes | Source person ID |
| toId | string | Yes | Target person ID |
| type | string | Yes | Connection type (partner, parent, child, etc.) |
Delete a connection
| Parameter | Type | Description |
|---|---|---|
| id | string | Connection UUID |
Images are automatically processed when creating or updating persons:
/public/assets/img/ with original and small versionsUploaded images are accessible at:
JPG, PNG, GIF, WebP (automatically converted to JPG for consistency)