Đi tới nội dung
Mục
Fiesta

api-tokens

Tuyến Những mảnh vốn là cả một phản hồi, chứ không phải một phần của phản hồi.

Trang mã thông báo API: phần hiển thị một lần, biểu mẫu tạo, danh sách và các nút thu hồi.

Mỗi ví dụ đều hoạt động thật, nhưng các liên kết trong đó không dẫn đến đâu. HTML hiển thị mã đánh dấu để sao chép.

Bốn mã, hai trong số đó còn hiệu lực

Các biểu mẫu thu hồi gửi đến /tokens/revoke, /tokens/revoke-agent và /tokens/revoke-all, dưới đường dẫn của chính trang. Hãy trỏ chúng tới nơi ứng dụng của bạn xử lý.

Xem trước
<div rst-tokens>
  <section rst-box>
    <form rst-form method="post" action="/tokens">
      <div rst-field>
        <label rst-field-label for="agent">Tên tác tử</label>
        <input rst-input type="text" id="agent" name="agent" maxlength="40">
      </div>
      <label rst-switch>
        <input type="checkbox" name="for_self" value="on">
        <span rst-switch-track aria-hidden="true"></span>
        Mã này dành cho tôi, không phải cho tác tử
      </label>
      <fieldset rst-choice>
        <legend>Quyền truy cập</legend>
        <div rst-choice-cards>
          <label>
            <input type="radio" name="access" value="write" checked>
            <span>
              <span rst-choice-title>Đọc và ghi</span>
            </span>
          </label>
          <label>
            <input type="radio" name="access" value="read">
            <span>
              <span rst-choice-title>Chỉ đọc</span>
            </span>
          </label>
        </div>
      </fieldset>
      <div rst-field>
        <label rst-field-label for="expiry">Hết hạn</label>
        <select rst-input="short" id="expiry" name="expiry">
          <option value="30">30 ngày</option>
          <option value="90" selected>90 ngày</option>
          <option value="365">1 năm</option>
          <option value="never">Không bao giờ</option>
        </select>
      </div>
      <div rst-form-foot>
        <button rst-btn="primary lg" type="submit">Tạo mã thông báo</button>
      </div>
    </form>
  </section>
  <div rst-card rst-tokens-list role="table" aria-label="Mã thông báo">
    <div rst-lrow="head" role="row">
      <span role="columnheader">Mã thông báo</span>
      <span class="rst-m-hide" role="columnheader">Quyền truy cập</span>
      <span class="rst-m-hide" role="columnheader">Đã tạo</span>
      <span class="rst-m-hide" role="columnheader">Dùng lần cuối</span>
      <span class="rst-m-hide" role="columnheader">Hết hạn</span>
      <span role="columnheader"><span class="rst-sr-only">Trạng thái</span></span>
      <span role="columnheader"><span class="rst-sr-only">Thao tác</span></span>
    </div>
    <div rst-lrow role="row">
      <span class="rst-nm" role="rowheader"><span rst-actor>Claude thay mặt Grace Hopper</span>
        <small>
          <code>k3Jx9QpL2mWa</code>
        </small>
      </span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Quyền truy cập</span>Đọc và ghi</span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Đã tạo</span><time datetime="2026-08-02">2026-08-02</time></span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Dùng lần cuối</span><time datetime="2026-08-11">2026-08-11</time></span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Hết hạn</span><time datetime="2026-10-31">2026-10-31</time></span>
      <span rst-tokens-state role="cell"></span>
      <span role="cell">
        <details rst-row-menu name="rst-menus">
          <summary aria-label="Thao tác cho Claude thay mặt Grace Hopper">
            <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="1"/><circle cx="12" cy="5" r="1"/><circle cx="12" cy="19" r="1"/></svg>
          </summary>
          <div rst-row-menu-panel>
            <form method="post" action="/tokens/revoke">
              <input type="hidden" name="id" value="k3Jx9QpL2mWa">
              <button type="submit">Thu hồi</button>
            </form>
          </div>
        </details>
      </span>
    </div>
    <div rst-lrow role="row">
      <span class="rst-nm" role="rowheader"><span rst-actor>Grace Hopper</span>
        <small>
          <code>Qm2vR8sT4xYb</code>
        </small>
      </span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Quyền truy cập</span>Chỉ đọc</span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Đã tạo</span><time datetime="2026-08-02">2026-08-02</time></span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Dùng lần cuối</span></span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Hết hạn</span>Không bao giờ</span>
      <span rst-tokens-state role="cell"></span>
      <span role="cell">
        <details rst-row-menu name="rst-menus">
          <summary aria-label="Thao tác cho Grace Hopper">
            <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="1"/><circle cx="12" cy="5" r="1"/><circle cx="12" cy="19" r="1"/></svg>
          </summary>
          <div rst-row-menu-panel>
            <form method="post" action="/tokens/revoke">
              <input type="hidden" name="id" value="Qm2vR8sT4xYb">
              <button type="submit">Thu hồi</button>
            </form>
          </div>
        </details>
      </span>
    </div>
    <div rst-lrow role="row">
      <span class="rst-nm" role="rowheader"><span rst-actor>Codex thay mặt Grace Hopper</span>
        <small>
          <code>Zp7wN1cH6kLd</code>
        </small>
      </span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Quyền truy cập</span>Đọc và ghi</span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Đã tạo</span><time datetime="2026-08-02">2026-08-02</time></span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Dùng lần cuối</span></span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Hết hạn</span>Không bao giờ</span>
      <span rst-tokens-state role="cell"><span rst-status rst-tone="neutral">Đã thu hồi</span></span>
    </div>
    <div rst-lrow role="row">
      <span class="rst-nm" role="rowheader"><span rst-actor>Nhập dữ liệu hằng đêm thay mặt Grace Hopper</span>
        <small>
          <code>Vb4tG9yK3nMe</code>
        </small>
      </span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Quyền truy cập</span>Chỉ đọc</span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Đã tạo</span><time datetime="2026-08-02">2026-08-02</time></span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Dùng lần cuối</span></span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Hết hạn</span><time datetime="2026-08-11">2026-08-11</time></span>
      <span rst-tokens-state role="cell"><span rst-status rst-tone="warning">Đã hết hạn</span></span>
    </div>
  </div>
  <div rst-tokens-revoke>
    <form method="post" action="/tokens/revoke-agent">
      <input type="hidden" name="agent" value="Claude">
      <button rst-btn type="submit">Thu hồi tất cả của tác tử này: Claude</button>
    </form>
    <form method="post" action="/tokens/revoke-all">
      <button rst-btn="danger" type="submit">Thu hồi tất cả mã thông báo</button>
    </form>
  </div>
