API Documentation

API

Robert Moore avatar
Written by Robert Moore
Updated over a week ago

API Documentation

You can connect thousands of other applications to CLOSEM using our API links shown on this page. You must be logged in to your CLOSEM account. Once logged in, this page will automatically populate with your unique content, including your Base URL, contacts lists and tags as shown below. You can use these links to tie a form on your website to CLOSEM, or use Zapier to link with thousands of other applications.

NOTE: If you hover over any of the accepted field names, you'll see a green +; click on that to copy the field name to your clipboard.

Base URL

A POST request must be sent to your company's base URL

API KEY

data shown here

BASE URL

data shown here

CURL EXAMPLE

curl --location --request POST 'https://app.closem.ai/?m=api&auth=' \

HTML FORM EXAMPLE

<form action="https://app.closem.ai/?m=api&auth= method="POST"/>

Required Parameter - Request Mode

The mode parameter is required with every request. This parameter lets you specify what action you want to be taken, such as adding a contact, starting a sequence, or scheduling an appointment.

Accepted modes: addcontact, runsequence, scheduleappointment, import

CURL FORM EXAMPLE

--form 'mode=addcontact' \

HTML FORM EXAMPLE

<input type="hidden" name="mode" value="addcontact">

You can view the documentation for each mode below.

Mode - Add Contact

Show/Hide Documentation

Use this API call to add a new Customers (and optionally run one a specified sequence on the newly added Customers).

The mode parameter must be set to addcontact.

Required Parameters

Phone and/or email is required to add a Customers.

Phone Number

Accepted field names you can use for a phone number: phone, phonenumber, number, or phone_number

CURL FORM EXAMPLE

--form 'phone=9999999998' \

HTML FORM EXAMPLE

<input type="tel" name="phone" value="9999999998">

Email Address

Accepted field names you can use for an email: email, mail, emailaddress, or email_address

CURL FORM EXAMPLE

HTML FORM EXAMPLE

<input type="email" name="email" value="[email protected]">

Optional Parameters

Email is optional if phone is provided. Phone is optional if email is provided.

Full Name

Accepted field names you can use for a Customers's full name: fullname, name, or full_name

First and last name must be seperated by a space.

Will still work if only the first name is passed e.g. fullname:John

CURL FORM EXAMPLE

--form 'fullname=John Doe' \

HTML FORM EXAMPLE

<input type="text" name="fullname" value="John Doe">

First Name

Accepted field names you can use for a Customers's first name: firstname, first, or first_name

Field is ignored if full name is passed.

CURL FORM EXAMPLE

--form 'firstname=John' \

HTML FORM EXAMPLE

<input type="text" name="firstname" value="John">

Last Name

Accepted field names you can use for a Customers's last name: lastname, last, or last_name

Field is ignored if full name is passed.

CURL FORM EXAMPLE

--form 'lastname=Doe' \

HTML FORM EXAMPLE

<input type="text" name="lastname" value="Doe">

Notes

Accepted field names you can use for Customers notes: notes, or note

CURL FORM EXAMPLE

--form 'notes=Example Customers note' \

HTML FORM EXAMPLE

<input type="text" name="notes" value="Example Customers note">

Address 1

Accepted field names you can use for Customers address 1: address, address1, address_1

CURL FORM EXAMPLE

--form 'address1=123 Testing Street' \

HTML FORM EXAMPLE

<input type="text" name="address1" value="123 Testing Street">

City

Accepted field names you can use for Customers city: city

CURL FORM EXAMPLE

--form 'city=Example Customers city' \

HTML FORM EXAMPLE

<input type="text" name="city" value="Example Customers city">

State

Accepted field names you can use for Customers state: state

CURL FORM EXAMPLE

--form 'state=CA' \

HTML FORM EXAMPLE

<input type="text" name="state" value="California">

ZIP

Accepted field names you can use for Customers ZIP: zip, zip_code, or zipcode

