Skip to main content

List All Contacts

Retrieves a paginated list of all contacts messages with optional filtering, searching, and ordering.

HTTP Request​

GET/api/contacts/
NOTE: NOT USING THE TRAILING SLASH AT THE END OF THE URL RESULTS TO AN EXTRA REDIRECT WITH 301 STATUS

Authorization​

Authorization

  • Required: Yes
  • Permission: Staff with ContactPermission or Admin
  • Permission Code: 4002
  • Authentication: Token-based (Authorization: Token <your_api_key>)

Query Parameters​

ParameterTypeDefaultDescription
limitinteger—Number of results to return per page.
offsetinteger—Number of results to skip before returning results.
searchstring—Search term to lookup results by`id`, `subject`, `first_name`, `last_name`, `email`, and `mobile_number`.
orderingstring—Order results by (`id`, `created_at`, `updated_at`, `viewed`, `viewed_at`, `subject`)
is_viewedboolean—Filter by viewed status (`true` for viewed, `false` for not viewed).
viewed_datestring—Exact viewed date (`YYYY-MM-DD`).
viewed_date_fromstring—Start date for contacts viewed after this date (`YYYY-MM-DD`).
viewed_date_tostring—End date for contacts viewed before this date (`YYYY-MM-DD`).
has_messageboolean—Filter by contacts that have a message (`true` for contacts with a message, `false` for those without).
has_mobile_numberboolean—Filter by contacts that have a mobile number (`true` for contacts with a mobile number, `false` for those without).
has_emailboolean—Filter by contacts that have an email address (`true` for contacts with an email, `false` for those without).
has_first_nameboolean—Filter by contacts that have a first name (`true` for contacts with a first name, `false` for those without).
has_last_nameboolean—Filter by contacts that have a last name (`true` for contacts with a last name, `false` for those without).
id_mininteger—Minimum ID of the contact.
id_maxinteger—Maximum ID of the contact.
created_datestring—Exact creation date (`YYYY-MM-DD`).
updated_datestring—Exact last update date (`YYYY-MM-DD`).
created_fromstring—Start date for contacts created after this date (`YYYY-MM-DD`).
updated_fromstring—Start date for contacts updated after this date (`YYYY-MM-DD`).
created_tostring—End date for contacts created before this date (`YYYY-MM-DD`).
updated_tostring—End date for contacts updated before this date (`YYYY-MM-DD`).

Example Requests​

1import requests
2
3# List all contacts
4response = requests.get('http://www.example.com/api/contacts/',
5  headers={'Authorization': 'Token <your_api_key>'}
6)
7print(response.json())

Contact Object Structure​

FieldTypeDescription
countIntegerTotal number of categories
nextStringURL for the next page of results
previousStringURL for the previous page of results
resultsArray[Object]Array of Contact objects

Contact Object Data Structure

FieldTypeDescription
idIntegerUnique ID of the contact.
first_nameStringThe first name of the contact (nullable).
last_nameStringThe last name of the contact (nullable).
emailStringThe email address of the contact (nullable).
mobile_numberStringMobile number associated with the contact (nullable, valid iranian mobile number).
subjectStringThe subject of the contact.
messageStringThe message content of the contact (nullable).
viewedBooleanWhether the contact has been viewed.
viewed_atString (ISO 8601)Timestamp when the contact was viewed(nullable).
created_atString (ISO 8601)Timestamp when the contact was created.
updated_atString (ISO 8601)Timestamp when the contact was last updated.

Example Response​

{
"count": 16,
"next": "http://127.0.0.1:8000/api/contacts/?limit=3&offset=3",
"previous": null,
"results": [
{
"id": 16,
"first_name": "بهرام",
"last_name": "صادقی‌پور",
"email": null,
"mobile_number": "09492230370",
"subject": "Et necessitatibus molestiae est enim aliquam laborum.",
"message": "Dolores ullam qui quia sunt quo reiciendis. Ullam id omnis voluptas. Magni temporibus rerum. Et et et ut. Distinctio ipsam officiis quaerat. Accusantium eum ut adipisci et molestias nobis quos.",
"viewed": false,
"viewed_at": null,
"created_at": "2025-12-22T16:04:12.709202Z",
"updated_at": "2025-12-22T16:04:12.709209Z"
},
{
"id": 15,
"first_name": "بهرام",
"last_name": "احدی",
"email": null,
"mobile_number": "09739292354",
"subject": "Optio adipisci assumenda vel.",
"message": "default question",
"viewed": false,
"viewed_at": null,
"created_at": "2025-12-22T14:01:53.811903Z",
"updated_at": "2025-12-22T14:01:53.811909Z"
},
{
"id": 14,
"first_name": "پژمان",
"last_name": "فرهمند",
"email": null,
"mobile_number": "09683800286",
"subject": "Rerum voluptas voluptatem ullam et eum quis.",
"message": "hey",
"viewed": false,
"viewed_at": null,
"created_at": "2025-12-22T14:01:49.942276Z",
"updated_at": "2025-12-22T14:01:49.942282Z"
}
]
}