Base URL · Authorization · 엔드포인트별로 바로 호출하세요.
Base URL · https://developer-api.bogofit.ai
키 구분 mb_test_* → Playground·샌드박스(가입 시 10회). mb_live_* → 프로덕션(결제 충전분). Live 키는 백엔드에서만 사용하세요.
가입 때 개인/조직을 고르지 않습니다. 항상 내 워크스페이스에서 시작합니다. 팀이 프로젝트를 공유하거나, Live 크레딧·영수증을 회사 명의로 쓰려면 조직을 추가하세요.
주의 API 키를 브라우저·앱에 넣지 마세요. 서버에서만 호출하세요.
Authorization*headerBearer 토큰 — mb_test_*(샌드박스/플레이그라운드) 또는 mb_live_*(프로덕션). 레거시 X-API-KEY도 6개월간 지원
Content-Type*header피팅 및 upload-url 요청에는 application/json
| 파라미터 | 타입 | 설명 |
|---|---|---|
| Authorization* | header | Bearer 토큰 — mb_test_*(샌드박스/플레이그라운드) 또는 mb_live_*(프로덕션). 레거시 X-API-KEY도 6개월간 지원 |
| Content-Type* | header | 피팅 및 upload-url 요청에는 application/json |
로컬 이미지는 multipart 또는 사전 서명(upload-url)으로 올린 뒤 file_id를 피팅 API에 전달합니다. HTTPS URL·Base64(≤5MB/필드)도 지원합니다.
바이너리 파일은 POST /v1/files (multipart) 또는 upload-url로 올리고 file_id만 피팅에 넘기세요. Base64는 테스트용이며 필드당 디코딩 기준 5MB까지입니다.
핵심
multipart와 사전 서명의 차이는 업로드 경로뿐입니다. 둘 다 최종적으로 file_id를 피팅 JSON에 넣습니다. URL·Base64는 업로드 없이 피팅 body에 바로 넣습니다.
바이너리를 API로 직접 전송 → file_id 수신 (~10MB 권장)
짧은 JSON으로 URL을 받은 뒤 스토리지에 PUT → 같은 file_id 사용
FormData 필드명 file 로 바이너리를 직접 올립니다. 응답의 file_id를 피팅 API에 사용하세요. (대략 10MB 이하 권장)
file*binary (multipart)이미지 바이너리 — multipart/form-data 필드명 file
| 파라미터 | 타입 | 설명 |
|---|---|---|
| file* | binary (multipart) | 이미지 바이너리 — multipart/form-data 필드명 file |
file_idstringmodel_image, top_image 등에 사용
mime_typestring저장된 MIME 타입
size_bytesnumber업로드된 바이트 수
expires_atstringfile_id 보관 만료 시각
| 필드 | 타입 | 설명 |
|---|---|---|
| file_id | string | model_image, top_image 등에 사용 |
| mime_type | string | 저장된 MIME 타입 |
| size_bytes | number | 업로드된 바이트 수 |
| expires_at | string | file_id 보관 만료 시각 |
// Multipart binary upload (one request)// Field name must be "file". Limit ~10MB (see MAX_IMAGE_UPLOAD_BYTES).const API_KEY = 'mb_live_YOUR_KEY'; async function uploadImageMultipart(file) { const form = new FormData(); form.append('file', file); // Blob / File const res = await fetch('https://developer-api.bogofit.ai/v1/files', { method: 'POST', headers: { Authorization: `Bearer ${API_KEY}` }, // Do NOT set Content-Type — browser sets multipart boundary body: form, }); const meta = await res.json(); return meta.file_id; // use in model_image, top_image, ...}mime_type*string예: image/png, image/jpeg
filenamestring원본 파일명 (확장자 추론에 사용)
| 파라미터 | 타입 | 설명 |
|---|---|---|
| mime_type* | string | 예: image/png, image/jpeg |
| filename | string | 원본 파일명 (확장자 추론에 사용) |
file_idstringmodel_image, top_image 등에 사용
upload_urlstring사전 서명 PUT URL (약 15분 후 만료)
expires_atstringupload_url 만료 시각 (ISO 타임스탬프)
| 필드 | 타입 | 설명 |
|---|---|---|
| file_id | string | model_image, top_image 등에 사용 |
| upload_url | string | 사전 서명 PUT URL (약 15분 후 만료) |
| expires_at | string | upload_url 만료 시각 (ISO 타임스탬프) |
// Presigned (large files / CDN offload)// mb_live_* — production · mb_test_* — Playground / sandboxconst API_KEY = 'mb_live_YOUR_KEY'; async function uploadImagePresigned(file) { const mime = file.type || 'image/jpeg'; const meta = await fetch('https://developer-api.bogofit.ai/v1/files/upload-url', { method: 'POST', headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ mime_type: mime, filename: file.name }), }).then((r) => r.json()); await fetch(meta.upload_url, { method: 'PUT', headers: { 'Content-Type': mime }, body: file, }); return meta.file_id;}피팅 body의 이미지 필드는 file_id · HTTPS URL · Base64 중 하나를 받습니다. file_id는 multipart 또는 사전 서명 업로드로 만듭니다. 한 요청에서 형식을 혼합할 수 있습니다.
Base64는 필드당 디코딩 기준 5MB 이하만 허용됩니다. 그 이상은 400으로 거부되니 multipart 또는 사전 서명을 사용하세요.
| 방식 | 피팅 body 값 | 크기 한도 | 언제 쓰나 | 프로덕션 |
|---|---|---|---|---|
| Multipart → file_id | file_xxx | ~10MB 권장 | 로컬 파일, 간단한 연동 | 권장 |
| 사전 서명 → file_id | file_xxx | 대용량에 적합 | 큰 파일, 스토리지 직접 업로드 | 권장 |
| HTTPS URL | https://… | 원본 서버에 따름 | CDN·카탈로그에 이미 호스팅 | 가능 |
| Base64 | data:image/…;base64,… | ≤5MB / 필드 (디코딩 기준) | 빠른 테스트·프로토타입 | 테스트만 |
Multipart → file_id
권장사전 서명 → file_id
권장HTTPS URL
가능Base64
테스트만입점형 쇼핑몰은 Store Installation으로 연결합니다. 판매자가 API 키를 만들 필요는 없습니다. 본경로는 입점형 몰 관리자에서 AI 피팅 켜기이고, 몰 백엔드가 내부 설치 API를 호출합니다. Developer Center는 설정·충전·테스트 설치용입니다. 손님 브라우저에는 짧은 위젯 세션만 전달합니다.
입점형 몰 관리자 = 설치 활성화(본경로). Developer Center = 설정·결제·테스트 설치. Developer API + Worker = 실행. Widget (loader + iframe) = 상품 페이지 고객 UI.
몰 관리자에서 AI 피팅 활성화 → 몰 백엔드가 `POST /internal/v1/store-installations` (`X-Internal-Api-Key` + SSO `external_user_id`) → Organization·Project·위젯 설정 자동 생성. 응답의 `billing_url`로 Center 충전. live 키는 서버에만 두고 브라우저에 반환하지 않습니다. 로컬 검증은 Center `/stores`의 테스트 설치(`POST /v1/store-installations`, JWT)를 사용합니다.
내부 설치 API (몰 백엔드)
await fetch("https://developer-api.bogofit.ai/internal/v1/store-installations", { method: "POST", headers: { "X-Internal-Api-Key": process.env.MALL_INTEGRATION_API_KEY, "Content-Type": "application/json", }, body: JSON.stringify({ external_user_id: ssoSub, email, store_id: storeId, store_name: storeName, store_domain: storeDomain, }),});몰 layout에 `/widget/v1/loader.js`를 한 번 로드하고, PDP에 `data-bogofit-widget` 노드를 둡니다. Loader는 `GET /widget/v1/bootstrap`으로 비활성 시 버튼을 숨깁니다.
<!-- layout --><script async src="https://developer.bogofit.ai/widget/v1/loader.js"></script> <!-- PDP --><div data-bogofit-widget data-store-id="STORE_ID" data-product-id="PRODUCT_ID" data-product-type="apparel_top_bottom" data-product-image="https://cdn.example/product.jpg" data-session-bridge="/api/bogofit/widget-session"></div>손님 클릭 시 몰 서버가 `POST /widget/v1/session`(internal 키)으로 세션을 만들고 `session_token`만 브라우저에 넘깁니다. HTML/JS에 `mb_live_*`를 넣지 마세요.
세션 발급 (몰 서버)
// Mall session-bridge handler (server only)const res = await fetch("https://developer-api.bogofit.ai/widget/v1/session", { method: "POST", headers: { "X-Internal-Api-Key": process.env.MALL_INTEGRATION_API_KEY, "Content-Type": "application/json", }, body: JSON.stringify({ store_id, product_id, product_type, product_image_url, allowed_origin: req.headers.origin, }),});const { session_token } = await res.json();// return session_token to the browser — never mb_live_*마운트 노드에 apparel/goods 타입을 넣으면 위젯 런타임이 피팅 feature로 매핑합니다.
| product_type | feature |
|---|---|
| apparel_top_bottom | fitting-apparel-top-bottom |
| apparel_outer | fitting-apparel-outer |
| apparel_dress | fitting-apparel-dress |
| goods_nail | fitting-goods-nail |
| goods_eyewear | fitting-goods-eyewear |
| goods_shoes | fitting-goods-shoes |
| goods_bag | fitting-goods-bag |
| goods_hat | fitting-goods-hat |
| goods_accessories | fitting-goods-accessories |
몰 레포 없이, ACTIVE 설치가 있는 조직 워크스페이스로 로그인한 뒤 `/widget/demo`를 여세요. Center가 `POST /widget/v1/demo-session`을 발급합니다. 설치가 없으면 `/stores`에서 테스트 설치를 만드세요.
몰 관리자에 잔액과 Developer Center 결제 링크(`billing_url`)만 둡니다. 위젯에서 크레딧 부족 시에도 `/billing`으로 안내합니다. 몰 안 결제는 후순위입니다.
피팅 POST는 Job만 돌려줍니다. 결과는 2초마다 GET /v1/jobs/:id 로 확인하세요. GET은 무료입니다. 폴링 예제 보기
공통 응답
idstring폴링에 사용하는 Job id
statusstringqueued → processing → succeeded | failed
output.resultUrlstring성공 시 결과 이미지 URL
| 필드 | 타입 | 설명 |
|---|---|---|
| id | string | 폴링에 사용하는 Job id |
| status | string | queued → processing → succeeded | failed |
| output.resultUrl | string | 성공 시 결과 이미지 URL |
model_image*string모델(인물) 이미지
top_imagestring상의 이미지
bottom_imagestring하의 이미지
accessory_imagesstring[]아이템 최대 4장
top_stylenone | tucked | untucked상의 넣어입기/빼입기 (기본 none)
| 파라미터 | 타입 | 설명 |
|---|---|---|
| model_image* | string | 모델(인물) 이미지 |
| top_image | string | 상의 이미지 |
| bottom_image | string | 하의 이미지 |
| accessory_images | string[] | 아이템 최대 4장 |
| top_style | none | tucked | untucked | 상의 넣어입기/빼입기 (기본 none) |
multipart / file_id / HTTPS URL / Base64(≤5MB) 탭을 전환해 비교하세요. JavaScript · Python · C# 예제가 포함되어 있습니다.
// Multipart upload → file_id → fitting (Gemini Files API style)// mb_live_* — production · mb_test_* — Playground / sandboxconst API_KEY = 'mb_live_YOUR_KEY';const headers = { Authorization: `Bearer ${API_KEY}` }; async function uploadImage(file) { const form = new FormData(); form.append('file', file); const meta = await fetch('https://developer-api.bogofit.ai/v1/files', { method: 'POST', headers, // no Content-Type — boundary is set automatically body: form, }).then((r) => r.json()); return meta.file_id;} const [modelId, shirtId, jeansId, hatId, bagId] = await Promise.all([ uploadImage(modelFile), uploadImage(shirtFile), uploadImage(jeansFile), uploadImage(hatFile), uploadImage(bagFile),]); const res = await fetch('https://developer-api.bogofit.ai/v1/virtual-fitting', { method: 'POST', headers: { ...headers, 'Content-Type': 'application/json' }, body: JSON.stringify({ model_image: modelId, // required top_image: shirtId, // optional bottom_image: jeansId, // optional accessory_images: [hatId, bagId], // optional — max 4 // top_style: 'tucked', // optional — none | tucked | untucked (default none) }),});const job = await res.json(); async function waitForJob(jobId) { for (let i = 0; i < 60; i++) { const next = await fetch('https://developer-api.bogofit.ai/v1/jobs/' + jobId, { headers: { Authorization: `Bearer ${API_KEY}` }, }).then((r) => r.json()); if (next.status === 'succeeded' || next.status === 'failed' || next.status === 'cancelled') { return next; } await new Promise((r) => setTimeout(r, 2000)); } throw new Error('Timed out waiting for job (~2 min)');} const done = await waitForJob(job.id);if (done.status === 'succeeded') { console.log(done.output.resultUrl);} else { console.error(done.error);}model_image*string모델(인물) 이미지
outer_image*string아우터 이미지
accessory_imagesstring[]아이템 최대 4장
outer_stylenone | closed | opened닫아입기/열어입기 (기본 none)
| 파라미터 | 타입 | 설명 |
|---|---|---|
| model_image* | string | 모델(인물) 이미지 |
| outer_image* | string | 아우터 이미지 |
| accessory_images | string[] | 아이템 최대 4장 |
| outer_style | none | closed | opened | 닫아입기/열어입기 (기본 none) |
multipart / file_id / HTTPS URL / Base64(≤5MB) 탭을 전환해 비교하세요. JavaScript · Python · C# 예제가 포함되어 있습니다.
// Multipart upload → file_id → fitting (Gemini Files API style)// mb_live_* — production · mb_test_* — Playground / sandboxconst API_KEY = 'mb_live_YOUR_KEY';const headers = { Authorization: `Bearer ${API_KEY}` }; async function uploadImage(file) { const form = new FormData(); form.append('file', file); const meta = await fetch('https://developer-api.bogofit.ai/v1/files', { method: 'POST', headers, // no Content-Type — boundary is set automatically body: form, }).then((r) => r.json()); return meta.file_id;} const [modelId, jacketId, scarfId, watchId] = await Promise.all([ uploadImage(modelFile), uploadImage(jacketFile), uploadImage(scarfFile), uploadImage(watchFile),]); const res = await fetch('https://developer-api.bogofit.ai/v1/virtual-fitting-outer', { method: 'POST', headers: { ...headers, 'Content-Type': 'application/json' }, body: JSON.stringify({ model_image: modelId, // required outer_image: jacketId, // required accessory_images: [scarfId, watchId], // optional — max 4 // outer_style: 'opened', // optional — none | closed | opened (default none) }),});const job = await res.json(); async function waitForJob(jobId) { for (let i = 0; i < 60; i++) { const next = await fetch('https://developer-api.bogofit.ai/v1/jobs/' + jobId, { headers: { Authorization: `Bearer ${API_KEY}` }, }).then((r) => r.json()); if (next.status === 'succeeded' || next.status === 'failed' || next.status === 'cancelled') { return next; } await new Promise((r) => setTimeout(r, 2000)); } throw new Error('Timed out waiting for job (~2 min)');} const done = await waitForJob(job.id);if (done.status === 'succeeded') { console.log(done.output.resultUrl);} else { console.error(done.error);}model_image*string모델(인물) 이미지
dress_image*string원피스/롱드레스 이미지
accessory_imagesstring[]아이템 최대 4장
| 파라미터 | 타입 | 설명 |
|---|---|---|
| model_image* | string | 모델(인물) 이미지 |
| dress_image* | string | 원피스/롱드레스 이미지 |
| accessory_images | string[] | 아이템 최대 4장 |
multipart / file_id / HTTPS URL / Base64(≤5MB) 탭을 전환해 비교하세요. JavaScript · Python · C# 예제가 포함되어 있습니다.
// Multipart upload → file_id → fitting (Gemini Files API style)// mb_live_* — production · mb_test_* — Playground / sandboxconst API_KEY = 'mb_live_YOUR_KEY';const headers = { Authorization: `Bearer ${API_KEY}` }; async function uploadImage(file) { const form = new FormData(); form.append('file', file); const meta = await fetch('https://developer-api.bogofit.ai/v1/files', { method: 'POST', headers, // no Content-Type — boundary is set automatically body: form, }).then((r) => r.json()); return meta.file_id;} const [modelId, dressId, necklaceId] = await Promise.all([ uploadImage(modelFile), uploadImage(dressFile), uploadImage(necklaceFile),]); const res = await fetch('https://developer-api.bogofit.ai/v1/virtual-fitting-dress', { method: 'POST', headers: { ...headers, 'Content-Type': 'application/json' }, body: JSON.stringify({ model_image: modelId, // required dress_image: dressId, // required accessory_images: [necklaceId], // optional — max 4 }),});const job = await res.json(); async function waitForJob(jobId) { for (let i = 0; i < 60; i++) { const next = await fetch('https://developer-api.bogofit.ai/v1/jobs/' + jobId, { headers: { Authorization: `Bearer ${API_KEY}` }, }).then((r) => r.json()); if (next.status === 'succeeded' || next.status === 'failed' || next.status === 'cancelled') { return next; } await new Promise((r) => setTimeout(r, 2000)); } throw new Error('Timed out waiting for job (~2 min)');} const done = await waitForJob(job.id);if (done.status === 'succeeded') { console.log(done.output.resultUrl);} else { console.error(done.error);}model_image*string손 이미지
nail_art_image*string네일 디자인 이미지
| 파라미터 | 타입 | 설명 |
|---|---|---|
| model_image* | string | 손 이미지 |
| nail_art_image* | string | 네일 디자인 이미지 |
multipart / file_id / HTTPS URL / Base64(≤5MB) 탭을 전환해 비교하세요. JavaScript · Python · C# 예제가 포함되어 있습니다.
// Multipart upload → file_id → fitting (Gemini Files API style)// mb_live_* — production · mb_test_* — Playground / sandboxconst API_KEY = 'mb_live_YOUR_KEY';const headers = { Authorization: `Bearer ${API_KEY}` }; async function uploadImage(file) { const form = new FormData(); form.append('file', file); const meta = await fetch('https://developer-api.bogofit.ai/v1/files', { method: 'POST', headers, // no Content-Type — boundary is set automatically body: form, }).then((r) => r.json()); return meta.file_id;} const [handId, nailId] = await Promise.all([ uploadImage(handFile), uploadImage(nailFile),]); const res = await fetch('https://developer-api.bogofit.ai/v1/nail-fitting', { method: 'POST', headers: { ...headers, 'Content-Type': 'application/json' }, body: JSON.stringify({ model_image: handId, // required nail_art_image: nailId, // required }),});const job = await res.json(); async function waitForJob(jobId) { for (let i = 0; i < 60; i++) { const next = await fetch('https://developer-api.bogofit.ai/v1/jobs/' + jobId, { headers: { Authorization: `Bearer ${API_KEY}` }, }).then((r) => r.json()); if (next.status === 'succeeded' || next.status === 'failed' || next.status === 'cancelled') { return next; } await new Promise((r) => setTimeout(r, 2000)); } throw new Error('Timed out waiting for job (~2 min)');} const done = await waitForJob(job.id);if (done.status === 'succeeded') { console.log(done.output.resultUrl);} else { console.error(done.error);}model_image*string인물 이미지
glasses_image*string안경/선글라스 이미지
| 파라미터 | 타입 | 설명 |
|---|---|---|
| model_image* | string | 인물 이미지 |
| glasses_image* | string | 안경/선글라스 이미지 |
multipart / file_id / HTTPS URL / Base64(≤5MB) 탭을 전환해 비교하세요. JavaScript · Python · C# 예제가 포함되어 있습니다.
// Multipart upload → file_id → fitting (Gemini Files API style)// mb_live_* — production · mb_test_* — Playground / sandboxconst API_KEY = 'mb_live_YOUR_KEY';const headers = { Authorization: `Bearer ${API_KEY}` }; async function uploadImage(file) { const form = new FormData(); form.append('file', file); const meta = await fetch('https://developer-api.bogofit.ai/v1/files', { method: 'POST', headers, // no Content-Type — boundary is set automatically body: form, }).then((r) => r.json()); return meta.file_id;} const [faceId, glassesId] = await Promise.all([ uploadImage(faceFile), uploadImage(glassesFile),]); const res = await fetch('https://developer-api.bogofit.ai/v1/glasses-tryon', { method: 'POST', headers: { ...headers, 'Content-Type': 'application/json' }, body: JSON.stringify({ model_image: faceId, // required glasses_image: glassesId, // required }),});const job = await res.json(); async function waitForJob(jobId) { for (let i = 0; i < 60; i++) { const next = await fetch('https://developer-api.bogofit.ai/v1/jobs/' + jobId, { headers: { Authorization: `Bearer ${API_KEY}` }, }).then((r) => r.json()); if (next.status === 'succeeded' || next.status === 'failed' || next.status === 'cancelled') { return next; } await new Promise((r) => setTimeout(r, 2000)); } throw new Error('Timed out waiting for job (~2 min)');} const done = await waitForJob(job.id);if (done.status === 'succeeded') { console.log(done.output.resultUrl);} else { console.error(done.error);}model_image*string인물 이미지
shoes_image*string신발 이미지
| 파라미터 | 타입 | 설명 |
|---|---|---|
| model_image* | string | 인물 이미지 |
| shoes_image* | string | 신발 이미지 |
multipart / file_id / HTTPS URL / Base64(≤5MB) 탭을 전환해 비교하세요. JavaScript · Python · C# 예제가 포함되어 있습니다.
// Multipart upload → file_id → fitting (Gemini Files API style)// mb_live_* — production · mb_test_* — Playground / sandboxconst API_KEY = 'mb_live_YOUR_KEY';const headers = { Authorization: `Bearer ${API_KEY}` }; async function uploadImage(file) { const form = new FormData(); form.append('file', file); const meta = await fetch('https://developer-api.bogofit.ai/v1/files', { method: 'POST', headers, // no Content-Type — boundary is set automatically body: form, }).then((r) => r.json()); return meta.file_id;} const [modelId, shoesId] = await Promise.all([ uploadImage(modelFile), uploadImage(shoesFile),]); const res = await fetch('https://developer-api.bogofit.ai/v1/shoes-tryon', { method: 'POST', headers: { ...headers, 'Content-Type': 'application/json' }, body: JSON.stringify({ model_image: modelId, // required shoes_image: shoesId, // required }),});const job = await res.json(); async function waitForJob(jobId) { for (let i = 0; i < 60; i++) { const next = await fetch('https://developer-api.bogofit.ai/v1/jobs/' + jobId, { headers: { Authorization: `Bearer ${API_KEY}` }, }).then((r) => r.json()); if (next.status === 'succeeded' || next.status === 'failed' || next.status === 'cancelled') { return next; } await new Promise((r) => setTimeout(r, 2000)); } throw new Error('Timed out waiting for job (~2 min)');} const done = await waitForJob(job.id);if (done.status === 'succeeded') { console.log(done.output.resultUrl);} else { console.error(done.error);}model_image*string인물 이미지 (공통)
bag_image*string가방 — /v1/bag-tryon
hat_image*string모자 — /v1/hat-tryon
| 파라미터 | 타입 | 설명 |
|---|---|---|
| model_image* | string | 인물 이미지 (공통) |
| bag_image* | string | 가방 — /v1/bag-tryon |
| hat_image* | string | 모자 — /v1/hat-tryon |
multipart / file_id / HTTPS URL / Base64(≤5MB) 탭을 전환해 비교하세요. JavaScript · Python · C# 예제가 포함되어 있습니다.
POST /v1/bag-tryon
// Multipart upload → file_id → fitting (Gemini Files API style)// mb_live_* — production · mb_test_* — Playground / sandboxconst API_KEY = 'mb_live_YOUR_KEY';const headers = { Authorization: `Bearer ${API_KEY}` }; async function uploadImage(file) { const form = new FormData(); form.append('file', file); const meta = await fetch('https://developer-api.bogofit.ai/v1/files', { method: 'POST', headers, // no Content-Type — boundary is set automatically body: form, }).then((r) => r.json()); return meta.file_id;} const [modelId, bagId] = await Promise.all([ uploadImage(modelFile), uploadImage(bagFile),]); const res = await fetch('https://developer-api.bogofit.ai/v1/bag-tryon', { method: 'POST', headers: { ...headers, 'Content-Type': 'application/json' }, body: JSON.stringify({ model_image: modelId, // required bag_image: bagId, // required }),});const job = await res.json(); async function waitForJob(jobId) { for (let i = 0; i < 60; i++) { const next = await fetch('https://developer-api.bogofit.ai/v1/jobs/' + jobId, { headers: { Authorization: `Bearer ${API_KEY}` }, }).then((r) => r.json()); if (next.status === 'succeeded' || next.status === 'failed' || next.status === 'cancelled') { return next; } await new Promise((r) => setTimeout(r, 2000)); } throw new Error('Timed out waiting for job (~2 min)');} const done = await waitForJob(job.id);if (done.status === 'succeeded') { console.log(done.output.resultUrl);} else { console.error(done.error);}POST /v1/hat-tryon
// Multipart upload → file_id → fitting (Gemini Files API style)// mb_live_* — production · mb_test_* — Playground / sandboxconst API_KEY = 'mb_live_YOUR_KEY';const headers = { Authorization: `Bearer ${API_KEY}` }; async function uploadImage(file) { const form = new FormData(); form.append('file', file); const meta = await fetch('https://developer-api.bogofit.ai/v1/files', { method: 'POST', headers, // no Content-Type — boundary is set automatically body: form, }).then((r) => r.json()); return meta.file_id;} const [modelId, hatId] = await Promise.all([ uploadImage(modelFile), uploadImage(hatFile),]); const res = await fetch('https://developer-api.bogofit.ai/v1/hat-tryon', { method: 'POST', headers: { ...headers, 'Content-Type': 'application/json' }, body: JSON.stringify({ model_image: modelId, // required hat_image: hatId, // required }),});const job = await res.json(); async function waitForJob(jobId) { for (let i = 0; i < 60; i++) { const next = await fetch('https://developer-api.bogofit.ai/v1/jobs/' + jobId, { headers: { Authorization: `Bearer ${API_KEY}` }, }).then((r) => r.json()); if (next.status === 'succeeded' || next.status === 'failed' || next.status === 'cancelled') { return next; } await new Promise((r) => setTimeout(r, 2000)); } throw new Error('Timed out waiting for job (~2 min)');} const done = await waitForJob(job.id);if (done.status === 'succeeded') { console.log(done.output.resultUrl);} else { console.error(done.error);}model_image*string인물 이미지
accessory_image*string악세사리 이미지
| 파라미터 | 타입 | 설명 |
|---|---|---|
| model_image* | string | 인물 이미지 |
| accessory_image* | string | 악세사리 이미지 |
multipart / file_id / HTTPS URL / Base64(≤5MB) 탭을 전환해 비교하세요. JavaScript · Python · C# 예제가 포함되어 있습니다.
// Multipart upload → file_id → fitting (Gemini Files API style)// mb_live_* — production · mb_test_* — Playground / sandboxconst API_KEY = 'mb_live_YOUR_KEY';const headers = { Authorization: `Bearer ${API_KEY}` }; async function uploadImage(file) { const form = new FormData(); form.append('file', file); const meta = await fetch('https://developer-api.bogofit.ai/v1/files', { method: 'POST', headers, // no Content-Type — boundary is set automatically body: form, }).then((r) => r.json()); return meta.file_id;} const [modelId, necklaceId] = await Promise.all([ uploadImage(modelFile), uploadImage(necklaceFile),]); const res = await fetch('https://developer-api.bogofit.ai/v1/accessory-fitting', { method: 'POST', headers: { ...headers, 'Content-Type': 'application/json' }, body: JSON.stringify({ model_image: modelId, // required accessory_image: necklaceId, // required }),});const job = await res.json(); async function waitForJob(jobId) { for (let i = 0; i < 60; i++) { const next = await fetch('https://developer-api.bogofit.ai/v1/jobs/' + jobId, { headers: { Authorization: `Bearer ${API_KEY}` }, }).then((r) => r.json()); if (next.status === 'succeeded' || next.status === 'failed' || next.status === 'cancelled') { return next; } await new Promise((r) => setTimeout(r, 2000)); } throw new Error('Timed out waiting for job (~2 min)');} const done = await waitForJob(job.id);if (done.status === 'succeeded') { console.log(done.output.resultUrl);} else { console.error(done.error);}피팅 POST는 이미지를 바로 주지 않습니다. job id만 돌려주고, 결과는 GET /v1/jobs/:id로 가져옵니다. Playground는 이 과정을 대신 해 줍니다.
한 줄로
POST로 작업을 넣고, 2초마다 상태를 확인한 뒤 succeeded일 때 resultUrl을 쓰면 됩니다. GET은 크레딧이 차감되지 않습니다.
흐름
이렇게 호출하세요
참고값 estimated_seconds(보통 약 25초). 최대 2분이면 대부분 끝납니다.
id*path피팅 POST 응답의 id (job_xxx)
| 파라미터 | 타입 | 설명 |
|---|---|---|
| id* | path | 피팅 POST 응답의 id (job_xxx) |
아래 코드를 복사해 job id만 넣으면 됩니다.
// mb_live_* — production · mb_test_* — Playground / sandbox// GET polling does not use credits. Stop when succeeded | failed | cancelled.const API_KEY = 'mb_live_YOUR_KEY'; async function waitForJob(jobId) { for (let i = 0; i < 60; i++) { const next = await fetch('https://developer-api.bogofit.ai/v1/jobs/' + jobId, { headers: { Authorization: `Bearer ${API_KEY}` }, }).then((r) => r.json()); if (next.status === 'succeeded' || next.status === 'failed' || next.status === 'cancelled') { return next; } await new Promise((r) => setTimeout(r, 2000)); } throw new Error('Timed out waiting for job (~2 min)');} const done = await waitForJob('job_xxx');if (done.status === 'succeeded') { console.log(done.output.resultUrl);} else { console.error(done.error);}idstring폴링에 쓰는 Job id (job_xxx)
statusqueued | processing | succeeded | failed | cancelledqueued → processing → succeeded | failed | cancelled
output.resultUrlstringsucceeded일 때만 있는 결과 이미지 URL
errorstringfailed일 때만 있는 오류 메시지
estimated_secondsnumber예상 소요 시간(초). 폴링 참고값이며 보장이 아닙니다.
| 필드 | 타입 | 설명 |
|---|---|---|
| id | string | 폴링에 쓰는 Job id (job_xxx) |
| status | queued | processing | succeeded | failed | cancelled | queued → processing → succeeded | failed | cancelled |
| output.resultUrl | string | succeeded일 때만 있는 결과 이미지 URL |
| error | string | failed일 때만 있는 오류 메시지 |
| estimated_seconds | number | 예상 소요 시간(초). 폴링 참고값이며 보장이 아닙니다. |
피팅 Job이 끝나거나 예산 임계값에 도달하면 등록한 HTTPS URL로 JSON을 POST합니다. Secret으로 HMAC-SHA256 서명을 검증하세요. 폴링이 번거로우면 웹훅이 더 편합니다.
개발자 콘솔 → 웹훅에서 URL을 등록하거나, 대시보드 JWT로 POST /v1/webhooks 를 호출합니다. Secret은 생성·회전 시 한 번만 표시되므로 서버에 안전하게 저장하세요.
로컬 개발은 ngrok 등 HTTPS 터널을 쓰세요. HTTP URL은 권장하지 않습니다.
| event | 설명 |
|---|---|
| job.succeeded | 피팅 Job 성공. output에 resultUrl 등이 포함됩니다. |
| job.failed | 피팅 Job 실패. error 메시지가 포함됩니다. |
| billing.threshold | 프로젝트 월 예산 Soft limit 50/80/100% 도달 시. |
| webhook.test | 콘솔의 테스트 발송으로 수동 전송. 연동 확인용. |
X-Bogofit-Signature*headerHMAC-SHA256(hex). `timestamp.event_id.rawBody`를 Secret으로 서명한 값. 헤더 형식: `sha256=<hex>`.
X-Bogofit-Timestamp*header서명에 사용한 Unix 초 단위 timestamp.
X-Bogofit-Event-Id*headerDelivery id (전송 기록 고유 ID).
X-Bogofit-Event*header이벤트 이름 (예: job.succeeded).
Content-Type*header항상 application/json.
| 파라미터 | 타입 | 설명 |
|---|---|---|
| X-Bogofit-Signature* | header | HMAC-SHA256(hex). `timestamp.event_id.rawBody`를 Secret으로 서명한 값. 헤더 형식: `sha256=<hex>`. |
| X-Bogofit-Timestamp* | header | 서명에 사용한 Unix 초 단위 timestamp. |
| X-Bogofit-Event-Id* | header | Delivery id (전송 기록 고유 ID). |
| X-Bogofit-Event* | header | 이벤트 이름 (예: job.succeeded). |
| Content-Type* | header | 항상 application/json. |
// job.succeeded{ "job_id": "job_1c85e7fb5c2d6a0c", "status": "succeeded", "output": { "resultUrl": "https://…/result.jpg", "mimeType": "image/jpeg", "mediaType": "IMAGE" }} // job.failed{ "job_id": "job_…", "status": "failed", "error": "provider timeout"} // billing.threshold{ "pct": 80, "used": 440, "budget": 550}`timestamp + "." + event_id + "." + rawBody`로 HMAC을 계산하세요(body만 서명하지 않음). 시각 오차 5분 초과는 거절하세요. 반드시 파싱 전 raw body로 검증합니다. 2xx가 아니면 재시도합니다.
// Express — use raw body for HMACconst crypto = require('crypto');const express = require('express');const app = express(); app.post( '/webhooks/bogofit', express.raw({ type: 'application/json' }), (req, res) => { const rawBody = req.body; // Buffer const sigHeader = req.get('x-bogofit-signature') || ''; const timestamp = req.get('x-bogofit-timestamp') || ''; const eventId = req.get('x-bogofit-event-id') || ''; const event = req.get('x-bogofit-event'); const sig = sigHeader.replace(/^sha256=/, ''); const signed = Buffer.concat([ Buffer.from(`${timestamp}.${eventId}.`, 'utf8'), rawBody, ]); const expected = crypto .createHmac('sha256', process.env.BOGOFIT_WEBHOOK_SECRET) .update(signed) .digest('hex'); const skew = Math.abs(Date.now() / 1000 - Number(timestamp)); if (skew > 300) return res.status(401).send('stale timestamp'); if (!crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected))) { return res.status(401).send('invalid signature'); } const payload = JSON.parse(rawBody.toString('utf8')); // handle event: job.succeeded | job.failed | billing.threshold | webhook.test console.log(event, payload); res.status(200).send('ok'); },);엔드포인트가 2xx가 아니면 최대 5회까지 재시도합니다(약 30s × 시도 횟수, 최대 1시간 간격). 콘솔에서 전송 기록 확인, 재전송, Secret 회전, 테스트 발송이 가능합니다.
project_id*string (uuid)프로젝트
url*string (https)Callback URL
eventsstring[]Default: job.succeeded, job.failed
| 파라미터 | 타입 | 설명 |
|---|---|---|
| project_id* | string (uuid) | 프로젝트 |
| url* | string (https) | Callback URL |
| events | string[] | Default: job.succeeded, job.failed |
// Dashboard JWT (console session) — not the Public API mb_* keyconst res = await fetch('https://developer-api.bogofit.ai/v1/webhooks', { method: 'POST', headers: { Authorization: 'Bearer <DASHBOARD_JWT>', 'Content-Type': 'application/json', }, body: JSON.stringify({ project_id: '<project-uuid>', url: 'https://your-server.com/webhooks/bogofit', events: ['job.succeeded', 'job.failed', 'billing.threshold'], }),});const { data } = await res.json();// data.secret — copy once // Also available:// GET /v1/webhooks?project_id=// POST /v1/webhooks/:id/test// POST /v1/webhooks/:id/rotate-secret// GET /v1/webhooks/:id/deliveries?project_id=// POST /v1/webhooks/:id/deliveries/:deliveryId/redeliver| HTTP 코드 | 설명 |
|---|---|
| 200 | 성공. 요청이 정상 처리되었습니다. |
| 400 | 잘못된 요청. 필수 필드 누락 또는 유효성 검사 실패. |
| 401 | 인증 실패. 잘못된 API 키 또는 Bearer 헤더 누락. |
| 403 | 접근 거부. 프로젝트 비활성 또는 지갑 잔액 부족. |
| 404 | 찾을 수 없음. 잘못된 엔드포인트 또는 레코드 없음. |
| 500 | 서버 오류. 일시적인 내부 처리 문제. |