BetaPDF Developer API
REST API chuyển PDF + ảnh (jpg/png/webp) sang Markdown + JSON cấu trúc, tối ưu cho ChatGPT, Claude và pipeline RAG.
Xem bảng giá →Bắt đầu nhanh
Lấy API key, gửi PDF hoặc ảnh chụp, nhận Markdown. Ba dòng lệnh.
# Accepts PDF (≤10 pages) or image (jpg/png/webp, ≤20MB)
curl -X POST https://betapdf.com/api/v1/parse \
-H "Authorization: Bearer beta_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
-F "file=@input.pdf"
# Or: -F "file=@photo.jpg"Thử API trực tiếp
Upload PDF và xem bbox overlay trong playground tương tác (gói Pro hoặc Business, đã đăng nhập).
Xác thực
Mọi request cần Bearer token. API mở cho gói Pro ($9.99/tháng, 1.000 trang) và Business ($29.99/tháng, 5.000 trang) — gói Free KHÔNG tạo được key. Lấy key tại /account/api-keys sau khi nâng cấp. Plaintext chỉ hiện MỘT lần khi tạo — lưu như mật khẩu.
Authorization: Bearer beta_live_xxxxxxxxxxxxxxxxxxxxxxxxEndpoints
POST /v1/parse — Đồng bộ
Dùng cho PDF ≤ 10 trang hoặc 1 ảnh (jpg/png/webp). Block cho đến khi xong (~7-30s). Trả toàn bộ kết quả inline. PDF lớn hơn dùng endpoint async.
# Accepts PDF (≤10 pages) or image (jpg/png/webp, ≤20MB)
curl -X POST https://betapdf.com/api/v1/parse \
-H "Authorization: Bearer beta_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
-F "file=@input.pdf"
# Or: -F "file=@photo.jpg"POST /v1/parse/jobs — Bất đồng bộ
Trả 202 + job_id ngay. Dùng cho PDF lên đến 50 trang (ảnh cũng dùng được nhưng sync nhanh hơn). Poll GET /v1/parse/jobs/{id}; lấy kết quả GET /v1/parse/jobs/{id}/result khi status=completed.
# Accepts PDF (≤50 pages) or image (jpg/png/webp, ≤20MB)
curl -X POST https://betapdf.com/api/v1/parse/jobs \
-H "Authorization: Bearer beta_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
-F "file=@input.pdf"curl https://betapdf.com/api/v1/parse/jobs/JOB_ID \
-H "Authorization: Bearer beta_live_xxxxxxxxxxxxxxxxxxxxxxxx"curl https://betapdf.com/api/v1/parse/jobs/JOB_ID/result \
-H "Authorization: Bearer beta_live_xxxxxxxxxxxxxxxxxxxxxxxx"GET /v1/usage
Xem số trang đã dùng tháng này và quota còn lại.
curl https://betapdf.com/api/v1/usage \
-H "Authorization: Bearer beta_live_xxxxxxxxxxxxxxxxxxxxxxxx"Shape Response
{
"markdown": "# Heading\n\nParagraph text...\n",
"chunks": [
{
"id": "a1b6...",
"type": "title", // title | paragraph | table | figure | formula
"markdown": "Heading",
"grounding": {
"page": 0,
"box": {"left": 386, "top": 51, "right": 687, "bottom": 82},
"box_normalized": {"left": 0.386, "top": 0.051, "right": 0.687, "bottom": 0.082}
}
},
{
"id": "f2c3...",
"type": "table",
"markdown": "<table><tr><td>STT</td><td>Item</td></tr>...</table>",
"grounding": {
"page": 1,
"box": {"left": 23, "top": 250, "right": 977, "bottom": 720},
"box_normalized": {"left": 0.023, "top": 0.25, "right": 0.977, "bottom": 0.72}
}
}
],
"metadata": {
"filename": "input.pdf",
"page_count": 9,
"duration_ms": 22458,
"credits_used": 9,
"job_id": "994dc1f9-d20c-4384-8e3c-f99b8e59c524",
"version": "2026.05",
"pages": [
{ "page_no": 0, "width": 595.3, "height": 841.9, "unit": "pdf_point",
"bbox_width": 1000.0, "bbox_height": 1000.0 }
]
}
}Code mẫu
Python
import httpx
with httpx.Client(timeout=90) as c, open("input.pdf", "rb") as f:
r = c.post(
"https://betapdf.com/api/v1/parse",
headers={"Authorization": "Bearer beta_live_xxxxxxxxxxxxxxxxxxxxxxxx"},
files={"file": ("input.pdf", f, "application/pdf")},
)
data = r.json()
print(data["markdown"])
for chunk in data["chunks"]:
print(chunk["type"], chunk["grounding"]["page"], chunk["markdown"][:60])Python (async)
import httpx, time
KEY = "beta_live_xxxxxxxxxxxxxxxxxxxxxxxx"
# 1. submit
with httpx.Client(timeout=60) as c, open("input.pdf", "rb") as f:
r = c.post(
"https://betapdf.com/api/v1/parse/jobs",
headers={"Authorization": f"Bearer {KEY}"},
files={"file": ("input.pdf", f, "application/pdf")},
)
job_id = r.json()["job_id"]
# 2. poll
while True:
s = httpx.get(
f"https://betapdf.com/api/v1/parse/jobs/{job_id}",
headers={"Authorization": f"Bearer {KEY}"},
).json()
if s["status"] in ("completed", "failed"):
break
time.sleep(3)
# 3. result
if s["status"] == "completed":
r = httpx.get(
f"https://betapdf.com/api/v1/parse/jobs/{job_id}/result",
headers={"Authorization": f"Bearer {KEY}"},
)
print(r.json()["markdown"])Node.js / TypeScript
import fs from "node:fs";
const form = new FormData();
form.append("file", new Blob([fs.readFileSync("input.pdf")]), "input.pdf");
const r = await fetch("https://betapdf.com/api/v1/parse", {
method: "POST",
headers: { "Authorization": "Bearer beta_live_xxxxxxxxxxxxxxxxxxxxxxxx" },
body: form,
});
const data = await r.json();
console.log(data.markdown);
data.chunks.forEach(c => console.log(c.type, c.grounding?.page, c.markdown.slice(0, 60)));Lưu trữ & Tải lại kết quả
File ZIP kết quả được giữ trên server để bạn tải lại trong khoảng thời gian theo gói: Free 6 giờ, Pro 7 ngày, Business 14 ngày. Lấy lại bằng GET /v1/parse/jobs/{id}/download (trả 410 EXPIRED khi quá hạn). DELETE /v1/parse/jobs/{id} cho phép tự xóa theo yêu cầu GDPR. Upload từ web ẩn danh luôn dùng cửa sổ 6 giờ.
Quota & Giới hạn
Pro: 1.000 trang/tháng. Business: 5.000 trang/tháng. Cả hai gói: 30 request/phút mỗi key. PDF tối đa 100MB (sync ≤10 trang, async ≤50 trang); ảnh (jpg/png/webp) tối đa 20MB, tính 1 trang. Hard cap — v1 không tính overage.
Mã lỗi
| HTTP | Code | Mô tả |
|---|---|---|
| 401 | UNAUTHENTICATED | Thiếu header Authorization |
| 401 | INVALID_API_KEY | Key không hợp lệ hoặc đã thu hồi |
| 403 | PLAN_REQUIRED | API yêu cầu gói Pro hoặc Business |
| 403 | PLAN_EXPIRED | Gói đã hết hạn; gia hạn để tiếp tục |
| 403 | API_NOT_AVAILABLE_FOR_TOOL | Công cụ không khả dụng qua API |
| 408 | SYNC_TIMEOUT | Sync vượt 60s — lấy qua /jobs/{id}/result |
| 413 | LIMIT_FILE_SIZE | File vượt 100MB |
| 413 | TOO_MANY_PAGES_FOR_SYNC | File > 10 trang dùng /v1/parse/jobs |
| 413 | TOO_MANY_PAGES | File vượt 50 trang; tách trước |
| 415 | UNSUPPORTED_FORMAT | Hiện tại chỉ nhận PDF |
| 429 | RATE_LIMIT_EXCEEDED | 30 request/phút mỗi key |
| 429 | QUOTA_EXCEEDED | Đã hết quota trang trong tháng |
| 410 | EXPIRED | Kết quả đã hết hạn lưu trữ theo gói của bạn |
| 503 | DISK_FULL | Tạm thời quá tải bộ nhớ; thử lại sau vài phút |
| 500 | JOB_FAILED | Lỗi trong quá trình xử lý |
Vì sao BetaPDF
- ⚡ Nhanh hơn 15× so với phiên bản cũ. ~22-30s cho PDF tiếng Việt 9 trang (vLLM trên GB10).
- 🇻🇳 Giữ dấu tiếng Việt 99.7% trên cả PDF số và PDF scan 300 DPI.
- 💰 Từ $9.99/tháng (Pro) hoặc $29.99/tháng (Business). So với Landing AI ADE Team $250/tháng.
- 🔁 Hỗ trợ cả sync và async. Cùng shape JSON (markdown + chunks + metadata).