API 요청
/rest/face_blur요청 파라미터 2개 · 필수 1
imagethreshold응답 필드 파일
정상 응답은 파일 본문입니다. 실패 시 JSON 오류가 올 수 있으므로 HTTP 상태와 Content-Type을 먼저 확인하세요.
이미지 한 장을 올리면 사람 얼굴 영역을 모자이크한 JPEG 이미지를 돌려줍니다. 응답은 JSON이 아닌 이미지 파일입니다.
https://apick.app/rest/face_blur왜 얼굴 모자이크 처리인가
후기·현장 사진에 찍힌 행인 얼굴 하나가 초상권 분쟁과 신고로 번집니다. 이미지를 보내면 얼굴을 찾아 모자이크한 결과를 돌려줘 편집자 없이도 안심하고 게시할 수 있습니다.
REQUEST_TOO_LARGE 오류가 반환되며 과금되지 않습니다.
게시 전 사진의 얼굴을 가리거나, 현장 사진·CCTV 캡처를 공유하기 전에 개인 식별을 막을 때 사용합니다.
PNG·JPEG·WEBP·BMP 이미지를 받습니다. 결과는 원본 형식과 관계없이 JPEG입니다.
threshold는 얼굴 인식 민감도입니다. 값이 작을수록 흐릿하거나 작은 얼굴까지 가리고, 클수록 확실한 얼굴만 가립니다. 얼굴이 덜 가려지면 값을 낮추고, 얼굴이 아닌 곳까지 가려지면 값을 높여 다시 요청하세요.
성공한 건당 20P입니다. 얼굴이 없어도 처리된 이미지가 반환되면 성공입니다. 실패·시간 초과 응답은 과금되지 않습니다.
/rest/face_blurimagethreshold정상 응답은 파일 본문입니다. 실패 시 JSON 오류가 올 수 있으므로 HTTP 상태와 Content-Type을 먼저 확인하세요.
POST https://apick.app/rest/face_blurAuthorization: Bearer 내 계정의 API 인증키multipart/form-data상황별로 보내는 값과 응답에서 확인할 값을 모았습니다. 언어 탭에서 그대로 복사해 쓸 수 있습니다.
기본 민감도로 사진 속 얼굴을 모두 모자이크합니다.
/rest/face_blurcurl --fail-with-body --request POST 'https://apick.app/rest/face_blur' \
--header "Authorization: Bearer $APICK_API_KEY" \
--form 'image=@./group_photo.jpg' \
--dump-header response.headers --output result.bin
# response.headers의 Content-Type을 확인한 뒤 파일을 사용하세요.import { readFile } from "node:fs/promises";
const form = new FormData();
form.append("image", new Blob([await readFile("./group_photo.jpg")]), "group_photo.jpg");
const response = await fetch("https://apick.app/rest/face_blur", {
method: "POST",
headers: { Authorization: "Bearer " + process.env.APICK_API_KEY },
body: form,
signal: AbortSignal.timeout(120_000),
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
if ((response.headers.get("content-type") || "").includes("json")) {
throw new Error(JSON.stringify(await response.json()));
}
const { writeFile } = await import("node:fs/promises");
await writeFile("result.bin", new Uint8Array(await response.arrayBuffer()));import os
import requests
parts = [
("image", ("group_photo.jpg", open("./group_photo.jpg", "rb"))),
]
response = requests.request("POST", "https://apick.app/rest/face_blur",
headers={"Authorization": "Bearer " + os.environ["APICK_API_KEY"]},
files=parts,
timeout=(10, 120), stream=True)
response.raise_for_status()
if "json" in response.headers.get("Content-Type", ""):
raise RuntimeError(response.json())
with open("result.bin", "wb") as output:
for chunk in response.iter_content(65536):
output.write(chunk)<?php
$headers = ["Authorization: Bearer " . getenv("APICK_API_KEY")];
$form = [
'image' => new CURLFile('./group_photo.jpg'),
];
$curl = curl_init('https://apick.app/rest/face_blur');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => $headers,
CURLOPT_POSTFIELDS => $form,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_TIMEOUT => 120,
]);
$body = curl_exec($curl);
if ($body === false) { throw new RuntimeException(curl_error($curl)); }
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$type = curl_getinfo($curl, CURLINFO_CONTENT_TYPE) ?: "";
curl_close($curl);
if ($status >= 400) { throw new RuntimeException($body); }
if (strpos($type, "json") !== false) { throw new RuntimeException($body); }
file_put_contents('result.bin', $body);face_count가 가린 얼굴 수입니다. 0이면 가린 얼굴이 없습니다.행사장·거리 사진처럼 작은 얼굴이 많으면 민감도 값을 낮춥니다.
/rest/face_blurcurl --fail-with-body --request POST 'https://apick.app/rest/face_blur' \
--header "Authorization: Bearer $APICK_API_KEY" \
--form 'image=@./street.jpg' \
--form-string 'threshold=0.3' \
--dump-header response.headers --output result.bin
# response.headers의 Content-Type을 확인한 뒤 파일을 사용하세요.import { readFile } from "node:fs/promises";
const form = new FormData();
form.append("image", new Blob([await readFile("./street.jpg")]), "street.jpg");
form.append("threshold", "0.3");
const response = await fetch("https://apick.app/rest/face_blur", {
method: "POST",
headers: { Authorization: "Bearer " + process.env.APICK_API_KEY },
body: form,
signal: AbortSignal.timeout(120_000),
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
if ((response.headers.get("content-type") || "").includes("json")) {
throw new Error(JSON.stringify(await response.json()));
}
const { writeFile } = await import("node:fs/promises");
await writeFile("result.bin", new Uint8Array(await response.arrayBuffer()));import os
import requests
parts = [
("image", ("street.jpg", open("./street.jpg", "rb"))),
("threshold", (None, "0.3")),
]
response = requests.request("POST", "https://apick.app/rest/face_blur",
headers={"Authorization": "Bearer " + os.environ["APICK_API_KEY"]},
files=parts,
timeout=(10, 120), stream=True)
response.raise_for_status()
if "json" in response.headers.get("Content-Type", ""):
raise RuntimeError(response.json())
with open("result.bin", "wb") as output:
for chunk in response.iter_content(65536):
output.write(chunk)<?php
$headers = ["Authorization: Bearer " . getenv("APICK_API_KEY")];
$form = [
'image' => new CURLFile('./street.jpg'),
'threshold' => '0.3',
];
$curl = curl_init('https://apick.app/rest/face_blur');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => $headers,
CURLOPT_POSTFIELDS => $form,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_TIMEOUT => 120,
]);
$body = curl_exec($curl);
if ($body === false) { throw new RuntimeException(curl_error($curl)); }
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$type = curl_getinfo($curl, CURLINFO_CONTENT_TYPE) ?: "";
curl_close($curl);
if ($status >= 400) { throw new RuntimeException($body); }
if (strpos($type, "json") !== false) { throw new RuntimeException($body); }
file_put_contents('result.bin', $body);face_count가 기대보다 적으면 threshold를 더 낮추고, 얼굴이 아닌 곳까지 가려지면 높여서 다시 요청하세요.threshold는 0~0.9 범위여야 합니다.HTTP 성공과 업무 결과를 구분하세요. 경로별 응답 필드와 예시는 위 요청과 응답에 함께 있습니다.
성공하면 모자이크된 JPEG 본문이 바로 옵니다. 내려받기 파일명은 output.jpg입니다.
1이면 처리에 성공한 것입니다.0이면 가린 얼굴이 없으므로 원본과 거의 같은 이미지입니다.image/jpeg응답을 아래 순서로 확인하세요. 결과 유무와 과금 여부는 서로 다릅니다.
실패하면 이미지 대신 JSON이 옵니다. HTTP 상태와 Content-Type을 먼저 확인하고, JSON이면 data.error 문구를 기록하세요. 실패 응답의 api.cost는 0입니다.
threshold를 0~0.9 사이 숫자로 보내세요.image로 보냈는지 확인하세요.data.success가 3입니다. 이미지 해상도를 줄여 다시 요청하세요.FORM_DATA_INVALIDFORM_DATA_FIELD_CONFLICTMULTIPART_LIMIT_OR_PARSE_ERROR실제 차감 금액은 응답의 api.cost로 확인하세요. 상세 요금은 요금정책에서 볼 수 있습니다.
같은 요청을 JavaScript와 Python으로 옮긴 예시입니다. 키는 환경변수 APICK_API_KEY 에서 읽습니다.