Skip to main content

Create Contact

Create a new contact.

HTTP Request

POST/api/contacts/
NOTE: NOT USING THE TRAILING SLASH AT THE END OF THE URL RESULTS TO A 500 SERVER ERROR

Authorization

Authorization

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

Request Body

FieldTypeRequiredDescription
subjectStringYesThe subject of the contact.
messageStringNoThe message content of the contact.
first_nameStringNoThe first name of the contact.
last_nameStringNoThe last name of the contact.
emailStringNoThe email address of the contact.
mobile_numberStringNoMobile number associated with the contact.

Example Requests

1import requests
2api = requests.Session()
3api.headers.update({'Authorization': 'Token XXXXXXXXXXXXXXXXXXXXXX'})
4response = api.post('http://www.example.com/api/contacts/', json={
5  subject: "New Contact",
6  message: "Hello, this is a test contact.",
7  first_name: "John",
8  last_name: "Doe",
9  email: "john.doe@example.com",
10  mobile_number: "+1234567890"
11})
12print(response.json())

Response Fields

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

{
"id": 17,
"first_name": "تورج",
"last_name": "دانشور",
"email": "Tyree82@hotmail.com",
"mobile_number": "09232362073",
"subject": "Internal",
"message": "Sed ex quae quas occaecati porro. Pariatur doloremque quia assumenda et sunt autem aut fugiat consectetur. Aspernatur quasi sit. Voluptas sunt asperiores.",
"viewed": false,
"viewed_at": null,
"created_at": "2025-12-28T13:47:13.666977Z",
"updated_at": "2025-12-28T13:47:13.666983Z"
}