> For a complete page index, fetch https://developer.close.com/llms.txt # Create a new contact POST https://api.close.com/api/v1/contact/ Content-Type: application/json Contacts belong to exactly one Lead (specified by `lead_id`). If you do not provide a `lead_id` then a new lead will be created, named after the contact. Custom field values can be set by including `custom.cf_*` keys in the request body, e.g. `"custom.cf_abc123": "value"`. Reference: https://developer.close.com/api/resources/contacts/create ## Authentication - `Authorization` header (basic auth, required) — Use your API key as the username and leave the password empty. - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Query parameters - `_fields` (string, optional) — Comma-separated list of fields to include in the response. ### Body (application/json) This endpoint expects a CreateContact. - `created_by` (string, optional, nullable) - `date_created` (datetime, optional, nullable) - `emails` (list of CreateContactEmailsItems, optional, nullable) - `lead_id` (string, optional, nullable) - `name` (string, optional, nullable) - `phones` (list of CreateContactPhonesItems, optional, nullable) - `timezone` (string, optional, nullable) — IANA timezone identifier - `title` (string, optional, nullable) - `urls` (list of CreateContactUrlsItems, optional, nullable) ## Response ### 200 Successful response - `created_by` (string, required, nullable) - `date_created` (datetime, required) - `date_updated` (datetime, required) - `display_name` (string, required) - `id` (string, required) - `name` (string, required, nullable) - `organization_id` (string, required) - `title` (string, required, nullable) - `updated_by` (string, required, nullable) - `emails` (list of ContactEmail, optional) - `integration_links` (list of RenderedIntegrationLink, optional) - `lead_id` (string, optional, nullable) - `lead_suggestions_operation_id` (string, optional, nullable) - `phones` (list of ContactPhone, optional) - `recent_calls` (list of ContactRecentCall, optional) - `subscriptions` (list of BasicSubscriptionInfoForContact, optional) - `timezone` (string, optional, nullable) - `timezone_source` (string, optional, nullable) - `urls` (list of ContactUrl, optional) ## Errors ### 400 Bad Request Error Bad request - `any` ### 401 Unauthorized Error Unauthorized - `any` ### 404 Not Found Error Not found - `any` ## Types ### CreateContactEmailsItems - `email` (string, required) - `type` (string, optional) ### CreateContactPhonesItems - `phone` (string, optional, nullable) — Phone number in E.164 format - `type` (string, optional) ### CreateContactUrlsItems - `url` (string, required) - `type` (string, optional) ### ContactEmail - `email` (string, required) - `is_unsubscribed` (boolean, required) - `type` (string, required) ### RenderedIntegrationLink - `name` (string, required) - `url` (string, required) ### ContactPhone - `phone` (string, required) - `type` (string, required) - `country` (string, optional, nullable) - `outbound_sms_blocked` (boolean, optional) - `phone_formatted` (string, optional) - `tz_ids` (list of string, optional) ### ContactRecentCall - `dialer_id` (string, required, nullable) - `duration` (integer, required) - `finish_timestamp` (datetime, required) - `id` (string, required) - `status` (enum, required) — Current status of the call. - Allowed values: `created`, `in-progress`, `completed`, `cancel`, `no-answer`, `busy`, `failed`, `timeout` ### BasicSubscriptionInfoForContact - `contact_email` (string, required, nullable) - `date_created` (datetime, required) - `initial_email_id` (string, required, nullable) - `sequence_id` (string, required) - `sequence_name` (string, required) - `sequence_status` (enum, required) - Allowed values: `active`, `paused`, `draft` - `start_date` (datetime, required, nullable) - `subscription_id` (string, required) - `subscription_status` (enum, required) - Allowed values: `active`, `paused`, `finished`, `goal`, `error` - `subscription_status_reason` (enum, required, nullable) — Reason for each higher level status on a Workflow run. - Allowed values: `manual`, `pending-call-timed-out`, `bulk-action`, `rate-limited`, `sequence-deleted`, `workflow-paused`, `filter-not-matched`, `insufficient-ai-credit-balance`, `plan-not-supported`, `reply-received`, `call-answered`, `meeting-booked`, `lead-status-changed`, `outcome-met`, `account-invalid`, `account-failures`, `sending-throttled-too-long`, `membership-inactive`, `send-as-error`, `email-bounced`, `call-failed`, `sms-failed`, `no-user-phone`, `billing-error`, `assignment-field-invalid`, `lead-status-field-invalid`, `assignees-missing`, `run-as-disabled`, `lead-not-visible`, `internal-error`, `field-mapping-error`, `filter-config-invalid`, `email-ai-generation-failed` ### ContactUrl - `type` (string, required) - `url` (string, required) ## Examples **Request** ```json { "emails": [ { "email": "john@example.com", "type": "office" } ], "lead_id": "lead_QyNaWw4fdSwxl5Mc5daMFf3Y27PpIcH0awPbC9l7uyo", "name": "John Smith", "phones": [ { "phone": "9045551234", "type": "mobile" } ], "title": "President", "urls": [ { "url": "http://twitter.com/google/", "type": "url" } ], "custom.cf_j0P7kHmgFTZZnYBFtyPSZ3uQw4dpW8xKcW7Krps8atj": "Account Executive" } ``` **Response** ```json { "created_by": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA", "date_created": "2013-03-07T23:23:21.495000+00:00", "date_updated": "2013-03-07T23:23:21.495000+00:00", "display_name": "John Smith", "id": "cont_sNIdBgngvbdTTEN1mspKgUqKAWfbul4IITvnWoRw1T7", "name": "John Smith", "organization_id": "orga_RbREgmiiwcr1w2b4cOnCMQaQPSIFxMqAD2Dh243uxcH", "title": "President", "updated_by": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA", "emails": [ { "email": "john@example.com", "is_unsubscribed": false, "type": "office" } ], "phones": [ { "phone": "+19045551234", "type": "mobile", "country": "US", "phone_formatted": "+1 904-555-1234" } ], "urls": [ { "type": "url", "url": "http://twitter.com/google/" } ], "custom.cf_j0P7kHmgFTZZnYBFtyPSZ3uQw4dpW8xKcW7Krps8atj": "Account Executive" } ``` **SDK Code** ```python contacts_create_example import requests url = "https://api.close.com/api/v1/contact/" payload = { "emails": [ { "email": "john@example.com", "type": "office" } ], "lead_id": "lead_QyNaWw4fdSwxl5Mc5daMFf3Y27PpIcH0awPbC9l7uyo", "name": "John Smith", "phones": [ { "phone": "9045551234", "type": "mobile" } ], "title": "President", "urls": [ { "url": "http://twitter.com/google/", "type": "url" } ], "custom.cf_j0P7kHmgFTZZnYBFtyPSZ3uQw4dpW8xKcW7Krps8atj": "Account Executive" } headers = { "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers, auth=("", "")) print(response.json()) ``` ```javascript contacts_create_example const url = 'https://api.close.com/api/v1/contact/'; const credentials = btoa(":"); const options = { method: 'POST', headers: {Authorization: `Basic ${credentials}`, 'Content-Type': 'application/json'}, body: '{"emails":[{"email":"john@example.com","type":"office"}],"lead_id":"lead_QyNaWw4fdSwxl5Mc5daMFf3Y27PpIcH0awPbC9l7uyo","name":"John Smith","phones":[{"phone":"9045551234","type":"mobile"}],"title":"President","urls":[{"url":"http://twitter.com/google/","type":"url"}],"custom.cf_j0P7kHmgFTZZnYBFtyPSZ3uQw4dpW8xKcW7Krps8atj":"Account Executive"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go contacts_create_example package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.close.com/api/v1/contact/" payload := strings.NewReader("{\n \"emails\": [\n {\n \"email\": \"john@example.com\",\n \"type\": \"office\"\n }\n ],\n \"lead_id\": \"lead_QyNaWw4fdSwxl5Mc5daMFf3Y27PpIcH0awPbC9l7uyo\",\n \"name\": \"John Smith\",\n \"phones\": [\n {\n \"phone\": \"9045551234\",\n \"type\": \"mobile\"\n }\n ],\n \"title\": \"President\",\n \"urls\": [\n {\n \"url\": \"http://twitter.com/google/\",\n \"type\": \"url\"\n }\n ],\n \"custom.cf_j0P7kHmgFTZZnYBFtyPSZ3uQw4dpW8xKcW7Krps8atj\": \"Account Executive\"\n}") req, _ := http.NewRequest("POST", url, payload) req.SetBasicAuth("", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby contacts_create_example require 'uri' require 'net/http' url = URI("https://api.close.com/api/v1/contact/") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request.basic_auth("", "") request["Content-Type"] = 'application/json' request.body = "{\n \"emails\": [\n {\n \"email\": \"john@example.com\",\n \"type\": \"office\"\n }\n ],\n \"lead_id\": \"lead_QyNaWw4fdSwxl5Mc5daMFf3Y27PpIcH0awPbC9l7uyo\",\n \"name\": \"John Smith\",\n \"phones\": [\n {\n \"phone\": \"9045551234\",\n \"type\": \"mobile\"\n }\n ],\n \"title\": \"President\",\n \"urls\": [\n {\n \"url\": \"http://twitter.com/google/\",\n \"type\": \"url\"\n }\n ],\n \"custom.cf_j0P7kHmgFTZZnYBFtyPSZ3uQw4dpW8xKcW7Krps8atj\": \"Account Executive\"\n}" response = http.request(request) puts response.read_body ``` ```java contacts_create_example import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.close.com/api/v1/contact/") .basicAuth("", "") .header("Content-Type", "application/json") .body("{\n \"emails\": [\n {\n \"email\": \"john@example.com\",\n \"type\": \"office\"\n }\n ],\n \"lead_id\": \"lead_QyNaWw4fdSwxl5Mc5daMFf3Y27PpIcH0awPbC9l7uyo\",\n \"name\": \"John Smith\",\n \"phones\": [\n {\n \"phone\": \"9045551234\",\n \"type\": \"mobile\"\n }\n ],\n \"title\": \"President\",\n \"urls\": [\n {\n \"url\": \"http://twitter.com/google/\",\n \"type\": \"url\"\n }\n ],\n \"custom.cf_j0P7kHmgFTZZnYBFtyPSZ3uQw4dpW8xKcW7Krps8atj\": \"Account Executive\"\n}") .asString(); ``` ```php contacts_create_example request('POST', 'https://api.close.com/api/v1/contact/', [ 'body' => '{ "emails": [ { "email": "john@example.com", "type": "office" } ], "lead_id": "lead_QyNaWw4fdSwxl5Mc5daMFf3Y27PpIcH0awPbC9l7uyo", "name": "John Smith", "phones": [ { "phone": "9045551234", "type": "mobile" } ], "title": "President", "urls": [ { "url": "http://twitter.com/google/", "type": "url" } ], "custom.cf_j0P7kHmgFTZZnYBFtyPSZ3uQw4dpW8xKcW7Krps8atj": "Account Executive" }', 'headers' => [ 'Content-Type' => 'application/json', ], 'auth' => ['', ''], ]); echo $response->getBody(); ``` ```csharp contacts_create_example using RestSharp; using RestSharp.Authenticators; var client = new RestClient("https://api.close.com/api/v1/contact/"); client.Authenticator = new HttpBasicAuthenticator("", ""); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"emails\": [\n {\n \"email\": \"john@example.com\",\n \"type\": \"office\"\n }\n ],\n \"lead_id\": \"lead_QyNaWw4fdSwxl5Mc5daMFf3Y27PpIcH0awPbC9l7uyo\",\n \"name\": \"John Smith\",\n \"phones\": [\n {\n \"phone\": \"9045551234\",\n \"type\": \"mobile\"\n }\n ],\n \"title\": \"President\",\n \"urls\": [\n {\n \"url\": \"http://twitter.com/google/\",\n \"type\": \"url\"\n }\n ],\n \"custom.cf_j0P7kHmgFTZZnYBFtyPSZ3uQw4dpW8xKcW7Krps8atj\": \"Account Executive\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ```