Contacts API
The Contacts API provides endpoints for managing contacts in Joomla.
Base URL
/api/index.php/v1/contact
Endpoints Overview
| Method | Endpoint | Description |
|---|---|---|
| GET | /contact | Retrieve all contacts |
| GET | /contact/{id} | Retrieve specific contact |
| POST | /contact | Create new contact |
| PATCH | /contact/{id} | Update contact |
| DELETE | /contact/{id} | Delete contact |
Retrieve all contacts
GET /api/index.php/v1/contact
Response
{
"data": [
{
"type": "contacts",
"id": "1",
"attributes": {
"name": "John Smith",
"alias": "john-smith",
"con_position": "Manager",
"address": "Main Street 1",
"suburb": "Amsterdam",
"state": "North Holland",
"country": "Netherlands",
"postcode": "1000 AA",
"telephone": "020-1234567",
"mobile": "06-12345678",
"email_to": "john@example.com",
"webpage": "https://example.com",
"published": 1,
"catid": 4
}
}
]
}
Retrieve specific contact
GET /api/index.php/v1/contact/{id}
Parameters
| Parameter | Type | Description |
|---|---|---|
| id | integer | Contact ID |
Example
curl -X GET "https://yoursite.com/api/index.php/v1/contact/1" \
-H "X-Joomla-Token: YOUR_API_TOKEN"
Create contact
POST /api/index.php/v1/contact
Request Body
{
"name": "Peter Johnson",
"alias": "peter-johnson",
"con_position": "Director",
"address": "Village Street 10",
"suburb": "Utrecht",
"telephone": "030-9876543",
"mobile": "06-98765432",
"email_to": "peter@example.com",
"webpage": "https://johnson.com",
"catid": 4,
"published": 1,
"access": 1,
"language": "*"
}
Required fields
| Field | Type | Description |
|---|---|---|
| name | string | Contact name |
| catid | int | Category ID |
Optional fields
| Field | Type | Default | Description |
|---|---|---|---|
| alias | string | auto | URL-friendly name |
| con_position | string | "" | Job position |
| address | string | "" | Address |
| suburb | string | "" | City |
| state | string | "" | Province/State |
| country | string | "" | Country |
| postcode | string | "" | Postal code |
| telephone | string | "" | Phone number |
| mobile | string | "" | Mobile number |
| fax | string | "" | Fax number |
| email_to | string | "" | Email address |
| webpage | string | "" | Website URL |
| published | int | 1 | Publication status |
| access | int | 1 | Access level |
| language | string | "*" | Language code |
Example
curl -X POST "https://yoursite.com/api/index.php/v1/contact" \
-H "X-Joomla-Token: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Peter Johnson",
"email_to": "peter@example.com",
"telephone": "030-9876543",
"catid": 4
}'
Update contact
PATCH /api/index.php/v1/contact/{id}
Request Body
{
"telephone": "030-1111111",
"email_to": "new@example.com"
}
Example
curl -X PATCH "https://yoursite.com/api/index.php/v1/contact/1" \
-H "X-Joomla-Token: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"telephone": "030-1111111"
}'
Delete contact
DELETE /api/index.php/v1/contact/{id}
Example
curl -X DELETE "https://yoursite.com/api/index.php/v1/contact/1" \
-H "X-Joomla-Token: YOUR_API_TOKEN"
Contact States
| Value | Status |
|---|---|
| -2 | Trash |
| 0 | Unpublished |
| 1 | Published |
| 2 | Archived |
Contact Categories
Contacts are organized in categories. The default is category ID 4.
Retrieve categories
GET /api/index.php/v1/contact/categories
Filtering
By category
GET /api/index.php/v1/contact?filter[catid]=4
By publication status
GET /api/index.php/v1/contact?filter[published]=1
Search
GET /api/index.php/v1/contact?filter[search]=john
Custom Fields
Contacts support custom fields. These are available via separate endpoints:
GET /api/index.php/v1/fields/contact/contact- Retrieve contact fieldsPOST /api/index.php/v1/fields/contact/contact- Create contact field