Tài khoản & API Keys

Tạo key để gọi API từ script hoặc ứng dụng bên ngoài.

Bước 1: Đăng nhập magic link. Bước 2: Tạo key. Bước 3: Dùng X-API-Key gọi API từ bên ngoài.

Đăng nhập để tạo API key.

Nạp credit

Chọn gói, quét VietQR — credits cộng tự động sau khi SePay xác nhận.

Nạp credit chưa cấu hình. Thêm SEPAY_* vào .env rồi restart gateway.

Đăng nhập để nạp credit.

Services

Mỗi service có playground, tài liệu API và lịch sử gọi riêng.

File Converter

Chuyển đổi Office ↔ PDF (DOCX/XLSX/PPTX/ODT)

POST /convert · 8 cr

Thử ngay

Upload file Office, nhận file đã convert

Đăng nhập để convert file

API Docs & curl

Upload file Office và nhận file đã convert.

Endpoint

POST https://api.proxy.shuneo.com/v1/convert/convert

Chi phí

8 credits / lần gọi thành công

Request body

multipart/form-data:
  file=@document.docx
  format=pdf

Response body

Binary file (Content-Disposition: attachment)

Lỗi thường gặp

StatusNguyên nhân
401Thiếu/sai X-API-Key hoặc JWT
402Hết credit
400Thiếu file/format hoặc conversion không hỗ trợ
413File quá lớn (mặc định 25MB)
422LibreOffice convert thất bại
504Timeout (mặc định 60s)

Ví dụ curl

# DOCX -> PDF
curl -X POST https://api.proxy.shuneo.com/v1/convert/convert \
  -H "X-API-Key: gw_YOUR_KEY" \
  -F "file=@document.docx" \
  -F "format=pdf" \
  -o output.pdf

Lịch sử gọi

Đăng nhập để xem lịch sử.

Email Sender

Transactional email qua SMTP

POST /send · 5 cr

Thử ngay

Gửi email tới 1 địa chỉ

Đăng nhập để gửi email

API Docs & curl

Gửi email qua SMTP.

Endpoint

POST https://api.proxy.shuneo.com/v1/email/send

Chi phí

5 credits / lần gọi thành công

Request body

{
  "to": "recipient@example.com",
  "subject": "Hello",
  "body": "Plain text content"
}

Lỗi thường gặp

StatusNguyên nhân
401Thiếu/sai X-API-Key hoặc JWT
402Hết credit
400Thiếu to, subject, body
502SMTP lỗi

Ví dụ curl

curl -X POST https://api.proxy.shuneo.com/v1/email/send \
  -H "X-API-Key: gw_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to":"you@example.com","subject":"Test","body":"Hello"}'

Lịch sử gọi

Đăng nhập để xem lịch sử.

Problem Generator

Nhập problem.yaml → DOCX hoặc problem.ini BKDNOJ

POST /generate · 8 crPOST /generate-ini · 3 cr

Thử ngay

Gửi problem.yaml — sinh DOCX (8 cr) hoặc problem.ini BKDNOJ (3 cr).

Đăng nhập để sinh file từ YAML

API Docs & curl

Gửi problem.yaml schema v2: sinh DOCX (sections + tag) hoặc problem.ini BKDNOJ (code, title, judge). Công thức toán bọc trong [equation]...[/equation] (LaTeX: \\leq, \\times, a_1, ...).

Endpoint

POST https://api.proxy.shuneo.com/v1/problem/generate | POST /v1/problem/generate-ini

Chi phí

8 credits / lần gọi thành công

Request body

application/json:
{
  "yaml": "schema_version: 2\ncode: MATH_...\ntitle: ...\njudge: {...}\nsections: ..."
}

# DOCX: sections + tag [paragraph] [bullet] [table]; công thức: [equation]...[/equation]
# INI BKDNOJ: code + title + judge (optional, có default)

# hoặc Content-Type: text/yaml

YAML form mẫu

# problem.yaml — schema_version 2
schema_version: 2
id: bai-51
number: 51
code: MATH_MIN_MAX_2
title: Nhỏ nhất và lớn nhất của hai số

judge:
  comment: "; Bài C++ - hàm thư viện toán học"
  time_limit: 1.0
  memory_limit: 250000
  allow_submit: 1
  icpc: 0

