@talonic/docs 0.19.0 → 0.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/content.js CHANGED
@@ -1,23 +1,23 @@
1
1
  // src/content/helpers.ts
2
- function deriveBreadcrumbs(sections43, leafId, domain) {
2
+ function deriveBreadcrumbs(sections44, leafId, domain) {
3
3
  const root = {
4
4
  label: domain === "api" ? "API Reference" : "Platform Guide",
5
5
  slug: domain
6
6
  };
7
- for (const group of sections43) {
7
+ for (const group of sections44) {
8
8
  const child = group.children?.find((c) => c.id === leafId);
9
9
  if (child) {
10
10
  return [root, { label: group.label, slug: group.id }, { label: child.label, slug: child.id }];
11
11
  }
12
12
  }
13
- const topLevel = sections43.find((s) => s.id === leafId);
13
+ const topLevel = sections44.find((s) => s.id === leafId);
14
14
  if (topLevel) {
15
15
  return [root, { label: topLevel.label, slug: topLevel.id }];
16
16
  }
17
17
  return [root];
18
18
  }
19
- function derivePrevNext(sections43, leafId) {
20
- const flat = sections43.flatMap(
19
+ function derivePrevNext(sections44, leafId) {
20
+ const flat = sections44.flatMap(
21
21
  (s) => s.children ?? [{ id: s.id, label: s.label }]
22
22
  );
23
23
  const idx = flat.findIndex((c) => c.id === leafId);
@@ -221,6 +221,11 @@ var API_NAV_SECTIONS = [
221
221
  { id: "manage-routing-rule", label: "Manage Rule" },
222
222
  { id: "reorder-routing-rules", label: "Reorder" }
223
223
  ] },
224
+ { id: "billing", label: "Billing", children: [
225
+ { id: "billing-settings", label: "Settings" },
226
+ { id: "billing-topup", label: "Auto Top-Up" },
227
+ { id: "cost-headers", label: "Cost Headers" }
228
+ ] },
224
229
  { id: "errors-rate-limits", label: "Errors & Rate Limits", children: [
225
230
  { id: "error-format", label: "Error Format" },
226
231
  { id: "error-codes", label: "Error Codes" },
@@ -10700,8 +10705,186 @@ var sections41 = [
10700
10705
  }
10701
10706
  ];
10702
10707
 
10703
- // src/content/api/errors-rate-limits.ts
10708
+ // src/content/api/billing.ts
10704
10709
  var sections42 = [
10710
+ {
10711
+ slug: "billing-settings",
10712
+ parentSlug: "billing",
10713
+ title: "Get / Update Settings",
10714
+ seoTitle: "Billing Settings Endpoint \u2014 Talonic Docs",
10715
+ description: "Get and update auto top-up billing settings. A human must enable auto top-up before agents can use the topup endpoint.",
10716
+ content: [
10717
+ {
10718
+ type: "paragraph",
10719
+ text: "Billing settings control whether AI agents can autonomously top up credits. A human must enable auto top-up and configure the threshold and amount before agents can call the topup endpoint."
10720
+ },
10721
+ {
10722
+ type: "endpoint",
10723
+ method: "GET",
10724
+ path: "/v1/billing/settings",
10725
+ summary: "Get current billing settings.",
10726
+ description: "Requires read scope.",
10727
+ blocks: [
10728
+ {
10729
+ type: "code",
10730
+ title: "Response",
10731
+ code: `{
10732
+ "auto_topup_enabled": false,
10733
+ "auto_topup_threshold": 5000,
10734
+ "auto_topup_amount": 50000
10735
+ }`
10736
+ }
10737
+ ]
10738
+ },
10739
+ {
10740
+ type: "endpoint",
10741
+ method: "PATCH",
10742
+ path: "/v1/billing/settings",
10743
+ summary: "Update billing settings.",
10744
+ description: "Requires write scope. All fields are optional \u2014 only provided fields are updated.",
10745
+ blocks: [
10746
+ {
10747
+ type: "param-table",
10748
+ title: "Body parameters",
10749
+ params: [
10750
+ { name: "auto_topup_enabled", type: "boolean", description: "Enable or disable auto top-up for agents." },
10751
+ { name: "auto_topup_threshold", type: "integer", description: "Balance threshold (credits) below which agents can top up. Minimum 1,000.", default: "5000" },
10752
+ { name: "auto_topup_amount", type: "integer", description: "Credits added per top-up. Minimum 1,000, maximum 500,000.", default: "50000" }
10753
+ ]
10754
+ }
10755
+ ]
10756
+ }
10757
+ ],
10758
+ related: [
10759
+ { label: "Auto Top-Up", slug: "billing-topup" },
10760
+ { label: "Credits Balance", slug: "credits-balance" }
10761
+ ],
10762
+ faq: [
10763
+ {
10764
+ question: "Who can enable auto top-up?",
10765
+ answer: "Only a human with write access can enable auto top-up via PATCH /v1/billing/settings. Agents cannot enable it themselves."
10766
+ }
10767
+ ],
10768
+ mentions: ["billing settings", "auto top-up", "threshold", "credits"]
10769
+ },
10770
+ {
10771
+ slug: "billing-topup",
10772
+ parentSlug: "billing",
10773
+ title: "Auto Top-Up",
10774
+ seoTitle: "Auto Top-Up Endpoint \u2014 Talonic Docs",
10775
+ description: "Agent-callable endpoint to autonomously top up credits. Requires auto_topup_enabled to be set by a human. Returns 403 if not enabled.",
10776
+ content: [
10777
+ {
10778
+ type: "paragraph",
10779
+ text: "AI agents call this endpoint to autonomously add credits when the balance falls below the configured threshold. **A human must first enable auto top-up** via `PATCH /v1/billing/settings`."
10780
+ },
10781
+ {
10782
+ type: "endpoint",
10783
+ method: "POST",
10784
+ path: "/v1/billing/topup",
10785
+ summary: "Top up credits autonomously. Requires billing scope.",
10786
+ description: "Returns 403 if auto_topup_enabled is false. If balance is already above threshold, returns topped_up: false without adding credits.",
10787
+ blocks: [
10788
+ {
10789
+ type: "code",
10790
+ title: "Response (topped up)",
10791
+ code: `{
10792
+ "topped_up": true,
10793
+ "amount_credits": 50000,
10794
+ "new_balance_credits": 54930,
10795
+ "new_balance_eur": 54.93
10796
+ }`
10797
+ },
10798
+ {
10799
+ type: "code",
10800
+ title: "Response (not needed)",
10801
+ code: `{
10802
+ "topped_up": false,
10803
+ "reason": "balance_above_threshold",
10804
+ "balance_credits": 64930,
10805
+ "balance_eur": 64.93,
10806
+ "threshold_credits": 5000
10807
+ }`
10808
+ },
10809
+ {
10810
+ type: "callout",
10811
+ variant: "warning",
10812
+ text: "The `billing` scope must be explicitly granted to the API key. Existing keys do not have it by default."
10813
+ }
10814
+ ]
10815
+ }
10816
+ ],
10817
+ related: [
10818
+ { label: "Billing Settings", slug: "billing-settings" },
10819
+ { label: "Credits Balance", slug: "credits-balance" }
10820
+ ],
10821
+ faq: [
10822
+ {
10823
+ question: "Can an agent enable auto top-up itself?",
10824
+ answer: "No. Auto top-up must be enabled by a human via PATCH /v1/billing/settings. The POST /v1/billing/topup endpoint returns 403 if it is not enabled."
10825
+ },
10826
+ {
10827
+ question: "What scope does the API key need?",
10828
+ answer: "The billing scope. This must be explicitly granted when creating the API key \u2014 existing keys do not have it by default."
10829
+ }
10830
+ ],
10831
+ mentions: ["auto top-up", "agent", "billing scope", "credits", "autonomous"]
10832
+ },
10833
+ {
10834
+ slug: "cost-headers",
10835
+ parentSlug: "billing",
10836
+ title: "Cost Response Headers",
10837
+ seoTitle: "Cost Response Headers \u2014 Talonic Docs",
10838
+ description: "Every successful POST /v1/extract response includes X-Talonic-Cost-* headers showing credits consumed, EUR equivalent, remaining balance, and cell resolution breakdown.",
10839
+ content: [
10840
+ {
10841
+ type: "paragraph",
10842
+ text: "Every successful `POST /v1/extract` response includes cost headers so AI agents can track spending without a separate API call:"
10843
+ },
10844
+ {
10845
+ type: "param-table",
10846
+ title: "Response headers",
10847
+ params: [
10848
+ { name: "X-Talonic-Cost-Credits", type: "integer", description: "Credits consumed for this extraction request." },
10849
+ { name: "X-Talonic-Cost-EUR", type: "float", description: "EUR equivalent of credits consumed (at the configured rate)." },
10850
+ { name: "X-Talonic-Balance-Credits", type: "integer", description: "Remaining credit balance after this request." },
10851
+ { name: "X-Talonic-Cells-Resolved-Registry", type: "integer", description: "Number of fields resolved from the registry (no AI cost)." },
10852
+ { name: "X-Talonic-Cells-Resolved-AI", type: "integer", description: "Number of fields resolved by AI extraction." }
10853
+ ]
10854
+ },
10855
+ {
10856
+ type: "code",
10857
+ title: "Example response headers",
10858
+ language: "http",
10859
+ code: `HTTP/1.1 200 OK
10860
+ X-Talonic-Cost-Credits: 70
10861
+ X-Talonic-Cost-EUR: 0.07
10862
+ X-Talonic-Balance-Credits: 64930
10863
+ X-Talonic-Cells-Resolved-Registry: 0
10864
+ X-Talonic-Cells-Resolved-AI: 1`
10865
+ },
10866
+ {
10867
+ type: "paragraph",
10868
+ text: "Agents can read these headers after every extraction to decide whether to call `POST /v1/billing/topup` to replenish credits."
10869
+ }
10870
+ ],
10871
+ related: [
10872
+ { label: "POST /v1/extract", slug: "post-extract" },
10873
+ { label: "Auto Top-Up", slug: "billing-topup" },
10874
+ { label: "Credits Balance", slug: "credits-balance" }
10875
+ ],
10876
+ faq: [
10877
+ {
10878
+ question: "Are cost headers included on async (202) responses?",
10879
+ answer: "No. Cost headers are only included on synchronous 200 responses where extraction completes immediately. Async responses return a poll URL instead."
10880
+ }
10881
+ ],
10882
+ mentions: ["cost headers", "X-Talonic-Cost", "credits", "balance", "cells resolved"]
10883
+ }
10884
+ ];
10885
+
10886
+ // src/content/api/errors-rate-limits.ts
10887
+ var sections43 = [
10705
10888
  {
10706
10889
  slug: "error-format",
10707
10890
  parentSlug: "errors-rate-limits",
@@ -10853,7 +11036,8 @@ var ALL_API_RAW = [
10853
11036
  ...sections39,
10854
11037
  ...sections40,
10855
11038
  ...sections41,
10856
- ...sections42
11039
+ ...sections42,
11040
+ ...sections43
10857
11041
  ];
10858
11042
  function enrich(raw, navSections, domain) {
10859
11043
  return raw.map((r) => {
package/dist/index.js CHANGED
@@ -6565,6 +6565,11 @@ var API_NAV_SECTIONS = [
6565
6565
  { id: "manage-routing-rule", label: "Manage Rule" },
6566
6566
  { id: "reorder-routing-rules", label: "Reorder" }
6567
6567
  ] },
6568
+ { id: "billing", label: "Billing", children: [
6569
+ { id: "billing-settings", label: "Settings" },
6570
+ { id: "billing-topup", label: "Auto Top-Up" },
6571
+ { id: "cost-headers", label: "Cost Headers" }
6572
+ ] },
6568
6573
  { id: "errors-rate-limits", label: "Errors & Rate Limits", children: [
6569
6574
  { id: "error-format", label: "Error Format" },
6570
6575
  { id: "error-codes", label: "Error Codes" },
@@ -6710,6 +6715,7 @@ var API_SECTION_META = [
6710
6715
  { id: "review", title: "Review API", description: "Review queue for validation records \u2014 list items, stats, take action (approve/reject/flag), batch operations, and assignment." },
6711
6716
  { id: "quality", title: "Quality API", description: "Ground truth datasets, entries management with CSV import, benchmark runs, per-field accuracy results, and benchmark comparison." },
6712
6717
  { id: "routing-rules", title: "Routing Rules API", description: "Document routing rules \u2014 create, manage, and reorder priority-based rules for automatic document workflow assignment." },
6718
+ { id: "billing", title: "Billing API", description: "Billing settings, auto top-up for AI agents, and cost response headers on extraction requests." },
6713
6719
  { id: "errors-rate-limits", title: "Errors & Rate Limits", description: "Error response format, error codes, rate limit tiers by plan, and rate limit headers." }
6714
6720
  ];
6715
6721
  var PLATFORM_SECTION_META = [