이미지 레이어 분리
신규평면 이미지를 순서가 있는 편집 가능한 레이어로 나눕니다.
/v2/open/image/layering13 크레딧 / 호출입력
https://static.codia.ai/site/develop-sandbox/2026-10-04/3b582b39-b0f6-4bda-96fa-a89e3eeaffef-velora-promo-poster.png
1080 × 1350 px · PNG · 189 KB이 페이지에서 바로 실행하는 기능은 곧 제공됩니다. 아래는 API의 실제 요청과 출력입니다. 키를 만들어 직접 실행해 보세요.
출력
예시13 크레딧 / 호출



LAUNCH OFFER30%SHOP NOWskin tone.Vitamin C + hyaluronic acid for a brighter, evenGlow SerumSKINCARE · NEWVELORAJSON 출력으로 다시 그린 결과입니다. 레이어에 마우스를 올리면 위치가 표시됩니다.
- VELORAVELORA텍스트
- SKINCARE · NEWSKINCARE · NEW텍스트
- Glow SerumGlow Serum텍스트
- Vitamin C + hyaluronic acid for a brighter, evenVitamin C + hyaluronic acid for a bright텍스트
- skin tone.skin tone.텍스트
- SHOP NOWSHOP NOW텍스트
- 30%30%텍스트
- LAUNCH OFFERLAUNCH OFFER텍스트
Image이미지
Image이미지
Image이미지
Image이미지
Image이미지

