REST API v1

img2htm API 문서

한 번의 API 호출로 이미지를 프로덕션 HTML로
img2htm API는 이미지 파일 또는 URL을 받아 HTML, CSS, 분리 이미지, 구조화 JSON, 품질 리포트를 반환합니다.

시작하기

img2htm API는 이미지 파일 또는 URL을 받아 HTML, CSS, 분리 이미지, 구조화 JSON, 품질 리포트를 반환합니다. 매월 첫 50회 미리보기 호출은 무료입니다.

  1. 계정 만들기 → 대시보드에서 키 발급
  2. POST https://img2htm.com/api/v1/reconstruct with image_file, image_url or image_file_b64.
  3. Receive HTML, CSS, separated assets, structured JSON and a quality report in one response.

쉬운 통합

cURL, Node.js, Python, PHP, Ruby, Java, .NET, Swift 예제를 제공합니다.

HTML + CSS + JSON

한 번의 API 호출로 HTML·CSS·분리 이미지·구조화 JSON·품질 리포트를 받으세요.

크레딧이란?

1 크레딧으로 세로 15,000 px까지의 이미지 1장을 전체 변환할 수 있습니다. 더 긴 이미지는 자동으로 여러 크레딧이 계산됩니다. 미리보기는 무료입니다.

인증

API 키는 Authorization: Bearer 헤더 또는 X-Api-Key 헤더로 전달합니다.

Authorization: Bearer i2h_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# or
X-Api-Key: i2h_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

샘플 코드

curl -X POST https://img2htm.com/api/v1/reconstruct \
  -H "Authorization: Bearer i2h_your_api_key" \
  -F "image_file=@product-page.jpg" \
  -F "mode=full" \
  -F "format=json"

출력 형식

format설명
jsonDefault. JSON object with html, css, content (structured sections + texts), assets (separated image URLs), quality and urls.
htmlReturns the reconstructed index.html document directly (text/html).
zipStreams a ZIP with index.html, styles.css, content.json, quality.json, sections/ and assets/.

응답

{
  "id": "3f9a1c2b7d4e6f80a1b2",
  "status": "done",
  "mode": "full",
  "credits_used": 2,
  "width": 860,
  "height": 24000,
  "sections": 16,
  "quality": {
    "text_accuracy": 97.4,
    "visual_fidelity": 94.1,
    "structure": 95.2,
    "sections": 16,
    "seconds": 41.8,
    "provider": "anthropic:claude-sonnet-5",
    "review": [],
    "auto_pass": true
  },
  "urls": {
    "html": "https://img2htm.com/api/v1/jobs/3f9a1c2b7d4e6f80a1b2/html",
    "zip": "https://img2htm.com/en/convert/3f9a1c2b7d4e6f80a1b2/download",
    "preview": "https://img2htm.com/en/convert/3f9a1c2b7d4e6f80a1b2/preview"
  },
  "assets": ["https://img2htm.com/files/results/3f9a1c2b7d4e6f80a1b2/assets/s01-a01.png"],
  "html": "<!DOCTYPE html> ...",
  "css": "/* img2htm base styles */ ...",
  "content": { "sections": [ ... ], "texts": [ ... ] }
}

API 레퍼런스

Reconstruct an image

POST/api/v1/reconstruct
파라미터타입설명
image_file 필수*fileMultipart upload. JPG, PNG or WebP, up to 25 MB. *One of image_file, image_url, image_file_b64 is required.
image_urlstringPublic HTTP(S) URL of the image.
image_file_b64stringBase64-encoded image data.
mode 선택full | previewfull (default) converts the whole image and charges 1 credit per 15,000 vertical px. preview converts only the top 3,000 px for free.
lang 선택stringOutput document language tag: ko, en, cn, tw, ja, mn, ru, th, id, vi, ar. Text is kept in its source language; this sets <html lang>/dir.
format 선택json | html | zipResponse format (see above).
async 선택1Deprecated (always asynchronous): POST /reconstruct returns 202 Accepted with status: processing and a poll URL; poll GET /api/v1/jobs/{id} every 30–60 s until status: done (typically 30–45 min).

Get a job

GET/api/v1/jobs/{id}

Returns the job object. Add ?include_html=1 to embed html, css and content.

Get the HTML document

GET/api/v1/jobs/{id}/html

Returns index.html as text/html.

Account

GET/api/v1/account
{ "email": "you@example.com", "credits": 38, "pixels_per_credit": 15000, "key": "i2h_ab12cd34…", "calls": 1207 }

이미지 생성 API

텍스트→이미지 생성, 이미지 바리에이션, 이미지 안의 글자를 번역해 다시 그리는 렌더링 번역. 모두 비동기이며 결과 이미지는 절대 URL로 돌려주고, 곧바로 HTML 재구성에 이어 붙일 수 있습니다.

1) POST /api/v1/images/variations   → 202 { "jobs":[{ "id":"…", "status":"processing", "poll":"…" }] }
2) GET  /api/v1/images/{id}          → { "status":"processing" }   (poll every 3–5 s, usually 40–90 s)
3) GET  /api/v1/images/{id}          → { "status":"done", "images":["https://img2htm.com/files/generated/….jpg"] }
4) POST /api/v1/images/{id}/reconstruct → 202 HTML reconstruction job (poll GET /api/v1/jobs/{id})

