# Thử dữ liệu trong Run

Chạy thử template với API key, version, variant và dữ liệu trong Run.

**Run** cho phép bạn gửi dữ liệu và tạo PDF ngay trong editor. Bạn chọn bản mẫu, điền các trường đầu vào rồi xem kết quả trong cùng một nơi — thuận tiện để thử cách mẫu hoạt động trước khi nối vào phần mềm của mình.

## 1. Chọn key, version và variant

Lưu và publish version muốn chạy, sau đó mở **Run**. Chọn API key của project có quyền `template:render`, số **Version** và tên **Variant**. Nếu chưa có key, tạo trong [API Keys](/docs/vi/developers/keys/).

Bộ chọn của Run độc lập với phần editor đang mở: bạn có thể chạy v1 trong khi xem v2. Khi đổi Version, Run tải Parameters, Default và Variants của đúng bản đã lưu đó; hãy đợi tải xong rồi nhập dữ liệu. Dữ liệu thử được giữ riêng cho từng version của mẫu trong trình duyệt này. Có thể chọn bản Draft, nhưng cần publish trước khi render.

<figure class="doc-sim data-assets-illustration workflow-illustration" aria-label="Run → API key → Version → Variant">
<div class="sim-stage"><div class="sim-panel"><div class="ds-head"><strong>RUN</strong><div class="wf-actions"></div></div><div class="wf-fields"><div><small class="sim-label">API KEY</small><span class="sim-input wf-select sim-focus">Project key<svg class="sim-chevron" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m4 6 4 4 4-4" /></svg></span></div><div><small class="sim-label">VERSION</small><span class="sim-input wf-select">v2<svg class="sim-chevron" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m4 6 4 4 4-4" /></svg></span></div><div><small class="sim-label">VARIANT</small><span class="sim-input wf-select">Standard<svg class="sim-chevron" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m4 6 4 4 4-4" /></svg></span></div></div></div></div>
<figcaption>Run → API key → Version → Variant</figcaption>
</figure>

## 2. Điền Parameters của lần chạy

Mở phần Parameters trong Run và thay các giá trị cần thử. Các trường được dựng từ cấu trúc đã khai báo ở Schema; object và array vẫn cần giữ đúng kiểu dữ liệu.

Giá trị nhập ở đây dùng cho lần tạo PDF, không sửa Default của mẫu. Thao tác đặt lại dữ liệu lấy lại các giá trị mặc định từ Parameters.

<figure class="doc-sim data-assets-illustration workflow-illustration" aria-label="Dữ liệu trong Run dành cho lần chạy, không thay Default">
<div class="sim-stage"><div class="sim-panel"><div class="ds-head"><strong>RUN · Parameters</strong><div class="wf-actions"></div></div><div class="wf-fields"><div><small class="sim-label">recipient</small><span class="sim-input sim-focus">Tembuilder</span></div><div><small class="sim-label">copies</small><span class="sim-input">2</span></div></div><div class="ds-code"><code>{ &quot;recipient&quot;: &quot;Tembuilder&quot;, &quot;copies&quot;: 2 }</code></div></div></div>
<figcaption>Dữ liệu trong Run dành cho lần chạy, không thay Default</figcaption>
</figure>

## 3. Tạo PDF và mở kết quả

Bấm **Render**. Lần chạy xuất hiện trong lịch sử của Run trong lúc hệ thống xử lý. Mở dòng kết quả để xem trạng thái và tải PDF khi thành công.

Run là render thật: lần thành công được tính vào quota và có output lưu trữ. Nếu chỉ đang chỉnh bố cục, dùng [preview](/docs/vi/renders/preview-render/) trong editor.

Khi thất bại, mở chi tiết lỗi của lần chạy để biết cần sửa dữ liệu, mẫu hay điều kiện sử dụng trước khi gửi lại.

<figure class="doc-sim data-assets-illustration workflow-illustration" aria-label="Render → lịch sử → mở kết quả → Download">
<div class="sim-stage"><div class="sim-panel"><div class="ds-head"><strong>Render · #a18f</strong><div class="wf-actions"></div></div><div class="wf-rows"><div class=""><span>Status</span><small>Success</small></div><div class=""><span>Version</span><small>2 · Standard</small></div></div><div class="wf-output"><span>document.pdf</span><span class="sim-control sim-focus">↓ Download</span></div></div></div>
<figcaption>Render → lịch sử → mở kết quả → Download</figcaption>
</figure>

## 4. Lấy mã gọi để bắt đầu tích hợp

Menu sao chép trong Run có **cURL**, **JavaScript** và **Python**. Mã dùng placeholder `<YOUR_API_KEY>`; bạn cần cung cấp key trong môi trường chạy của mình.

Đoạn mã dùng version, variant và dữ liệu hiện đang chọn trong Run. Hãy chọn đúng bộ dữ liệu muốn tích hợp rồi mới sao chép; thay đổi form sau đó không sửa đoạn mã đã copy trước đó. Để tra field của yêu cầu, status và endpoint tải output, xem [Render API reference](/docs/vi/developers/render-reference/).

<figure class="doc-sim data-assets-illustration workflow-illustration" aria-label="Copy → cURL / JavaScript / Python">
<div class="sim-stage"><div class="sim-panel"><div class="ds-head"><strong>RUN</strong><div class="wf-actions"><span class="sim-control">Copy ⌄</span></div></div><div class="wf-rows"><div class="sim-focus"><span>Copy cURL</span><small>curl</small></div><div class=""><span>Copy JavaScript</span><small>fetch</small></div><div class=""><span>Copy Python</span><small>requests</small></div></div></div></div>
<figcaption>Copy → cURL / JavaScript / Python</figcaption>
</figure>
