계약관리시스템 API 가이드
계약관리시스템에 저장된 계약서 및 첨부파일 데이터를 외부 시스템, 스크립트, 앱에서 직접 호출하는 방법을 안내합니다.
REST API
인증 불필요
JSON 응답
CORS 허용
개요
계약관리시스템은 RESTful Table API를 사용하여 데이터를 저장합니다.
아래의 엔드포인트를 통해 계약서 데이터를 생성(POST) · 조회(GET) · 수정(PUT/PATCH) · 삭제(DELETE)할 수 있습니다.
별도의 인증 없이 호출 가능하며, 모든 요청/응답은 JSON 형식입니다.
사용 시나리오: ERP 시스템과 계약 데이터 동기화, 사내 대시보드에 계약 현황 임베드, Python/Node 스크립트로 계약 만료 알림 발송 등에 활용하세요.
Base URL
모든 API 요청의 기준 URL입니다. 이 사이트가 배포된 도메인 뒤에 경로를 붙여서 사용합니다.
운영 도메인 고정:
https://contract.sinwoodnc.com 기준으로 모든 예제가 작성되어 있습니다.
📦 사용 가능한 테이블
| 테이블명 | 설명 | 엔드포인트 예시 |
|---|---|---|
contracts | 계약서 데이터 | tables/contracts |
contract_files | 첨부파일 데이터 (Base64) | tables/contract_files |
데이터 스키마
계약서 데이터의 전체 필드 목록입니다. * 표시가 없는 필드는 선택 입력입니다.
title
text
계약서 제목 *
contract_number
text
계약번호 *
contract_type
text
계약 유형
status
text
계약 상태 *
client_name
text
거래처명 *
client_contact
text
거래처 담당자
amount
number
계약금액 (원)
start_date
text
시작일 (YYYY-MM-DD)
end_date
text
종료일 (YYYY-MM-DD)
signed_date
text
서명일 (YYYY-MM-DD)
manager
text
내부 담당자
department
text
담당 부서
priority
text
우선순위 (높음/보통/낮음)
tags
text
태그 (쉼표 구분)
description
rich_text
계약 내용
contract_id
text
연결된 계약서 ID *
file_name
text
원본 파일명 *
file_size
number
파일 크기 (bytes)
file_type
text
MIME 타입
file_ext
text
확장자 (pdf, xlsx 등)
file_data
rich_text
Base64 인코딩 데이터
description
text
파일 설명/메모
uploaded_by
text
업로더 이름
아래 필드는 API가 자동으로 채워주므로, 요청 시 포함하지 않아도 됩니다.
id
text (UUID)
자동 생성 고유 ID
created_at
number (ms)
생성 시각 (타임스탬프)
updated_at
number (ms)
수정 시각 (타임스탬프)
gs_project_id
text
프로젝트 ID
gs_table_name
text
테이블명
계약서 목록 조회
GET
tables/contracts
전체 계약서 목록 (페이지네이션)
Query Parameters
| 파라미터 | 타입 | 기본값 | 설명 |
|---|---|---|---|
page optional | number | 1 | 페이지 번호 |
limit optional | number | 20 | 페이지당 건수 (최대 200) |
search optional | string | - | 키워드 검색 |
sort optional | string | created_at | 정렬 기준 필드명 |
Response JSON
{
"data": [
{
"id": "uuid-xxxx-xxxx",
"title": "웹사이트 리뉴얼 개발 용역계약",
"contract_number": "CT-2025-001",
"contract_type": "용역계약",
"status": "진행중",
"client_name": "(주)테크솔루션",
"amount": 25000000,
"start_date": "2025-01-15",
"end_date": "2025-07-15",
"manager": "이수진",
"priority": "높음",
"created_at": 1736000000000,
"updated_at": 1736000000000
}
],
"total": 8,
"page": 1,
"limit": 20,
"table": "contracts"
}
단건 조회
GET
tables/contracts/{id}
특정 계약서 1건 조회
| Path 파라미터 | 타입 | 설명 |
|---|---|---|
id required | string (UUID) | 계약서 고유 ID |
Response JSON
{
"id": "uuid-xxxx-xxxx",
"title": "웹사이트 리뉴얼 개발 용역계약",
"contract_number": "CT-2025-001",
"status": "진행중",
"amount": 25000000,
"end_date": "2025-07-15"
}
계약서 생성
POST
tables/contracts
새 계약서 생성 (HTTP 201)
Content-Type: application/json 헤더가 필요합니다.
Request Body (JSON)
{
"title": "신규 서버 구축 계약",
"contract_number": "CT-2025-009",
"contract_type": "물품구매",
"status": "초안",
"client_name": "클라우드코리아",
"client_contact": "홍길동 / 010-0000-0000",
"amount": 18000000,
"start_date": "2025-04-01",
"end_date": "2025-09-30",
"manager": "박지수",
"department": "인프라팀",
"priority": "높음",
"tags": "서버,인프라",
"description": "클라우드 서버 마이그레이션 및 구축"
}
계약서 수정
PUT
tables/contracts/{id}
계약서 전체 업데이트
PUT은 전체 필드를 교체합니다. 일부만 수정하려면
PATCH를 사용하세요.PATCH — 일부 필드만 수정
// PATCH tables/contracts/{id}
{
"status": "서명완료",
"signed_date": "2025-04-05"
}
계약서 삭제
DELETE
tables/contracts/{id}
계약서 삭제 (HTTP 204)
삭제 성공 시 응답 본문 없이 HTTP 204 No Content를 반환합니다. 소프트 삭제(soft delete)로 처리됩니다.
첨부파일 API
GET
tables/contract_files?limit=100
전체 파일 목록 조회
특정 계약서의 파일만 필터링하려면 응답 데이터에서 contract_id로 클라이언트 측 필터링합니다.
JavaScript 필터링 예시
const res = await fetch('tables/contract_files?limit=200');
const data = await res.json();
// 특정 계약서의 파일만 필터
const contractId = 'uuid-xxxx-xxxx';
const files = data.data.filter(f => f.contract_id === contractId);
console.log(files);
POST
tables/contract_files
파일 업로드 (Base64)
파일을 Base64로 인코딩하여
file_data 필드에 담아 전송합니다. (DataURL 형식: data:mime;base64,...)Request Body
{
"contract_id": "uuid-xxxx-xxxx",
"file_name": "계약서_초안.pdf",
"file_size": 204800,
"file_type": "application/pdf",
"file_ext": "pdf",
"file_data": "data:application/pdf;base64,JVBERi0xLjQK...",
"description": "서명 전 초안",
"uploaded_by": "홍길동"
}
DELETE
tables/contract_files/{id}
파일 삭제 (HTTP 204)
파일 레코드의 id를 Path에 포함하여 삭제합니다. HTTP 204를 반환합니다.
JavaScript 예제
브라우저 또는 Node.js 환경에서 사용할 수 있는 완전한 예제입니다.
JavaScript (fetch)
// ─────────────────────────────────────────
// 계약관리시스템 API 클라이언트 (JavaScript)
// ─────────────────────────────────────────
const BASE = 'https://contract.sinwoodnc.com/tables';
// 1. 전체 계약서 조회
async function getContracts(page = 1, limit = 20) {
const res = await fetch(`${BASE}/contracts?page=${page}&limit=${limit}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return await res.json();
// { data: [...], total: N, page: 1, limit: 20 }
}
// 2. 특정 계약서 조회
async function getContract(id) {
const res = await fetch(`${BASE}/contracts/${id}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return await res.json();
}
// 3. 계약서 생성
async function createContract(payload) {
const res = await fetch(`${BASE}/contracts`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return await res.json(); // 생성된 레코드 반환 (id 포함)
}
// 4. 계약서 상태 변경 (PATCH)
async function updateContractStatus(id, status) {
const res = await fetch(`${BASE}/contracts/${id}`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ status }),
});
return await res.json();
}
// 5. 계약서 삭제
async function deleteContract(id) {
const res = await fetch(`${BASE}/contracts/${id}`, {
method: 'DELETE',
});
return res.status === 204; // true면 성공
}
// 6. 만료 임박 계약 (30일 이내) 조회
async function getExpiringContracts() {
const { data } = await getContracts(1, 200);
const today = new Date();
return data.filter(c => {
if (!c.end_date || c.status === '만료') return false;
const end = new Date(c.end_date);
const diff = Math.round((end - today) / 86400000);
return diff >= 0 && diff <= 30;
});
}
// ─── 사용 예시 ───
(async () => {
// 전체 조회
const { data, total } = await getContracts();
console.log(`전체 계약 ${total}건:`, data);
// 만료 임박 조회
const expiring = await getExpiringContracts();
console.log('30일 이내 만료:', expiring.map(c => c.title));
// 새 계약서 생성
const newContract = await createContract({
title: 'API로 생성한 계약',
contract_number: 'CT-2025-999',
contract_type: '용역계약',
status: '초안',
client_name: '테스트 회사',
amount: 5000000,
priority: '보통',
});
console.log('생성된 계약 ID:', newContract.id);
})();
Python 예제
Python requests 라이브러리를 사용하는 예제입니다.
Python (requests)
import requests
from datetime import date, timedelta
BASE = "https://contract.sinwoodnc.com/tables"
# ─── 1. 전체 계약서 조회 ───
def get_contracts(page=1, limit=50):
r = requests.get(f"{BASE}/contracts", params={"page": page, "limit": limit})
r.raise_for_status()
return r.json()
# ─── 2. 계약서 생성 ───
def create_contract(payload: dict):
r = requests.post(
f"{BASE}/contracts",
json=payload,
headers={"Content-Type": "application/json"},
)
r.raise_for_status()
return r.json()
# ─── 3. 상태 업데이트 (PATCH) ───
def update_status(contract_id: str, status: str):
r = requests.patch(
f"{BASE}/contracts/{contract_id}",
json={"status": status},
headers={"Content-Type": "application/json"},
)
r.raise_for_status()
return r.json()
# ─── 4. 만료 임박 조회 → 알림 ───
def alert_expiring(days=30):
data = get_contracts(limit=200)["data"]
today = date.today()
threshold = today + timedelta(days=days)
expiring = []
for c in data:
if not c.get("end_date") or c.get("status") in ("만료", "해지"):
continue
end = date.fromisoformat(c["end_date"])
if today <= end <= threshold:
expiring.append(c)
for c in expiring:
end = date.fromisoformat(c["end_date"])
remaining = (end - today).days
print(f"⚠️ [{c['contract_number']}] {c['title']} — D-{remaining} ({c['end_date']})")
return expiring
# ─── 실행 ───
if __name__ == "__main__":
result = get_contracts()
print(f"전체 계약 {result['total']}건")
# 만료 임박 알림
alert_expiring(days=30)
cURL 예제
터미널에서 바로 사용 가능한 cURL 명령어입니다.
cURL
# ─── 전체 계약서 조회 ───
curl "https://contract.sinwoodnc.com/tables/contracts?limit=50"
# ─── 특정 계약서 조회 ───
curl "https://contract.sinwoodnc.com/tables/contracts/uuid-xxxx-xxxx"
# ─── 새 계약서 생성 ───
curl -X POST "https://contract.sinwoodnc.com/tables/contracts" \
-H "Content-Type: application/json" \
-d '{
"title": "cURL로 생성한 계약",
"contract_number": "CT-2025-010",
"contract_type": "용역계약",
"status": "초안",
"client_name": "테스트 클라이언트",
"amount": 10000000,
"priority": "보통"
}'
# ─── 상태 변경 (PATCH) ───
curl -X PATCH "https://contract.sinwoodnc.com/tables/contracts/uuid-xxxx-xxxx" \
-H "Content-Type: application/json" \
-d '{"status": "서명완료", "signed_date": "2025-04-10"}'
# ─── 계약서 삭제 ───
curl -X DELETE "https://contract.sinwoodnc.com/tables/contracts/uuid-xxxx-xxxx"
# ─── 첨부파일 목록 조회 ───
curl "https://contract.sinwoodnc.com/tables/contract_files?limit=100"
팁: cURL 응답을 보기 좋게 출력하려면 명령어 끝에
| python3 -m json.tool 또는 | jq를 추가하세요.