CURL FORM EXAMPLE

--form 'zip=99999' \

HTML FORM EXAMPLE

<input type="text" name="zip" value="99999">

Country

Country codes are required for postal mail, and must be standard 2-letter codes as shown here: ISO 3166 alpha-2
2-letter country code i.e. US, CA, UK, etc.

Accepted field names you can use for Customers country: country

CURL FORM EXAMPLE

--form 'country=US' \

HTML FORM EXAMPLE

<input type="text" name="country" value="US">

Custom Merge Tag Labels

Accepted field names you can use for Customers labels: label_1 label1 label_2 label2 label_3 label3 label_4 label4

(These correspond to custom merge-tags {CONTACT_LABEL1}, {CONTACT_LABEL2}, etc.

CURL FORM EXAMPLE

--form 'label1=Test data' \

HTML FORM EXAMPLE

<input type="text" name="label1" value="Test data">

Tag(s)

Accepted field names you can use for adding tag(s) to imported Customers: tags, or tag

If assigning more than one tag, the tag IDs must be seperated by commas.

CURL FORM EXAMPLE

--form 'tags=42,57' \

HTML FORM EXAMPLE

<input type="text" name="tags" value="42,57">

TAG ID GENERATOR TOOL

Select the tags you would like to apply when a contact is added using this API. It will generate the list of tag IDs for your POST request.

Tag IDs will show up here

Contact List(s)

Accepted field names you can use for adding contact list(s) to imported Customers: contactlists, contactlist, contact_lists, or contact_list

If assigning more than one contact list, the contact list IDs must be seperated by commas.

CURL FORM EXAMPLE

--form 'contactlists=18,32' \

HTML FORM EXAMPLE

<input type="text" name="contactlists" value="18,32">

CONTACT LIST ID GENERATOR TOOL

Select the contact lists you would like to apply when a contact is added using this API. It will generate the list of contact list IDs for your POST request.

RESULT

Contact list IDs will show up here

Campaign

Accepted field name for campaign ID to copy and run after importing the Customers: sequence_id.

You can only send one sequence (campaign) ID.

CURL FORM EXAMPLE

--form 'sequence_id=99' \

HTML FORM EXAMPLE

<input type="text" name="sequence_id" value="99">

SEQUENCE ID GENERATOR TOOL

Use this tool to find the ID of the sequence you would like to CLONE & RUN when a Customers is added using the Add Contact API.

RESULT

Sequence ID will show up here

Mode - Schedule Appointment

Show/Hide Documentation

Use this API call to start a sequence on one or more Customers, identified by either their email, phone, or contact list.

The mode parameter must be set to scheduleappointment.

Required Parameters

Appointment Note and Appointment Timestamp is required, and one (or more) of the following parameters is also required: contact_emails, contact_phones, contact_lists, or tags.

Appointment Note

Accepted field name you can use for appointment note: appointment_note

CURL FORM EXAMPLE

--form 'appointment_note=Virtural Training Seminar' \

Appointment Timestamp

Accepted field name you can use for appointment timestamp: appointment_timestamp

This is when the appointment is scheduled for. This must be a time in the future (not the past!).

Additionally, you have one of two choices for this parameter:

1. You may send a UNIX timestamp (link to converter)

2. You may send a datetime string in one of the following format ONLY (AM/PM interchangable):

MM/DD/YY HH:MM AM

MM/DD/YYYY HH:MM PM

If you provide a datetime string, it will be assumed to be the same timezone as your companies CLOSEM timezone!

CURL FORM EXAMPLE

--form 'appointment_timestamp=04/01/2022 12:30 PM' \

Contact Email(s)

Accepted field name you can use for contact email(s): contact_emails

If providing more than one contact email, the contact emails must be seperated by commas. This parameter is optional if contact phones, contact lists, or tags are specified.

CURL FORM EXAMPLE

Contact Phone(s)

Accepted field name you can use for contact phone number(s): contact_phones

If providing more than one contact phone number, they must be seperated by commas. This parameter is optional if contact emails, contact lists, or tags are specified.

Accepted formats for phone number are: (555) 444-3333, 5554443333, +15554443333, 15554443333 , 555-444-3333, 1-555-444-3333

CURL FORM EXAMPLE

--form 'contact_phones=+15554443333,777-888-9999' \

Contact List(s)

Accepted field names are: contactlists, contactlist, contact_lists, or contact_list

All contacts belonging to the contact list(s) will get the scheduled appointment.

If assigning more than one contact list, the contact list IDs must be seperated by commas. This parameter is optional if contact phones, contact emails, or tags are specified.

TIP: You can use the Contact List ID generator tool from the Add Contact mode in order to get contact list IDs.

CURL FORM EXAMPLE

--form 'contactlists=18,32' \

Tag(s)

Accepted field names are: tags, or tag

All contacts belonging to the tag(s) will get the scheduled appointment.

If specifying more than one tag, the tag IDs must be seperated by commas. This parameter is optional if contact emails, contact phones, or contact lists are specified.

TIP: You can use the Tags ID generator tool from the Add Contact mode in order to get tag IDs.

CURL FORM EXAMPLE

--form 'tags=42,57' \

Mode - Import Contacts

Show/Hide Documentation

Use this API call to save a list of new contacts, or update existing ones.

The mode parameter must be set to import.

The content must be in the body of the request in JSON format.

JSON Body

For every new contact, the email or the phone_number must be provided.

{ "user_id": "string", // (Optional) the user id of the assigned user to this contact "sequence_id": "string", // (Optional) clone and start a sequence with this id "contact_lists": "string", // (Optional) csv list of contact list ids "tags": "string", // (Optional) csv list of tag ids "contacts": [ { "email_address": "string", "phone_number": "string", "full_name": "string", "first_name": "string", "last_name": "string", "notes": "string", "address": "string", "city": "string", "state": "string", "country": "string", "zip": "string", "label_1": "string", // custom label "label_2": "string", // custom label "label_3": "string", // custom label "label_4": "string", // custom label "custom_fields": { "fieldId": "fieldValue", ...etc } }, ...etc ] }

Mode - Export

Show/Hide Documentation

Use this API call to get data about Contacts, Contacts Lists or Campaings, using custom filters.

The mode parameter must be set to export.

The content must be in the body of the request in JSON format.

Datetimes must be in ISO 8601 format or timestamp.

For Contacts

{ "model": "contact", "filters": { // All filters are optional, if none provided then all contacts will be returned "contact_id": "1,2,3", "contacts_list_id": "1,2,3", "campaign_id": "1,2,3", "created_after": "2022-06-01T00:00:00", "created_before": "2022-06-01T00:00:00", "email_unsubscribed": true, "text_unsubscribed": true, "has_appointment": true, "clicked_email": true }, "limit": 100 // (Optional) limit the number of results returned }

For Contacts Lists

{ "model": "contactslist", "filters": { // All filters are optional, if none provided then all lists will be returned "contacts_list_id": "1,2,3", "with_contacts": true, // (Optional) if true, the list will include the contacts in the list }, }

For Campaigns

{ "model": "campaign", "filters": { // All filters are optional, if none provided then all campaings will be returned "campaign_id": "1,2,3", "campaign_status":"created,started,queued,failed,processing,insufficient credit,pending cancel,limit reached,finished", "scheduled_after": "2022-06-01T00:00:00", "scheduled_before": "2022-06-01T00:00:00", "send_after": "2022-06-01T00:00:00", "send_before": "2022-06-01T00:00:00", "with_contacts": true, // (Optional) if true, the list will include the contacts in the list }, }

For Tags

{ "model": "tag" }

For Employees

{ "model": "employee" }

Did this answer your question?