Add/Update Contact


The following endpoint can be used to add or update a contact within the Hyfin application.


Endpoint

The following endpoint can be used to add or update a contact. You must replace the {base_url} and {site_id} variable with the id of the customer that this contact belongs to.

POST
{base_url}/api/v4/site/{site_id}/contact/addUpdate

Request
Field
Type
Description
id
String
The id of the contact. This field is auto generated by the system and is not required when creating a new contact, but it is required when updating an existing contact.
firstName
String
The first name of the contact.
lastName
String
The last name of the contact.
displayName
String
The name that will be displayed for the contact. If left blank, it will default to the first and last name.
language
String
The preferred language for the contact. Uses ISO 639-1 language codes.
Default = `en`
emails
A list of email addresses for the contact.
phoneNumbers
A list of phone numbers for the contact.
addresses
A list of addresses for the contact.
Sample Request (Add a Contact)
			
{
  "first_name": "John",
  "last_name": "Doe",
  "display_name": "John Doe",
  "language": "en",
  "emails": [
    {
      "label": "work",
      "address": "johndoe@abc.com",
      "is_primary": true
    }
  ],
  "phone_numbers": [
    {
      "label": "mobile",
      "number": "333-444-5555",
      "is_primary": true
    }
  ],
  "addresses": [
    {
      "label": "billing",
      "is_primary": true,
      "address": {
        "address_line1": "123 Main Street",
        "address_line2": "Suite 123",
        "city": "Naples",
        "state_code": "FL",
        "zip_code": "34102"
      }
    }
  ]
}


		
Response
Field
Type
Description
success
Boolean
Whether the record was added or updated successfully.
action
String
Informs whether the record was added or updated. Will only be returned if `success` is `true`.
One of `added`, `updated`
_id
String
The auto generated id assigned to the record.
errors
String [ ]
A list of errors. Will only be returned if `success` is `false`.
Sample Response (Successful)
			
{
  "success": true,
  "action": "added",
  "_id": "60f720d248f143332af022e0"
}


		
Sample Response (Failed)
			
{
  "success": false,
  "errors": [
    "invalid field2",
    "missing field_name"
  ]
}