API

관계 유형 생성

작성일 2026.04.23 | 수정일 2026.04.29

POST/crm-core/v1/relationships/types

새 관계 유형을 생성합니다. 동일 계정 내 (name, sourceEntityId, targetEntityId) 조합은 고유 인덱스가 적용되어 중복 시 409 Conflict가 반환됩니다. 요금제 relationshipTypes.maxPerEntity 한도가 적용됩니다. MEMBER 이상 권한 필요.

Body Params

NameTypeRequiredDescription
namestring*관계 유형 이름 (예: 소속사)
sourceEntityIdstring*소스 개체 ID
targetEntityIdstring*대상 개체 ID
sourceLabelstring소스 방향 레이블 (예: 직원)
targetLabelstring대상 방향 레이블 (예: 회사)
descriptionstring관계 유형 설명

Response

NameTypeRequiredDescription
relationshipTypeIdstring*생성된 관계 유형 ID (CRMRT1...)
accountIdstring*계정 ID
workspaceIdstring | null워크스페이스 ID
namestring*관계 유형 이름
sourceEntityIdstring*소스 개체 ID
targetEntityIdstring*대상 개체 ID
sourceLabelstring소스 레이블
targetLabelstring대상 레이블
descriptionstring설명
dateCreateddate*생성 시각
dateUpdateddate*수정 시각

Structure

코드 예제

const crypto = require('crypto');

const apiKey = 'NCSXXXXXXXXXXXXX';
const apiSecret = 'YOUR_API_SECRET';
const dateTime = new Date().toISOString();
const salt = crypto.randomBytes(16).toString('hex');
const signature = crypto.createHmac('sha256', apiSecret).update(dateTime + salt).digest('hex');
const authHeader = HMAC-SHA256 apiKey=${apiKey}, date=${dateTime}, salt=${salt}, signature=${signature};

const response = await fetch('https://api.solapi.com/crm-core/v1/relationships/types', {
method: 'POST',
headers: { 'Authorization': authHeader, 'Content-Type': 'application/json' },
body: JSON.stringify({
"name": "소속사",
"sourceEntityId": "CRMET1260423081530123EMP11122233",
"targetEntityId": "CRMET1260423081530124COM11122234",
"sourceLabel": "직원",
"targetLabel": "회사",
"description": "직원과 소속 회사의 관계"
})
});
const data = await response.json();

import hmac, hashlib, secrets, requests
from datetime import datetime, timezone

api_key = 'NCSXXXXXXXXXXXXX'
api_secret = 'YOUR_API_SECRET'
date_time = datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ')
salt = secrets.token_hex(16)
signature = hmac.new(api_secret.encode(), (date_time + salt).encode(), hashlib.sha256).hexdigest()
auth_header = f'HMAC-SHA256 apiKey={api_key}, date={date_time}, salt={salt}, signature={signature}'

response = requests.post('https://api.solapi.com/crm-core/v1/relationships/types', headers={
'Authorization': auth_header,
'Content-Type': 'application/json'
}, json={
"name": "소속사",
"sourceEntityId": "CRMET1260423081530123EMP11122233",
"targetEntityId": "CRMET1260423081530124COM11122234",
"sourceLabel": "직원",
"targetLabel": "회사",
"description": "직원과 소속 회사의 관계"
})
data = response.json()

API_KEY="NCSXXXXXXXXXXXXX"
API_SECRET="YOUR_API_SECRET"
DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
SALT=$(openssl rand -hex 16)
SIGNATURE=$(echo -n "${DATE}${SALT}" | openssl dgst -sha256 -hmac "${API_SECRET}" | awk '{print $NF}')
AUTH="HMAC-SHA256 apiKey=${API_KEY}, date=${DATE}, salt=${SALT}, signature=${SIGNATURE}"

curl -X POST 'https://api.solapi.com/crm-core/v1/relationships/types' \
-H "Authorization: ${AUTH}" \
-H "Content-Type: application/json" \
-d '{"name": "소속사", "sourceEntityId": "CRMET1260423081530123EMP11122233", "targetEntityId": "CRMET1260423081530124COM11122234", "sourceLabel": "직원", "targetLabel": "회사", "description": "직원과 소속 회사의 관계"}'

lightbulb

`(accountId, workspaceId, name, sourceEntityId, targetEntityId)` 복합 unique 인덱스가 적용됩니다. 동일 source-target 조합 + 동일 이름의 유형은 추가로 만들 수 없으며 `409 ConflictException`이 반환됩니다.

lightbulb

**401 응답**: `{ "errorCode": "Unauthorized", "errorMessage": "권한이 없습니다." }`