REST API 레퍼런스
HTTP 요청으로 ERDify 스키마를 읽고 수정합니다. CI/CD, 자동화 스크립트, 서드파티 통합에 적합합니다.
인증
모든 API 요청에 Authorization 헤더로 API 키를 전달하세요.
Authorization: Bearer erd_your_api_key_here
API 키는 ERDify 앱 → 설정 → API에서 발급받을 수 있습니다.
Base URL
https://api.erdify.com/v1
엔드포인트
| Method | Path | 설명 |
|---|---|---|
| GET | /projects | 프로젝트 목록 조회 |
| GET | /projects/{id}/schema | ERD 전체 스키마 조회 |
| POST | /projects/{id}/entities | 테이블 추가 |
| PATCH | /projects/{id}/entities/{entityId} | 테이블·컬럼 수정 |
| DELETE | /projects/{id}/entities/{entityId} | 테이블 삭제 |
| GET | /projects/{id}/ddl | DDL 내보내기 |
코드 예제
스키마 조회
curl https://api.erdify.com/v1/projects/proj_abc/schema \
-H "Authorization: Bearer erd_your_api_key_here"
테이블 추가
curl -X POST https://api.erdify.com/v1/projects/proj_abc/entities \
-H "Authorization: Bearer erd_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "orders",
"columns": [
{ "name": "id", "type": "INT", "primaryKey": true },
{ "name": "user_id", "type": "INT" },
{ "name": "total", "type": "DECIMAL(10,2)" },
{ "name": "created_at", "type": "TIMESTAMP" }
]
}' DDL 내보내기
curl "https://api.erdify.com/v1/projects/proj_abc/ddl?dialect=postgresql" \
-H "Authorization: Bearer erd_your_api_key_here"
SDK 설치 npm install @erdify/sdk 초기화 및 스키마 조회
import { ERDifyClient } from '@erdify/sdk';
const client = new ERDifyClient({ apiKey: 'erd_your_api_key_here' });
const schema = await client.projects.getSchema('proj_abc');
console.log(schema.entities); // 테이블 배열 테이블 추가
const entity = await client.entities.create('proj_abc', {
name: 'orders',
columns: [
{ name: 'id', type: 'INT', primaryKey: true },
{ name: 'user_id', type: 'INT' },
{ name: 'total', type: 'DECIMAL(10,2)' },
{ name: 'created_at', type: 'TIMESTAMP' },
],
}); DDL 내보내기
const ddl = await client.projects.exportDDL('proj_abc', {
dialect: 'postgresql', // 'mysql' | 'postgresql' | 'mariadb'
});
console.log(ddl); // CREATE TABLE ... SDK 설치 pip install erdify 초기화 및 스키마 조회
from erdify import ERDifyClient
client = ERDifyClient(api_key="erd_your_api_key_here")
schema = client.projects.get_schema("proj_abc")
print(schema.entities) # 테이블 목록 테이블 추가
entity = client.entities.create("proj_abc", {
"name": "orders",
"columns": [
{"name": "id", "type": "INT", "primaryKey": True},
{"name": "user_id", "type": "INT"},
{"name": "total", "type": "DECIMAL(10,2)"},
{"name": "created_at", "type": "TIMESTAMP"},
],
}) DDL 내보내기
ddl = client.projects.export_ddl(
"proj_abc",
dialect="postgresql" # "mysql" | "postgresql" | "mariadb"
)
print(ddl) # CREATE TABLE ...