평면 이미지를 개별적으로 편집할 수 있는 순서 있는 레이어 스택(배경, 피사체, 텍스트, 오버레이)으로 분리합니다.
- 활용 사례
- 평면 마케팅 이미지를 편집 가능하게 만들기
- 합성용 에셋 준비
- 레이어별로 따로 애니메이션 적용
- 입력
- 공개 이미지 URL 또는 업로드한 이미지 파일.
- 출력
- data.dsl: JSON으로 인코딩된 디자인 트리로, 각 레이어에 위치와 이미지 URL이 포함됩니다. 클라이언트에서 파싱하십시오.
- 실행 방식
- 동기 방식입니다.
전체 기술 레퍼런스(영어)
Cost: 13 credits per successful call.
Image Layering supports two input modes:
- JSON URL mode: send
application/jsonwith the existing URL field. - Direct upload mode: send
multipart/form-datawith a local image file in theimagefield. The compatible field namefileis also accepted for the primary image. Codia checks credits before reading and uploading the file, so insufficient-credit requests return402without uploading anything.
Direct upload example:
curl 'https://openapi.codia.ai/v2/open/image/layering' \
-H 'Authorization: Bearer {codia_api_key}' \
-F 'image=@./image.png'Decompose a single image into an ordered stack of editable layers — background, subject(s), and overlays — each rendered separately. The output is a JSON DSL describing the layer tree plus the per-layer image data. Use this when you want a designer-style PSD-equivalent, not a single flat composition.
What this API is for
Turning a flat marketing image back into editable components; pre-processing for downstream compositing; setting up animated reveals where each layer animates separately; segmenting photo content for fine-grained editing.
Different from image_to_design: that one returns a structural design-tree (Body / Layer / Text / Image nodes with positions and styles). image_layering returns visual layers (independent rendered images that you can stack). They complement each other.
Request
| Field | Required | Notes |
|---|---|---|
image_url | yes | Public URL of the image to decompose. |
No model parameter — uses Codia's layering pipeline.
Response
Unique to this endpoint:
| Field | Type | Meaning |
|---|---|---|
data.type | integer | Result-type code. Identifies the schema variant of dsl. |
data.dsl | string | JSON-encoded layer tree. Parse client-side. Contains layer metadata + URLs to the rendered layer images. |
{ "code": 0, "message": "ok", "data": { "type": 1, "dsl": "{\"layers\":[…]}" } }The dsl field is intentionally a string (not a nested object) so you can store it verbatim or stream it without re-encoding.
Billing & limits
- 13 credits per request from the unified Codia Open API balance.
- Synchronous.
Errors
Standard set.
Sync vs. async This synchronous endpoint returns the result inline — the simplest path. For production pipelines that need webhook delivery, automatic retry with idempotency, or explicit task cancellation, call
POST /v2/open/taskswithoperation=image_layeringinstead. Inputs and credit cost are identical.
설치 및 설정
API 키를 런타임의 환경 변수로 저장하세요.
export CODIA_API_KEY="your-api-key"인증
키를 Bearer 토큰으로 전송하세요. 키는 대시보드에서 생성하고 폐기합니다.
Authorization: Bearer <your-api-key>요청 보내기
JSON 요청은 공개 URL을 받습니다. multipart/form-data를 지원하는 엔드포인트는 파일을 직접 업로드할 수도 있습니다.
https://openapi.codia.ai·13 크레딧 / 호출이 예제는 Sandbox 예시와 같은 요청을 보내므로 CODIA_API_KEY만 설정하면 바로 실행됩니다. URL은 직접 공개한 파일로 바꿔 쓰세요.
curl -X POST 'https://openapi.codia.ai/v2/open/image/layering' \
-H "Authorization: Bearer $CODIA_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"image_url": "https://static.codia.ai/site/develop-sandbox/2026-10-04/3b582b39-b0f6-4bda-96fa-a89e3eeaffef-velora-promo-poster.png"
}'curl -X POST 'https://openapi.codia.ai/v2/open/image/layering' \
-H "Authorization: Bearer $CODIA_API_KEY" \
-F 'image=@./product.jpg'요청 파라미터
Idempotency-Keystring · header선택사용자가 지정하는 선택적 키(최대 255자). 설정하면 성공한(2xx) 응답이 7일 동안 캐시됩니다. 같은 키와 동일한 요청 본문으로 재시도하면 캐시된 응답이 반환되며 크레딧이 추가로 차감되지 않습니다. 같은 키로 다른 본문을 보내면 409가 반환됩니다. 네트워크 장애 시 POST를 안전하게 재시도할 수 있도록 하려면 이 키를 사용합니다. multipart/form-data 업로드는 폼 필드와 파일 내용으로 요청을 비교하므로, 클라이언트가 새 multipart boundary를 선택하더라도 재시도한 업로드에도 캐시된 응답이 반환됩니다.
image_urlstring필수레이어로 분해할 이미지의 공개 URL
imagefile필수원본 이미지 파일
filefile선택지원 중단호환용 원본 이미지 파일 필드(지원 중단: 대신 image를 사용하십시오).
image_urlstring선택이미지를 업로드하지 않을 때 사용하는 원본 이미지 URL
응답 스키마
200레이어 분해 결과
codeintegermessagestringdataobjectdata.typeinteger레이어 분해 결과 유형
data.dslstringJSON으로 인코딩된 편집 가능한 레이어 트리
{
"code": 0,
"message": "ok",
"data": {
"type": 1,
"dsl": "{\"elementId\":\"root_001\"}"
}
}오류 코드
오류도 같은 응답 구조를 사용합니다. code는 HTTP 상태 코드와 같고, message는 원인을 설명하며, data는 null입니다. 일부 오류에는 details 객체가 추가됩니다. message 문구가 아닌 상태 코드로 분기하세요.
{
"code": 401,
"message": "Unauthorized",
"data": null
}| 상태 | 설명 |
|---|---|
| 400 | 요청 본문의 형식이 잘못되었거나 필수 매개변수가 누락되었습니다 |
| 401 | API 키가 없거나, 유효하지 않거나, 폐기되었습니다 |
| 402 | 계정 잔액이 부족하거나 구독이 만료되었습니다 |
| 403 | 계정에 이 엔드포인트에 대한 액세스 권한이 없습니다 |
| 409 | Idempotency-Key가 다른 요청 본문과 함께 재사용되었습니다. |
| 429 | 속도 제한에 도달했습니다. `Retry-After` 헤더에 표시된 초만큼 기다린 후 재시도하십시오. |
| 500 | 서버에서 예기치 않은 오류가 발생했습니다 |


