API 요청
/rest/docx_to_pdf요청 파라미터 1개 · 필수 1
docx응답 필드 파일
정상 응답은 파일 본문입니다. 실패 시 JSON 오류가 올 수 있으므로 HTTP 상태와 Content-Type을 먼저 확인하세요.
DOCX 문서 한 개를 업로드해 PDF 파일로 받습니다. 응답은 JSON이 아닌 PDF 파일입니다.
https://apick.app/rest/docx_to_pdf왜 DOCX 파일을 PDF 파일로 변환인가
DOCX 파일을 그대로 보내면 받는 쪽 환경에 따라 글꼴과 줄이 깨지고 내용이 고쳐질 위험도 있습니다. DOCX를 PDF로 변환해 모양이 고정된 문서로 내보냅니다.
견적서·계약서처럼 Word로 만든 문서를 고객에게 보내거나 보관용으로 고정할 때 사용합니다. DOCX 형식만 받으며, 예전 형식(DOC)은 DOCX로 다시 저장한 뒤 올리세요.
성공한 변환 건당 80P가 차감됩니다. 파일이 없거나 변환에 실패한 응답의 비용은 0P입니다. 실제 차감액은 응답의 cost 헤더에서 확인하세요.
REST 요청의 첨부파일 합계는 1GiB 이하여야 합니다. 파일 크기와 문서 구성에 따라 변환 시간이 달라지며, 처리 시간이 초과되면 오류가 반환됩니다. MCP 도구에서 URL로 파일을 넘길 때는 25MiB까지 받습니다.
/rest/docx_to_pdfdocx정상 응답은 파일 본문입니다. 실패 시 JSON 오류가 올 수 있으므로 HTTP 상태와 Content-Type을 먼저 확인하세요.
POST https://apick.app/rest/docx_to_pdfAuthorization: Bearer 내 계정의 API 인증키multipart/form-data환경변수에 인증키를 설정하고 document.docx를 준비한 뒤 실행합니다. 성공 시 과금되는 실제 요청입니다.
response-headers.txt에서 success: 1과 Content-Type: application/pdf를 확인한 뒤 response.bin을 PDF로 저장하세요. 오류 응답은 JSON이므로 파일 확장자만으로 성공을 판단하지 마세요.
상황별로 보내는 값과 응답에서 확인할 값을 모았습니다. 언어 탭에서 그대로 복사해 쓸 수 있습니다.
Word로 만든 문서를 고객에게 보내기 전에 PDF로 고정합니다.
/rest/docx_to_pdfcurl --fail-with-body --request POST 'https://apick.app/rest/docx_to_pdf' \
--header "Authorization: Bearer $APICK_API_KEY" \
--form 'docx=@./quote.docx' \
--dump-header response.headers --output result.bin
# response.headers의 Content-Type을 확인한 뒤 파일을 사용하세요.import { readFile } from "node:fs/promises";
const form = new FormData();
form.append("docx", new Blob([await readFile("./quote.docx")]), "quote.docx");
const response = await fetch("https://apick.app/rest/docx_to_pdf", {
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 = [
("docx", ("quote.docx", open("./quote.docx", "rb"))),
]
response = requests.request("POST", "https://apick.app/rest/docx_to_pdf",
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 = [
'docx' => new CURLFile('./quote.docx'),
];
$curl = curl_init('https://apick.app/rest/docx_to_pdf');
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);success가 1이고 Content-Type이 application/pdf이면 본문을 PDF로 저장합니다.data.error를 확인하고 필드 이름이 docx인지 점검하세요.오래된 형식이나 손상된 문서는 실패할 수 있습니다. 문서 편집기에서 DOCX로 다시 저장한 파일로 요청합니다.
/rest/docx_to_pdfcurl --fail-with-body --request POST 'https://apick.app/rest/docx_to_pdf' \
--header "Authorization: Bearer $APICK_API_KEY" \
--form 'docx=@./resaved.docx' \
--dump-header response.headers --output result.bin
# response.headers의 Content-Type을 확인한 뒤 파일을 사용하세요.import { readFile } from "node:fs/promises";
const form = new FormData();
form.append("docx", new Blob([await readFile("./resaved.docx")]), "resaved.docx");
const response = await fetch("https://apick.app/rest/docx_to_pdf", {
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 = [
("docx", ("resaved.docx", open("./resaved.docx", "rb"))),
]
response = requests.request("POST", "https://apick.app/rest/docx_to_pdf",
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 = [
'docx' => new CURLFile('./resaved.docx'),
];
$curl = curl_init('https://apick.app/rest/docx_to_pdf');
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);api.cost 0). 같은 파일로 자동 반복 호출하지 마세요.HTTP 성공과 업무 결과를 구분하세요. 경로별 응답 필드와 예시는 위 요청과 응답에 함께 있습니다.
응답을 아래 순서로 확인하세요. 결과 유무와 과금 여부는 서로 다릅니다.
output.pdf입니다.success: 1, 차감 포인트 cost, 처리시간 ms, URI 인코딩된 안내 msgdata.error를 확인하고 DOCX 파일과 필드 이름 docx를 점검하세요.data.success: 3으로 구분합니다. 문서 크기를 줄인 뒤 다시 시도하세요.data.error, data.success, api.cost, api.success, api.ms를 확인합니다. api.success만으로 파일 변환 성공을 판단하지 마세요.연결이 끊겨 최종 결과를 받지 못했다면 이용 내역을 먼저 확인하세요. 자동으로 반복 호출하면 중복 변환과 추가 과금이 발생할 수 있습니다.
FORM_DATA_INVALIDFORM_DATA_FIELD_CONFLICTMULTIPART_LIMIT_OR_PARSE_ERROR실제 차감 금액은 응답의 api.cost로 확인하세요. 상세 요금은 요금정책에서 볼 수 있습니다.
같은 요청을 JavaScript와 Python으로 옮긴 예시입니다. 키는 환경변수 APICK_API_KEY 에서 읽습니다.