인증

모든 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 내보내기

코드 예제

스키마 조회

GET /projects/{id}/schema
curl https://api.erdify.com/v1/projects/proj_abc/schema \
  -H "Authorization: Bearer erd_your_api_key_here"

테이블 추가

POST /projects/{id}/entities
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 내보내기

GET /projects/{id}/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

초기화 및 스키마 조회

schema.ts
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); // 테이블 배열

테이블 추가

create-entity.ts
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 내보내기

export-ddl.ts
const ddl = await client.projects.exportDDL('proj_abc', {
  dialect: 'postgresql', // 'mysql' | 'postgresql' | 'mariadb'
});
console.log(ddl); // CREATE TABLE ...
SDK 설치 pip install erdify

초기화 및 스키마 조회

schema.py
from erdify import ERDifyClient

client = ERDifyClient(api_key="erd_your_api_key_here")

schema = client.projects.get_schema("proj_abc")
print(schema.entities)  # 테이블 목록

테이블 추가

create_entity.py
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 내보내기

export_ddl.py
ddl = client.projects.export_ddl(
    "proj_abc",
    dialect="postgresql"  # "mysql" | "postgresql" | "mariadb"
)
print(ddl)  # CREATE TABLE ...