Skip to main content

Get All Contacts

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

HTTP Request

GET/api/contacts

Authorization

Authorization

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

Query Parameters

ParameterTypeDefaultDescription
limitintegerNumber of results to return per page.
offsetintegerNumber of results to skip before returning results.
searchstringSearch term to filter results by `id`, `subject`, `first_name`, `last_name`, `email`, and `mobile_number`.
orderingstringField to order results by (`id`, `created_at`, `updated_at`, `viewed`, `viewed_at`, `subject`)
is_viewedbooleanFilter by viewed status (`true` for viewed, `false` for not viewed).
viewed_datestringExact viewed date (`YYYY-MM-DD`).
viewed_date_fromstringStart date for contacts viewed after this date (`YYYY-MM-DD`).
viewed_date_tostringEnd date for contacts viewed before this date (`YYYY-MM-DD`).
has_messagebooleanFilter by contacts that have a message (`true` for contacts with a message, `false` for those without).
has_mobile_numberbooleanFilter by contacts that have a mobile number (`true` for contacts with a mobile number, `false` for those without).
has_emailbooleanFilter by contacts that have an email address (`true` for contacts with an email, `false` for those without).
has_first_namebooleanFilter by contacts that have a first name (`true` for contacts with a first name, `false` for those without).
has_last_namebooleanFilter by contacts that have a last name (`true` for contacts with a last name, `false` for those without).
id_minintegerMinimum ID of the contact.
id_maxintegerMaximum ID of the contact.
created_datestringExact creation date (`YYYY-MM-DD`).
updated_datestringExact last update date (`YYYY-MM-DD`).
created_fromstringStart date for contacts created after this date (`YYYY-MM-DD`).
updated_fromstringStart date for contacts updated after this date (`YYYY-MM-DD`).
created_tostringEnd date for contacts created before this date (`YYYY-MM-DD`).
updated_tostringEnd 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())

Status Codes

CodeDescription
200Contacts retrieved successfully
400Bad request — invalid parameters
401Unauthorized — authentication required
403Forbidden — insufficient permissions
500Internal server error

Response Fields

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