</div>

Trong một ứng dụng, phần này sẽ đi tới /tokens, /tokens/revoke, /tokens/revoke-agent, /tokens/revoke-all. Ở đây các liên kết và biểu mẫu của nó không dẫn đến đâu.

Vừa tạo: bí mật, hiển thị một lần

Hiển thị phần này ngay trong phản hồi cho biểu mẫu tạo, và đừng chuyển hướng nó: bí mật nằm trong phản hồi đó và không ở đâu khác.

Xem trước
<div rst-tokens>
  <div rst-callout rst-tone="positive" tabindex="-1" autofocus>
    <span rst-callout-ic aria-hidden="true">
      <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>
    </span>
    <div rst-callout-body>
      <strong>Hãy sao chép mã này ngay. Nó sẽ không hiển thị lại.</strong>
      <p>
        <code rst-tokens-secret>harbour_k3Jx9QpL2mWa_6bD2qK9xWz4rT8vN1mP3sL7yF5hJ0cG2aE4uB</code>
      </p>
    </div>
  </div>
  <section rst-box>
    <form rst-form method="post" action="/tokens">
      <div rst-field>
        <label rst-field-label for="agent">Tên tác tử</label>
        <input rst-input type="text" id="agent" name="agent" maxlength="40">
      </div>
      <label rst-switch>
        <input type="checkbox" name="for_self" value="on">
        <span rst-switch-track aria-hidden="true"></span>
        Mã này dành cho tôi, không phải cho tác tử
      </label>
      <fieldset rst-choice>
        <legend>Quyền truy cập</legend>
        <div rst-choice-cards>
          <label>
            <input type="radio" name="access" value="write" checked>
            <span>
              <span rst-choice-title>Đọc và ghi</span>
            </span>
          </label>
          <label>
            <input type="radio" name="access" value="read">
            <span>
              <span rst-choice-title>Chỉ đọc</span>
            </span>
          </label>
        </div>
      </fieldset>
      <div rst-field>
        <label rst-field-label for="expiry">Hết hạn</label>
        <select rst-input="short" id="expiry" name="expiry">
          <option value="30">30 ngày</option>
          <option value="90" selected>90 ngày</option>
          <option value="365">1 năm</option>
          <option value="never">Không bao giờ</option>
        </select>
      </div>
      <div rst-form-foot>
        <button rst-btn="primary lg" type="submit">Tạo mã thông báo</button>
      </div>
    </form>
  </section>
  <div rst-card rst-tokens-list role="table" aria-label="Mã thông báo">
    <div rst-lrow="head" role="row">
      <span role="columnheader">Mã thông báo</span>
      <span class="rst-m-hide" role="columnheader">Quyền truy cập</span>
      <span class="rst-m-hide" role="columnheader">Đã tạo</span>
      <span class="rst-m-hide" role="columnheader">Dùng lần cuối</span>
      <span class="rst-m-hide" role="columnheader">Hết hạn</span>
      <span role="columnheader"><span class="rst-sr-only">Trạng thái</span></span>
      <span role="columnheader"><span class="rst-sr-only">Thao tác</span></span>
    </div>
    <div rst-lrow role="row">
      <span class="rst-nm" role="rowheader"><span rst-actor>Claude thay mặt Grace Hopper</span>
        <small>
          <code>k3Jx9QpL2mWa</code>
        </small>
      </span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Quyền truy cập</span>Đọc và ghi</span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Đã tạo</span><time datetime="2026-08-02">2026-08-02</time></span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Dùng lần cuối</span><time datetime="2026-08-11">2026-08-11</time></span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Hết hạn</span><time datetime="2026-10-31">2026-10-31</time></span>
      <span rst-tokens-state role="cell"></span>
      <span role="cell">
        <details rst-row-menu name="rst-menus">
          <summary aria-label="Thao tác cho Claude thay mặt Grace Hopper">
            <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="1"/><circle cx="12" cy="5" r="1"/><circle cx="12" cy="19" r="1"/></svg>
          </summary>
          <div rst-row-menu-panel>
            <form method="post" action="/tokens/revoke">
              <input type="hidden" name="id" value="k3Jx9QpL2mWa">
              <button type="submit">Thu hồi</button>
            </form>
          </div>
        </details>
      </span>
    </div>
    <div rst-lrow role="row">
      <span class="rst-nm" role="rowheader"><span rst-actor>Grace Hopper</span>
        <small>
          <code>Qm2vR8sT4xYb</code>
        </small>
      </span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Quyền truy cập</span>Chỉ đọc</span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Đã tạo</span><time datetime="2026-08-02">2026-08-02</time></span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Dùng lần cuối</span></span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Hết hạn</span>Không bao giờ</span>
      <span rst-tokens-state role="cell"></span>
      <span role="cell">
        <details rst-row-menu name="rst-menus">
          <summary aria-label="Thao tác cho Grace Hopper">
            <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="1"/><circle cx="12" cy="5" r="1"/><circle cx="12" cy="19" r="1"/></svg>
          </summary>
          <div rst-row-menu-panel>
            <form method="post" action="/tokens/revoke">
              <input type="hidden" name="id" value="Qm2vR8sT4xYb">
              <button type="submit">Thu hồi</button>
            </form>
          </div>
        </details>
      </span>
    </div>
    <div rst-lrow role="row">
      <span class="rst-nm" role="rowheader"><span rst-actor>Codex thay mặt Grace Hopper</span>
        <small>
          <code>Zp7wN1cH6kLd</code>
        </small>
      </span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Quyền truy cập</span>Đọc và ghi</span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Đã tạo</span><time datetime="2026-08-02">2026-08-02</time></span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Dùng lần cuối</span></span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Hết hạn</span>Không bao giờ</span>
      <span rst-tokens-state role="cell"><span rst-status rst-tone="neutral">Đã thu hồi</span></span>
    </div>
    <div rst-lrow role="row">
      <span class="rst-nm" role="rowheader"><span rst-actor>Nhập dữ liệu hằng đêm thay mặt Grace Hopper</span>
        <small>
          <code>Vb4tG9yK3nMe</code>
        </small>
      </span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Quyền truy cập</span>Chỉ đọc</span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Đã tạo</span><time datetime="2026-08-02">2026-08-02</time></span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Dùng lần cuối</span></span>
      <span rst-tokens-fact role="cell"><span rst-tokens-fact-label>Hết hạn</span><time datetime="2026-08-11">2026-08-11</time></span>
      <span rst-tokens-state role="cell"><span rst-status rst-tone="warning">Đã hết hạn</span></span>
    </div>
  </div>
  <div rst-tokens-revoke>
    <form method="post" action="/tokens/revoke-agent">
      <input type="hidden" name="agent" value="Claude">
      <button rst-btn type="submit">Thu hồi tất cả của tác tử này: Claude</button>
    </form>
    <form method="post" action="/tokens/revoke-all">
      <button rst-btn="danger" type="submit">Thu hồi tất cả mã thông báo</button>
    </form>
  </div>
