# DOCX 파일을 PDF 파일로 변환



DOCX 문서 한 개를 업로드해 PDF 파일로 받습니다. 응답은 JSON이 아닌 PDF 파일입니다.



인증: Authorization: Bearer $APICK_API_KEY

본문 있는 REST 요청: multipart/form-data. GET 본문 및 MCP JSON-RPC 규격은 해당 명세를 따릅니다.

인증키는 서버에 보관하세요. 모든 예제는 정적 자료입니다.



## POST /rest/docx_to_pdf 응답 필드

## API 요청: POST /rest/docx_to_pdf



### 입력

- `docx` (file, 조건부): 첨부 파일. application/vnd.openxmlformats-officedocument.wordprocessingml.document. 최대 25MB. 같은 항목을 반복하면 파일 목록으로 전달됩니다.



### 응답 명세

```json

{
  "type": "object",
  "properties": {}
}

```

### curl

```curl

curl --fail-with-body --request POST 'https://apick.app/rest/docx_to_pdf' \
  --header "Authorization: Bearer $APICK_API_KEY" \
  --form 'docx=@document.docx' \
  --dump-header response.headers --output result.bin
# response.headers의 Content-Type을 확인한 뒤 파일을 사용하세요.

```

### Node.js (서버 ESM)

```javascript

import { readFile } from "node:fs/promises";
const form = new FormData();
form.append("docx", new Blob([await readFile("document.docx")]), "document.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()));

```

### python

```python

import os
import requests
parts = [
    ("docx", ("document.docx", open("document.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

```php

<?php
$headers = ["Authorization: Bearer " . getenv("APICK_API_KEY")];
$form = [
    'docx' => new CURLFile('document.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);

```

## 코드·오류

## 상세 기능·요금

이용 전 확인 성공한 변환 건당 80P가 차감됩니다. 파일이 없거나 변환에 실패한 응답의 비용은 0P입니다. 실제 차감액은 응답의 cost 헤더에서 확인하세요. REST 요청의 첨부파일 합계는 1GiB 이하여야 합니다. 처리시간이 초과되면 오류가 반환되며 파일 크기와 문서 구성에 따라 변환 시간이 달라집니다. MCP의 URL 파일 입력은 별도로 25MiB 제한을 적용합니다. 인증키는 서버 환경변수에 보관하세요. 공개 웹페이지나 저장소에 넣지 마세요.

## 상세 요청

항목설정 메서드·주소POST https://apick.app/rest/docx_to_pdf 인증 헤더Authorization: Bearer — 내 계정의 API 인증키 본문 형식multipart/form-data 필수 파일 필드docx — 변환할 DOCX 파일 한 개 요청 예시 환경변수에 인증키를 설정하고 document.docx를 준비한 뒤 실행합니다. 성공 시 과금되는 실제 요청입니다. form-data 전체 예제 보기 response-headers.txt에서 success: 1과 Content-Type: application/pdf를 확인한 뒤 response.bin을 PDF로 저장하세요. 오류 응답은 JSON이므로 파일 확장자만으로 성공을 판단하지 마세요.

## 상세 코드·정책

응답과 오류 복구 항목의미 성공 본문PDF 바이너리. 내려받기 파일명은 output.pdf입니다. 성공 헤더success: 1, 차감 포인트 cost, 처리시간 ms, URI 인코딩된 안내 msg HTTP 424파일 누락 또는 변환 실패. data.error를 확인하고 DOCX 파일과 필드 이름을 점검하세요. HTTP 408처리시간 초과. data.success: 3으로 구분합니다. 문서 크기를 줄인 뒤 다시 시도하거나 고객센터에 문의하세요. 오류 본문data.error, data.success, api.cost, api.success, api.ms를 확인합니다. api.success만으로 파일 변환 성공을 판단하지 마세요. 연결이 끊겨 최종 결과를 받지 못했다면 이용 내역을 먼저 확인하세요. 자동으로 반복 호출하면 중복 변환과 추가 과금이 발생할 수 있습니다.
