> 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.

Reference: https://developer.close.com/api/resources/contacts/create

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Close API
  version: 1.0.0
paths:
  /contact/:
    post:
      operationId: create
      summary: Create a new contact
      description: >-
        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.
      tags:
        - subpackage_contacts
      parameters:
        - name: _fields
          in: query
          description: Comma-separated list of fields to include in the response.
          required: false
          schema:
            type: string
        - name: Authorization
          in: header
          description: Use your API key as the username and leave the password empty.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Contact'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                description: Any type
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                description: Any type
        '404':
          description: Not found
          content:
            application/json:
              schema:
                description: Any type
      requestBody:
        content:
          application/json:
            schema:
              description: Any type
servers:
  - url: https://api.close.com/api/v1
components:
  schemas:
    ContactEmail:
      type: object
      properties:
        email:
          type: string
        is_unsubscribed:
          type: boolean
        type:
          type: string
      required:
        - email
        - is_unsubscribed
        - type
      title: ContactEmail
    RenderedIntegrationLink:
      type: object
      properties:
        name:
          type: string
        url:
          type: string
      required:
        - name
        - url
      title: RenderedIntegrationLink
    ContactPhone:
      type: object
      properties:
        country:
          type:
            - string
            - 'null'
        outbound_sms_blocked:
          type: boolean
        phone:
          type: string
        phone_formatted:
          type: string
        type:
          type: string
        tz_ids:
          type: array
          items:
            type: string
      required:
        - phone
        - type
      title: ContactPhone
    CallStatus:
      type: string
      enum:
        - created
        - in-progress
        - completed
        - cancel
        - no-answer
        - busy
        - failed
        - timeout
      description: Current status of the call.
      title: CallStatus
    ContactRecentCall:
      type: object
      properties:
        dialer_id:
          type:
            - string
            - 'null'
        duration:
          type: integer
        finish_timestamp:
          type: string
          format: date-time
        id:
          type: string
        status:
          $ref: '#/components/schemas/CallStatus'
      required:
        - dialer_id
        - duration
        - finish_timestamp
        - id
        - status
      title: ContactRecentCall
    WorkflowStatus:
      type: string
      enum:
        - active
        - paused
        - draft
      title: WorkflowStatus
    WorkflowRunStatus:
      type: string
      enum:
        - active
        - paused
        - finished
        - goal
        - error
      title: WorkflowRunStatus
    StatusReason:
      type: string
      enum:
        - manual
        - pending-call-timed-out
        - bulk-action
        - rate-limited
        - sequence-deleted
        - workflow-paused
        - filter-not-matched
        - 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
      description: Reason for each higher level status on a Workflow run.
      title: StatusReason
    BasicSubscriptionInfoForContact:
      type: object
      properties:
        contact_email:
          type:
            - string
            - 'null'
        date_created:
          type: string
          format: date-time
        initial_email_id:
          type:
            - string
            - 'null'
        sequence_id:
          type: string
        sequence_name:
          type: string
        sequence_status:
          $ref: '#/components/schemas/WorkflowStatus'
        start_date:
          type:
            - string
            - 'null'
          format: date-time
        subscription_id:
          type: string
        subscription_status:
          $ref: '#/components/schemas/WorkflowRunStatus'
        subscription_status_reason:
          oneOf:
            - $ref: '#/components/schemas/StatusReason'
            - type: 'null'
      required:
        - contact_email
        - date_created
        - initial_email_id
        - sequence_id
        - sequence_name
        - sequence_status
        - start_date
        - subscription_id
        - subscription_status
        - subscription_status_reason
      title: BasicSubscriptionInfoForContact
    ContactUrl:
      type: object
      properties:
        type:
          type: string
        url:
          type: string
      required:
        - type
        - url
      title: ContactUrl
    Contact:
      type: object
      properties:
        created_by:
          type:
            - string
            - 'null'
        date_created:
          type: string
          format: date-time
        date_updated:
          type: string
          format: date-time
        display_name:
          type: string
        emails:
          type: array
          items:
            $ref: '#/components/schemas/ContactEmail'
        id:
          type: string
        integration_links:
          type: array
          items:
            $ref: '#/components/schemas/RenderedIntegrationLink'
        lead_id:
          type:
            - string
            - 'null'
        lead_suggestions_operation_id:
          type:
            - string
            - 'null'
        name:
          type:
            - string
            - 'null'
        organization_id:
          type: string
        phones:
          type: array
          items:
            $ref: '#/components/schemas/ContactPhone'
        recent_calls:
          type: array
          items:
            $ref: '#/components/schemas/ContactRecentCall'
        subscriptions:
          type: array
          items:
            $ref: '#/components/schemas/BasicSubscriptionInfoForContact'
        timezone:
          type:
            - string
            - 'null'
        timezone_source:
          type:
            - string
            - 'null'
        title:
          type:
            - string
            - 'null'
        updated_by:
          type:
            - string
            - 'null'
        urls:
          type: array
          items:
            $ref: '#/components/schemas/ContactUrl'
      required:
        - created_by
        - date_created
        - date_updated
        - display_name
        - id
        - name
        - organization_id
        - title
        - updated_by
      title: Contact
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: basic
      description: Use your API key as the username and leave the password empty.
    OAuth2:
      type: http
      scheme: bearer

