> ## Documentation Index
> Fetch the complete documentation index at: https://forward-amaranth-cod.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 리드 생성

> 리드를 생성합니다

### Header

<ParamField header="Authorization" type="string" required="true">
  Bearer 토큰을 포함한 인증 헤더입니다.
</ParamField>

### Body

<ParamField body="name" type="string" required="true">
  리드의 이름을 설정합니다.
</ParamField>

<ParamField body="price" type="string">
  리드의 금액을 설정합니다.
</ParamField>

<ParamField body="source" type="string">
  리드의 소스를 설정합니다. 딜/리드 데이터필드에서 소스의 선택리스트를 확인해주세요. 소스는 선택리스트 중 하나의 값으로만 설정 가능합니다. source 값을 전달하지 않는 경우 "직접 생성"으로 설정됩니다.
</ParamField>

<ParamField body="fieldList" type="json">
  리드의 이름, 금액, 소스를 제외한 필드값을 설정합니다.  세일즈맵 탭에서 \[회사 설정] - \[데이터 필드 관리]을 클릭하면 리드의 데이터 필드를 확인할 수 있습니다.

  name 에는 field 의 이름을 입력합니다.

  field 의 유형이 텍스트나 단일 선택인 경우에는 stringValue 에 값을 설정하고, field 의 유형이 숫자인 경우에는 numberValue 에 값을 설정하고, field 의 유형이 날짜인 경우에는 dateValue 에 값을 설정합니다.
</ParamField>

<ParamField body="peopleName" type="string">
  리드와 연결된 고객의 이름을 설정합니다. peopleName과 peopleEmail을 입력하는 경우 두 값이 모두 필요합니다.
</ParamField>

<ParamField body="peopleEmail" type="string">
  리드와 연결된 고객의 이메일을 설정합니다. 같은 이메일의 고객이 존재하는 경우 기존의 고객과 연결하고, 같은 이메일의 고객이 존재하지 않는 경우 새로운 고객을 생성하고 리드와 연결합니다.
</ParamField>

<ParamField body="peopleFieldList" type="json">
  리드와 연결된 고객의 이름과 이메일을 제외한 필드값을 설정합니다. 세일즈맵 탭에서 \[회사 설정] - \[데이터 필드 관리]을 클릭하면 고객의 데이터 필드를 확인할 수 있습니다.

  name 에는 field 의 이름을 입력합니다.

  field 의 유형이 텍스트나 단일 선택인 경우에는 stringValue 에 값을 설정하고, field 의 유형이 숫자인 경우에는 numberValue 에 값을 설정하고, field 의 유형이 날짜인 경우에는 dateValue 에 값을 설정합니다.
</ParamField>

<ParamField body="organizationName" type="string">
  리드와 연결된 회사의 이름을 설정합니다. 같은 이름의 회사가 존재하는 경우 기존의 회사와 연결하고, 같은 이름의 회사가 존재하지 않는 경우 새로운 회사를 생성하고 리드와 연결합니다.
</ParamField>

<ParamField body="organizationFieldList" type="json">
  리드와 연결된 회사의 이름을 제외한 필드값을 설정합니다. 세일즈맵 탭에서 \[회사 설정] - \[데이터 필드 관리]을 클릭하면 회사의 데이터 필드를 확인할 수 있습니다.

  name 에는 field 의 이름을 입력합니다.

  field 의 유형이 텍스트나 단일 선택인 경우에는 stringValue 에 값을 설정하고, field 의 유형이 숫자인 경우에는 numberValue 에 값을 설정하고, field 의 유형이 날짜인 경우에는 dateValue 에 값을 설정합니다.
</ParamField>

### Response

<ResponseField name="success" type="boolean">
  요청을 성공적으로 완료한 경우 true, 실패한 경우 false 입니다.
</ResponseField>

<ResponseField name="data" type="object">
  생성한 리드 정보입니다.

  <Expandable title="리드 정보 데이터">
    <ResponseField name="id" type="string">
      리드의 고유 id 입니다. 리드를 생성할 때 사용합니다.
    </ResponseField>

    <ResponseField name="name" type="string">
      생성한 리드의 이름입니다.
    </ResponseField>

    <ResponseField name="price" type="string">
      생성한 리드의 금액입니다.
    </ResponseField>

    <ResponseField name="source" type="string">
      생성한 리드의 소스입니다.
    </ResponseField>

    <ResponseField name="people" type="string">
      생성한 리드의 고객 정보입니다.
    </ResponseField>

    <ResponseField name="organization" type="string">
      생성한 리드의 회사 정보입니다.
    </ResponseField>

    <ResponseField name="createdAt" type="date">
      리드가 생성된 날짜입니다.
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash Example Request
  curl --location 'https://salesmap.kr/api/v1/lead' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <token>' \
  --data '{
    "name":"Example_Lead",
    "price":50000,
    "source":"직접 생성",
    "fieldList": [
      {"name":"수주 예정일", "dateValue":"2024-01-01"}
    ],
    "peopleName":"Exmaple_People",
    "peopleEmail":"exmaple@exmaple.com",
    "peopleFieldList": [
      {"name":"포지션", "stringValue":"CEO"}
    ],
    "organizationName":"Example_Organization",
    "organizationFieldList": [
      {"name":"주소", "stringValue":"서울시 강남구"},
      {"name":"직원수", "numberValue":"15"},
    ]
  }'
  '
  ```
</RequestExample>

<ResponseExample>
  ```json Response
  {
    "success": true,
    "data": {
      "id": "644218b950e381db28bc486f",
      "name": "Example_Lead",
      "price": 50000,
      "people": {
        "id": "644215c250e381db28bc4704",
        "name": "Exmaple_People",
        "email": "exmaple@exmaple.com",
        "phoneNumber": "01011112222"
      },
      "organization": {
        "id": "644215a350e381db28bc467f",
        "name": "Example_Organization"
      },
      "createdAt": "2023-04-21T05:01:45.939Z"
    }
  }
  ```
</ResponseExample>
