DrawNew.comPOST /api/v1/generate · GET /api/v1/tasks
배치 및 에이전트 통합을 위한 공개 엔드포인트. 귀하의 계정에 이미 발급된 API 키로 인증합니다 — 별도의 토큰이 필요하지 않습니다.
Authorization 헤더에 API 키를 포함하십시오. 키는 user_keys에서 귀하의 계정에 할당된 동일한 키입니다(DrawNew가 플랜을 활성화한 후 제공). 잘못된 키는 401을 반환합니다.
Authorization: Bearer <your_api_key>{ "error": { "type": "invalid_api_key", "message": "Invalid API key" } }/api/v1/generate작업을 상위 이미지 제공자에 제출하고 즉시 task_ids를 반환합니다. 생성된 이미지를 얻으려면 (A) 직접 GET /v1/tasks/:id를 폴링하거나 (B) 웹사이트를 열면 됩니다. 동일 계정의 Image Creation 탭이 작업을 자동으로 가져와 "My Works"에 결과를 저장합니다.
curl -X POST https://www.drawnew.com/api/v1/generate \
-H "Authorization: Bearer <your_api_key>" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A serene Japanese garden in autumn",
"model": "flash",
"mode": "text",
"aspect": "16:9",
"imageSize": "2K",
"count": 1
}'{
"task_ids": ["task_abc123"],
"email": "you@example.com"
}| 필드 | 유형 | 필수 | 기본값 | 설명 |
|---|---|---|---|---|
| prompt | string | ✓ | — | 생성 프롬프트 |
| model | string | gpt-image-2 | 모델 id (아래 참조) | |
| mode | text | edit | fusion | text | text=텍스트에서 이미지; edit=단일 이미지 편집; fusion=다중 이미지 블렌딩 | |
| aspect | string | 1:1 | 비율: 1:1, 2:3, 3:2, 3:4, 4:3, 9:16, 16:9, 21:9, … | |
| imageSize | 1K | 2K | 4K | 2K | 출력 해상도 | |
| count | number | 1 | 이미지 수 (모델별 상한 있음) | |
| imageUrls | string[] | [] | edit / fusion용 참조 이미지 URLs |
| model | 이름 | 지원 모드 |
|---|---|---|
| gpt-image-2 | GPT Image 2 | text, edit |
| pro | Nano Banana Pro | text, edit |
| flash2 | Nano Banana 2 | text, edit |
| flash | Nano Banana | text, edit |
| HTTP | error.type | 발생 조건 |
|---|---|---|
| 400 | invalid_request | 본문이 JSON이 아님, 프롬프트가 비어 있음, 모델 불명 또는 모델이 모드를 지원하지 않음 |
| 401 | unauthorized | Authorization 헤더가 없거나 형식이 잘못됨 |
| 401 | invalid_api_key | user_keys에서 API 키를 찾을 수 없음 |
| 403 | no_credits | 월 할당량을 소진했습니다. https://drawnew.com/pricing에서 요금제 업그레이드 |
/api/v1/tasks/{task_id}상위 작업 상태를 반환합니다. status는 queued / in_progress / completed / failed 중 하나입니다. completed에는 imageUrl 필드가 추가됩니다. failed에는 error 필드가 추가됩니다.
curl https://www.drawnew.com/api/v1/tasks/task_abc123 \
-H "Authorization: Bearer <your_api_key>"{
"task_id": "task_abc123",
"status": "completed",
"progress": 100,
"imageUrl": "https://files.example.com/generated/xxx.png"
}/api/v1/tasks?ids=t1,t2라운드트립 및 인증 조회를 절약하기 위해 한 번의 호출로 여러 작업을 폴링합니다. 결과는 입력 ids와 동일한 순서로 반환됩니다. 요청당 최대 20개 ids.
curl "https://www.drawnew.com/api/v1/tasks?ids=task_abc,task_def,task_ghi" \
-H "Authorization: Bearer <your_api_key>"{
"tasks": [
{ "task_id": "task_abc", "status": "completed", "progress": 100, "imageUrl": "https://..." },
{ "task_id": "task_def", "status": "in_progress", "progress": 60 },
{ "task_id": "task_ghi", "status": "failed", "progress": 0, "error": "model overloaded" }
]
}| HTTP | error.type | 발생 조건 |
|---|---|---|
| 400 | invalid_request | ids 매개변수가 없거나 20개 이상의 ids |
| 401 | unauthorized | Authorization 헤더가 없거나 형식이 잘못됨 |
| 401 | invalid_api_key | user_keys에서 API 키를 찾을 수 없음 |
/api/v1/upload서버 사이드에서 공개 URL에서 이미지를 가져와 상위 CDN에 다시 호스팅하고 안정적인 URL을 반환합니다. 결과를 generate_image의 imageUrls에 전달하십시오. 이미지당 최대 25MB. png / jpeg / webp / gif / bmp 지원.
curl -X POST https://www.drawnew.com/api/v1/upload \
-H "Authorization: Bearer <your_api_key>" \
-H "Content-Type: application/json" \
-d '{"source_url": "https://example.com/cat.png"}'{
"url": "https://files.example.com/uploads/abc123.png",
"filename": "cat.png",
"content_type": "image/png",
"bytes": 524288
}/api/v1/history?page=1&limit=20이 API 키에 귀속된 과거 생성을 최신 순으로 반환합니다. page(1부터 시작)와 limit(최대 50)를 통한 페이지네이션.
curl "https://www.drawnew.com/api/v1/history?page=1&limit=20" \
-H "Authorization: Bearer <your_api_key>"{
"items": [
{
"id": "tsk_img_xxx",
"prompt": "a cat in autumn",
"model": "flash",
"mode": "text",
"aspect": "16:9",
"imageSize": "2K",
"imageCount": 1,
"images": ["https://..."],
"refs": [],
"createdAt": 1777461252000
}
],
"total": 42,
"page": 1,
"limit": 20,
"total_pages": 3
}/api/v1/user/status이메일, 등급(trial / starter / standard / pro) 및 상위 키가 구성되어 있는지 여부를 반환합니다. 고비용 모델을 사용할 수 있는지 판단해야 하는 에이전트에 유용합니다.
curl https://www.drawnew.com/api/v1/user/status \
-H "Authorization: Bearer <your_api_key>"{
"email": "you@example.com",
"tier": "pro",
"has_key": true
}LLM 에이전트에게 DrawNew를 사용하는 가장 쉬운 방법은 npm에서 @drawnew/mcp-server로 게시된 공식 MCP 서버입니다. stdio를 통해 6개의 도구(generate_image, get_task, batch_get_tasks, upload_reference_image, list_my_generations, get_account_status)를 노출하며 MCP 호환 클라이언트와 작동합니다. 클라이언트의 MCP 설정에 아래 스니펫을 추가하면 됩니다.
경로: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) · %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"drawnew": {
"command": "npx",
"args": ["-y", "@drawnew/mcp-server"],
"env": {
"DRAWNEW_API_KEY": "<your_api_key>"
}
}
}
}