</div>

Trong một ứng dụng, phần này sẽ đi tới /tokens, /tokens/revoke, /tokens/revoke-agent, /tokens/revoke-all. Ở đây các liên kết và biểu mẫu của nó không dẫn đến đâu.

Chưa có mã thông báo nào

Xem trước
<div rst-tokens>
  <section rst-box>
    <form rst-form method="post" action="/tokens">
      <div rst-field>
        <label rst-field-label for="agent">Tên tác tử</label>
        <input rst-input type="text" id="agent" name="agent" maxlength="40">
      </div>
      <label rst-switch>
        <input type="checkbox" name="for_self" value="on">
        <span rst-switch-track aria-hidden="true"></span>
        Mã này dành cho tôi, không phải cho tác tử
      </label>
      <fieldset rst-choice>
        <legend>Quyền truy cập</legend>
        <div rst-choice-cards>
          <label>
            <input type="radio" name="access" value="write" checked>
            <span>
              <span rst-choice-title>Đọc và ghi</span>
            </span>
          </label>
          <label>
            <input type="radio" name="access" value="read">
            <span>
              <span rst-choice-title>Chỉ đọc</span>
            </span>
          </label>
        </div>
      </fieldset>
      <div rst-field>
        <label rst-field-label for="expiry">Hết hạn</label>
        <select rst-input="short" id="expiry" name="expiry">
          <option value="30">30 ngày</option>
          <option value="90" selected>90 ngày</option>
          <option value="365">1 năm</option>
          <option value="never">Không bao giờ</option>
        </select>
      </div>
      <div rst-form-foot>
        <button rst-btn="primary lg" type="submit">Tạo mã thông báo</button>
      </div>
    </form>
  </section>
  <div rst-empty>
    <p rst-empty-body>Chưa có mã thông báo nào.</p>
  </div>
</div>

Trong một ứng dụng, phần này sẽ đi tới /tokens. Ở đây các liên kết và biểu mẫu của nó không dẫn đến đâu.