```

## SDK Code Examples

```python
import requests

url = "https://api.close.com/api/v1/contact/"

payload = {
    "custom.cf_j0P7kHmgFTZZnYBFtyPSZ3uQw4dpW8xKcW7Krps8atj": "Account Executive",
    "emails": [
        {
            "email": "john@example.com",
            "type": "office"
        }
    ],
    "lead_id": "lead_QyNaWw4fdSwxl5Mc5daMFf3Y27PpIcH0awPbC9l7uyo",
    "name": "John Smith",
    "phones": [
        {
            "phone": "9045551234",
            "type": "mobile"
        }
    ],
    "title": "President",
    "urls": [
        {
            "type": "url",
            "url": "http://twitter.com/google/"
        }
    ]
}
headers = {
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers, auth=("<CLOSE_API_KEY>", ""))

print(response.json())
```

```javascript
const url = 'https://api.close.com/api/v1/contact/';
const credentials = btoa("<CLOSE_API_KEY>:");

const options = {
  method: 'POST',
  headers: {Authorization: `Basic ${credentials}`, 'Content-Type': 'application/json'},
  body: '{"custom.cf_j0P7kHmgFTZZnYBFtyPSZ3uQw4dpW8xKcW7Krps8atj":"Account Executive","emails":[{"email":"john@example.com","type":"office"}],"lead_id":"lead_QyNaWw4fdSwxl5Mc5daMFf3Y27PpIcH0awPbC9l7uyo","name":"John Smith","phones":[{"phone":"9045551234","type":"mobile"}],"title":"President","urls":[{"type":"url","url":"http://twitter.com/google/"}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.close.com/api/v1/contact/"

	payload := strings.NewReader("{\n  \"custom.cf_j0P7kHmgFTZZnYBFtyPSZ3uQw4dpW8xKcW7Krps8atj\": \"Account Executive\",\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      \"type\": \"url\",\n      \"url\": \"http://twitter.com/google/\"\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.SetBasicAuth("<CLOSE_API_KEY>", "")
	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
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("<CLOSE_API_KEY>", "")
request["Content-Type"] = 'application/json'
request.body = "{\n  \"custom.cf_j0P7kHmgFTZZnYBFtyPSZ3uQw4dpW8xKcW7Krps8atj\": \"Account Executive\",\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      \"type\": \"url\",\n      \"url\": \"http://twitter.com/google/\"\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.close.com/api/v1/contact/")
  .basicAuth("<CLOSE_API_KEY>", "")
  .header("Content-Type", "application/json")
  .body("{\n  \"custom.cf_j0P7kHmgFTZZnYBFtyPSZ3uQw4dpW8xKcW7Krps8atj\": \"Account Executive\",\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      \"type\": \"url\",\n      \"url\": \"http://twitter.com/google/\"\n    }\n  ]\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.close.com/api/v1/contact/', [
  'body' => '{
  "custom.cf_j0P7kHmgFTZZnYBFtyPSZ3uQw4dpW8xKcW7Krps8atj": "Account Executive",
  "emails": [
    {
      "email": "john@example.com",
      "type": "office"
    }
  ],
  "lead_id": "lead_QyNaWw4fdSwxl5Mc5daMFf3Y27PpIcH0awPbC9l7uyo",
  "name": "John Smith",
  "phones": [
    {
      "phone": "9045551234",
      "type": "mobile"
    }
  ],
  "title": "President",
  "urls": [
    {
      "type": "url",
      "url": "http://twitter.com/google/"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
    'auth' => ['<CLOSE_API_KEY>', ''],
]);

echo $response->getBody();
```

```csharp
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://api.close.com/api/v1/contact/");
client.Authenticator = new HttpBasicAuthenticator("<CLOSE_API_KEY>", "");
var request = new RestRequest(Method.POST);

request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"custom.cf_j0P7kHmgFTZZnYBFtyPSZ3uQw4dpW8xKcW7Krps8atj\": \"Account Executive\",\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      \"type\": \"url\",\n      \"url\": \"http://twitter.com/google/\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```