Text → image

POST/api/v1/images/generate
파라미터타입설명
prompt 필수stringGeneration prompt (any language).
count1–4Number of images (one job each). Default 1.
ratioauto 1:1 4:3 3:4 16:9 9:16Aspect ratio. Default auto.
resolution1K 2K 4KDefault 2K.
curl -X POST https://img2htm.com/api/v1/images/generate \
  -H "Authorization: Bearer i2h_your_api_key" -H "Content-Type: application/json" \
  -d '{"prompt":"Minimal skincare product hero shot on white marble, studio light","ratio":"1:1","resolution":"2K"}'

Image → variations

POST/api/v1/images/variations
파라미터타입설명
image_file / image_url / image_file_b64file | stringSource image (one of these, or source_id / job_id).
source_idstringId of a finished image job (optionally id#index) — chain variations of variations.
job_idstringId of a reconstruction job — reuse the image you already uploaded.
promptstringOptional instruction; the default keeps the product and style and changes composition/background.
count, ratio, resolutionSame as generate.
curl -X POST https://img2htm.com/api/v1/images/variations \
  -H "Authorization: Bearer i2h_your_api_key" \
  -F "image_file=@product.jpg" -F "count=2" -F "prompt=same product, night beach background"

Image translation (rendered)

POST/api/v1/images/translate

Re-renders the image with every visible text translated into lang (layout, colours and product photos are preserved). Same source parameters as variations plus:

파라미터타입설명
lang 필수stringTarget language: en ko ja cn tw vi th id ru mn ar es fr de pt it hi tr ms tl (see GET /api/v1/translate/languages).
curl -X POST https://img2htm.com/api/v1/images/translate \
  -H "Authorization: Bearer i2h_your_api_key" -H "Content-Type: application/json" \
  -d '{"image_url":"https://example.com/detail-ko.jpg","lang":"ja"}'

Get / list image jobs

GET/api/v1/images/{id}
GET/api/v1/images?status=done&kind=variation&limit=50&page=1
{
  "ok": true, "id": "9c1f…", "kind": "variation", "status": "done", "progress": 100,
  "prompt": "same product, night beach background", "ratio": "auto", "resolution": "2K",
  "images": ["https://img2htm.com/files/generated/9c1f…-1.jpg"], "gen_seconds": 71.3,
  "credits_used": 0, "created_at": "2026-09-04 13:20:11", "finished_at": "2026-09-04 13:21:30",
  "poll": "https://img2htm.com/api/v1/images/9c1f…"
}

status: pending → processing → done | failed (error holds the reason; credits are refunded).

Generated image → HTML

POST/api/v1/images/{id}/reconstruct

Creates a reconstruction job from a finished image (index selects the image, default 0; mode full|preview; lang as in /reconstruct). Returns 202 with the job id — poll GET /api/v1/jobs/{id} like any reconstruction.

번역 · OCR API

Gemini 기반 텍스트 번역과 이미지 OCR(+번역). 동기 호출이며 몇 초 안에 응답합니다.

Text translation

POST/api/v1/translate
파라미터타입설명
text or textsstring | string[]One text, or up to 500 strings (max 60,000 characters per request).
target_lang 필수stringTarget language code.
source_langstringOptional; auto-detected by default.
curl -X POST https://img2htm.com/api/v1/translate \
  -H "Authorization: Bearer i2h_your_api_key" -H "Content-Type: application/json" \
  -d '{"text":"리뷰티 스튜디오는 이미지 생성 API를 제공합니다.","target_lang":"en"}'
# → { "ok":true, "target_lang":"en", "model":"gemini-…", "translation":"Rebeauty Studio provides an image generation API." }

Image OCR (+ translation)

POST/api/v1/ocr
파라미터타입설명
image_file / image_url / image_file_b64 필수file | stringImage to read.
translate_tostringOptional target language: returns text (original) and translation.
curl -X POST https://img2htm.com/api/v1/ocr -H "Authorization: Bearer i2h_your_api_key" \
  -F "image_file=@banner.png" -F "translate_to=en"
# → { "ok":true, "text":"…extracted…", "translation":"…" }
GET/api/v1/translate/languages

Supported language codes and names.

요청 한도

분당 60 이미지 per API key. When exceeded the API responds 429 Too Many Requests with a Retry-After: 60 header. Enterprise plans can raise this limit.

지수 백오프

On 429 or 5xx, retry with exponential backoff: wait 1s, 2s, 4s, 8s … up to 5 attempts, adding random jitter. Never retry 4xx errors other than 429.

delay = min(60, (2 ** attempt) + random(0, 1))

오류 코드

HTTP설명
400Missing image or unreadable URL.
401Missing, invalid or revoked API key.
402Insufficient credits. Response includes credits_needed and credits_available.
413File exceeds the upload limit.
415Unsupported image type.
429Rate limit exceeded.
500Conversion failed. Credits charged for the job are refunded automatically; error contains the reason.

라이브러리와 도구

API 변경 이력

API 변경 이력

이미지 속에 갇힌 웹을 지금 되찾으세요

가입 즉시 무료 크레딧을 드립니다. 신용카드가 필요 없습니다.