1. Home
  2. Docs
  3. REST API
  4. Contact API
  5. POST Method

POST Method

The POST method is used to create new contacts inside Groundhogg.

In order to successfully create a contact you need to send a JSON body with a specific structure.

PARAMTYPEREQUIREDEXAMPLE
emailstringYesadmin@example.com
first_namestringnojohn
last_namestringnodoe
user_idintno1
owner_idintno1
optin_statusintno0 (unconfirmed)
metaarrayno{ “custom” : “data” }

You can add additional information to a contact by passing the meta parameter with an associative array of key value pairs.

Below are some reserved meta_keys which you can use to map data to fields in the contact record.

PARAMTYPEREQUIREDEXAMPLE
primary_phonestringno555-555-5555
primary_phone_extensionstringno1234
street_address_1 stringno25 Lesmill Rd.
street_address_2stringnoUnit D
city stringnoToronto
postal_zip stringnoM3B 2T3
country stringnoCA

Adding any non reserved key value pair will also be added to the meta and will appear in the custom meta section of the contact record.

An example JSON body for creating a new contact looks like the following.

{
    "contact": {
        "email": "email@example.com",
        "first_name": "Jhon",
        "last_name": "Doe",
        "user_id": "1",
        "owner_id": "1",
        "optin_status": "1",
        "meta": {
            "primary_phone": "1234567890",
            "primary_phone_extension": "5623",
            "street_address_1": "25 Lesmill Rd",
            "street_address_2": "Unit D",
            "city": "North York",
            "postal_zip": "M3B 2T3",
            "region": "Ontario",
            "country": "CA",
            "notes": "",
            "lead_source": "",
            "source_page": "",
            "custom_meta": "this is meta"
        }
    }
}

If this operation executed successfully with out any errors you receive following output.

{
    "code": "success",
    "message": "Contact Added successfully.",
    "contact_id": 5
}
Was this article helpful to you? Yes No

How can we help?