# Clearbit Combined API에서 마이그레이션

이 가이드는 Clearbit의 Combined API(`GET https://person.clearbit.com/v2/combined/find`)를 Tomba의 [`GET /v1/combined/find`](/api/enrichment#combined-api)에 매핑합니다. 이 엔드포인트는 이메일 주소에 대해 Clearbit 형식의 인물과 회사를 반환합니다. Clearbit의 동작은 2026-09-29에 [마지막으로 공개된 Clearbit API 참조](https://web.archive.org/web/20240909071651/https://dashboard.clearbit.com/docs)(2024년 9월)를 기준으로 확인했습니다.

## 시작하기 전에

- API 키(`ta_…`)와 시크릿 키(`ts_…`)를 발급받습니다. [인증](/authentication)을 참고합니다.
- 조회 비용은 [크레딧 비용](/usage-and-quotas#credit-costs)에서, 사용 중인 플랜의 스로틀링은 [플랜별 한도](/rate-limits#limits-by-plan)에서 확인합니다.
- 모든 Clearbit 엔드포인트에 공통으로 적용되는 변경 사항은 [Clearbit에서 마이그레이션](/migration/clearbit/introduction)에서 확인합니다.

## 엔드포인트 매핑

| Clearbit                                                         | Tomba                                              |
| ---------------------------------------------------------------- | -------------------------------------------------- |
| `GET https://person.clearbit.com/v2/combined/find?email=`        | `GET https://api.tomba.io/v1/combined/find?email=` |
| `GET https://person-stream.clearbit.com/v2/combined/find?email=` | `GET https://api.tomba.io/v1/combined/find?email=` |

## 인증 변경 사항

Clearbit은 키를 Basic 인증의 사용자 이름이나 Bearer 토큰으로 받습니다. Tomba에는 다음과 같이 `X-Tomba-Key`와 `X-Tomba-Secret` 헤더 두 개가 필요합니다.

```bash
# Clearbit
curl "https://person.clearbit.com/v2/combined/find?email=jane.doe@stripe.com" \
  -H "Authorization: Bearer $CLEARBIT_API_KEY"

# Tomba
curl "https://api.tomba.io/v1/combined/find?email=jane.doe@stripe.com" \
  -H "X-Tomba-Key: $TOMBA_API_KEY" \
  -H "X-Tomba-Secret: $TOMBA_SECRET_KEY"
```

Tomba API 키에는 만료 기한이 있습니다. [키 만료](/authentication#key-expiry)를 참고해 키 교체 일정을 계획합니다.

## 매개변수 매핑

| Clearbit                                                                                                              | Tomba         | 참고                                                                                                                                                      |
| --------------------------------------------------------------------------------------------------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `email`                                                                                                               | `email`       | 필수입니다.                                                                                                                                                  |
| `webhook_url`                                                                                                         | `webhook_url` | Tomba는 여전히 결과를 응답으로 반환하며, 인물을 찾은 경우 사본도 POST로 전송합니다. [요청별 콜백](/webhook#per-request-callbacks)을 참고합니다. |
| `webhook_id`                                                                                                          | 대응 항목 없음 |                                                                                                                                                            |
| `given_name`, `family_name`, `ip_address`, `location`, `company`, `company_domain`, `linkedin`, `twitter`, `facebook` | 대응 항목 없음 | Tomba는 이메일 주소로만 매칭합니다.                                                                                                                   |
| `subscribe`, `suppression`                                                                                            | 대응 항목 없음 |                                                                                                                                                            |
| `API-Version` 헤더                                                                                                  | 대응 항목 없음 |                                                                                                                                                            |

## 응답 필드 매핑

| Clearbit      | Tomba          | 참고                                                                                                                                     |
| ------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `person`      | `data.person`  | 항상 객체입니다. 해당 주소의 인물 정보가 Tomba에 없으면 응답 전체가 `not_found`가 됩니다. [오류 매핑](#error-mapping)을 참고합니다.       |
| `company`     | `data.company` | 인물의 도메인에 해당하는 회사 정보가 Tomba에 없으면 `null` 자체가 아니라 모든 필드가 `null`인 객체입니다. `data.company.domain`을 확인합니다. |
| 대응 항목 없음 | `meta.email`   | 조회한 주소입니다. 회사를 찾지 못한 경우 빈 문자열입니다.                                                                     |

`data.person`과 `data.company` 안의 필드는 Person 및 Company 가이드에 설명된 대로 매핑됩니다.

- [Person API 응답 필드](/migration/clearbit/person-api#response-field-mapping)
- [Company API 응답 필드](/migration/clearbit/company-api#response-field-mapping)

## 상태 매핑

Clearbit의 Combined API에는 전달 가능성 상태가 없습니다. Tomba는 해당 주소의 마지막 검증 `date`와 `status`를 담은 `data.person.verification`을 추가로 반환합니다. 상태는 [상태 값](/attributes/verifier#status-values)에 설명된 검증 엔드포인트의 값을 사용하며, 주소가 검증되지 않은 경우 `null`입니다. 대소문자를 구분하지 않고 비교합니다.

## 오류 매핑

| Clearbit                  | Tomba                                                                                                                                                     | 조치                                                                                                                                |
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `202` 조회 대기 중       | 반환되지 않음                                                                                                                                              | `202` 응답 시 재시도하는 로직을 제거합니다.                                                                                                          |
| `company`만 있는 `200` | `errors` 객체가 포함된 `200`: `type` `not_found`, `code` 404                                                                                             | Tomba에서는 인물 정보가 있어야 합니다. 그래도 회사 정보를 얻으려면 주소의 도메인으로 [`GET /v1/companies/find`](/api/enrichment#company-api)를 호출합니다. |
| `404` 둘 다 찾을 수 없음       | `errors` 객체가 포함된 `200`: `type` `not_found`, `code` 404                                                                                             | 상태 코드만이 아니라 본문의 `errors`도 확인합니다.                                                                                         |
| `422` 유효성 검사 오류    | 형식이 잘못된 주소에는 `422 params_invalid`를 반환합니다. 일회용 또는 웹메일 주소에는 `errors` 객체(`type` `params_invalid`, `code` 422)가 포함된 `200`을 반환합니다. | 업무용 주소를 보냅니다.                                                                                                                      |
| `401` 잘못된 API 키     | `400 authentication_failed`(누락 또는 형식 오류), `400 api_key_expired`, `401 authentication_failed`(잘못된 키 또는 시크릿 키)                              | 두 헤더를 모두 확인하고, 만료된 키는 [교체](/authentication#rotate-keys)합니다.                                                                 |
| `402` 할당량 초과          | `402 quota_exceeded`                                                                                                                                      | 사용 기간이 갱신될 때까지 기다리거나 크레딧을 추가합니다.                                                                                       |
| `429` 속도 제한          | `429 rate_limit`                                                                                                                                          | `Retry-After` 지연 시간이 지난 후 재시도합니다. [429 응답 처리](/rate-limits#handle-429-responses)를 참고합니다.                                       |
| 대응 항목 없음             | `451 claimed_email`                                                                                                                                       | 주소 소유자가 Tomba에 해당 주소의 처리 중단을 요청했습니다. 데이터에서 제거합니다.                                                     |
| `50X`                     | `500 api_error`                                                                                                                                           | 백오프를 적용해 재시도합니다.                                                                                                                       |

오류 응답은 크레딧을 소비하지 않습니다. 모든 유형은 [오류](/error-handling#error-types)에 나와 있습니다.

## 대량 작업 및 비동기 작업

Tomba는 모든 Combined 조회에 동기적으로 응답하므로 `202` 재시도를 제거합니다. `webhook_url` 콜백은 Clearbit의 `id`, `type`, `status` 래퍼 없이 응답과 같은 JSON을 전달하며, 서명되지 않습니다.

Combined 대량 작업 유형은 없습니다. 목록을 처리하려면 주소에 대해 `enrich` 작업을, 해당 도메인에 대해 `company` 작업을 실행합니다. [Email Enrichment](/bulks#email-enrichment)와 [Company Enrichment](/bulks#company-enrichment)를 참고합니다. 각 작업은 생성, 실행, 폴링을 거쳐 CSV로 다운로드합니다. [수명 주기](/bulks#lifecycle)를 참고합니다.

## 코드 예제

이 함수는 Combined API 조회를 대체하며, Clearbit의 `{person, company}` 형태를 반환합니다. Tomba에 회사 정보가 없으면 `company`는 `null`로 설정됩니다. Node.js 18 이상이 필요합니다.

```js title="find-combined.mjs"
const TOMBA_HEADERS = {
    "X-Tomba-Key": process.env.TOMBA_API_KEY,
    "X-Tomba-Secret": process.env.TOMBA_SECRET_KEY,
};

async function findCombined(email) {
    const url = new URL("https://api.tomba.io/v1/combined/find");
    url.searchParams.set("email", email);
    const res = await fetch(url, { headers: TOMBA_HEADERS });
    const body = await res.json();
    if (body.errors) {
        // No person found, or a disposable or webmail address: HTTP 200 with an errors object.
        if (res.ok) return { person: null, company: null };
        throw new Error(
            `${res.status} ${body.errors.type}: ${body.errors.message}`,
        );
    }
    const { person, company } = body.data;
    // Tomba returns an object with null fields when it has no company.
    return { person, company: company.domain ? company : null };
}

const { person, company } = await findCombined("jane.doe@stripe.com");
console.log(person?.name.fullName, company?.name ?? "no company");
```

## 전환 체크리스트

1. Tomba 키와 시크릿 키를 `TOMBA_API_KEY`와 `TOMBA_SECRET_KEY`로 저장하고, Basic 인증이나 Bearer 토큰 대신 `X-Tomba-Key`와 `X-Tomba-Secret`으로 보냅니다.
2. 이메일 주소만 사용해 `https://api.tomba.io/v1/combined/find`를 호출하고 `data.person`과 `data.company`를 읽습니다.
3. `errors` 객체가 포함된 `200` 응답은 찾지 못한 것으로 처리하고, `company`가 `null`인지 검사하는 대신 `data.company.domain`을 확인합니다.
4. 회사 정보만 있는 결과에 의존하던 곳에는 `/v1/companies/find`에 대한 대체 호출을 추가합니다.
5. [Person](/migration/clearbit/person-api) 및 [Company](/migration/clearbit/company-api) 가이드의 인물 및 회사 필드 변경 사항을 적용하고 `202` 재시도를 제거합니다.
6. `402`를 처리하고, `429`는 `Retry-After` 이후 재시도하며, `451`을 반환하는 주소는 제거합니다.
7. 프로덕션 트래픽을 전환하기 전에 같은 샘플 주소를 두 서비스에서 조회하고 사용하는 필드를 비교합니다.