sections:
  - heading: "[paragraph]"
    body: |-
      Nhập hai số nguyên a và b. In giá trị nhỏ nhất và lớn nhất của hai số.

  - heading: "[bullet] Hướng dẫn:"
    lines:
      - Dùng hàm min để lấy giá trị nhỏ hơn trong hai số.
      - Dùng hàm max để lấy giá trị lớn hơn trong hai số.

  - heading: "[bullet] Dữ liệu nhập:"
    lines:
      - "Một dòng gồm hai số nguyên a, b với [equation]|a|, |b| \leq 10^9[/equation]."

  - heading: "[bullet] Dữ liệu xuất:"
    lines:
      - "Dòng 1: Min: giá trị nhỏ nhất."
      - "Dòng 2: Max: giá trị lớn nhất."

  - heading: "[table]"
    headers:
      - Dữ liệu nhập
      - Dữ liệu xuất
    cells:
      - |-
        7 -3
      - |-
        Min: -3
        Max: 7

  - heading: "[bullet] Giải thích:"
    lines:
      - Với a = 7 và b = -3, min(7, -3) bằng -3.
      - max(7, -3) bằng 7 nên giá trị lớn nhất là 7.

Response body

DOCX binary hoặc problem.ini text (Content-Disposition: attachment)

Lỗi thường gặp

StatusNguyên nhân
401Thiếu/sai X-API-Key hoặc JWT
402Hết credit
400YAML sai; DOCX cần sections; INI cần code + title
422Sinh file thất bại

Ví dụ curl

# DOCX
curl -X POST https://api.proxy.shuneo.com/v1/problem/generate \
  -H "X-API-Key: gw_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"yaml":"..."}' \
  -o problem.docx

# problem.ini BKDNOJ
curl -X POST https://api.proxy.shuneo.com/v1/problem/generate-ini \
  -H "X-API-Key: gw_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"yaml":"schema_version: 2\ncode: MATH_MIN_MAX_2\ntitle: Demo"}' \
  -o problem.ini

# YAML mẫu (miễn phí)
curl https://api.proxy.shuneo.com/v1/problem/template \
  -H "X-API-Key: gw_YOUR_KEY"

Lịch sử gọi

Đăng nhập để xem lịch sử.

Test Generator

Schema steps v2 → sinh test.inp động

POST /generate · 2 cr

Thử ngay

Gửi test.yaml (schema v2 steps) — sinh test.inp ngẫu nhiên (2 cr).

Đăng nhập để sinh test.inp

API Docs & curl

Sinh test.inp từ schema v2 steps: gen biến rồi emit (int, float, string); count/range có thể tham chiếu biến.

Endpoint

POST https://api.proxy.shuneo.com/v1/test/generate

Chi phí

2 credits / lần gọi thành công

Request body

application/json:
{
  "yaml": "steps:\n  - gen:\n      n: { int: [3, 10] }\n  - emit:\n      line: [{ ref: n }]"
}

# Step gen: gán biến (không ghi file)
# Step emit: ghi ra test.inp:
#   line / lines / grid / ints / text
# Kiểu: int, float (precision), string (len+charset hoặc one_of)
# count, rows, cols, min, max: số hoặc tên biến hoặc { ref: tên }

# hoặc Content-Type: text/yaml

Response body

test.inp text (Content-Disposition: attachment)

Lỗi thường gặp

StatusNguyên nhân
401Thiếu/sai X-API-Key hoặc JWT
402Hết credit
400YAML sai, thiếu steps, vượt max_repeat, hoặc output > 200M ký tự
422Sinh test.inp thất bại

Ví dụ curl

curl -X POST https://api.proxy.shuneo.com/v1/test/generate \
  -H "X-API-Key: gw_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"yaml":"steps:\n  - emit:\n      line:\n        - { int: [1, 10] }\n        - { int: [1, 10] }"}' \
  -o test.inp

# YAML mẫu (miễn phí)
curl https://api.proxy.shuneo.com/v1/test/template \
  -H "X-API-Key: gw_YOUR_KEY"

Lịch sử gọi

Đăng nhập để xem lịch sử.

Tổng lịch sử usage

Tự động refresh mỗi 5 giây · credits sync realtime sau mỗi lần gọi

Đăng nhập để xem usage.