@naturalpay/sdk 0.12.0 → 0.13.0

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.
Files changed (93) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +1 -1
  3. package/resources/agents.d.mts +54 -27
  4. package/resources/agents.d.mts.map +1 -1
  5. package/resources/agents.d.ts +54 -27
  6. package/resources/agents.d.ts.map +1 -1
  7. package/resources/api-keys.d.mts +24 -12
  8. package/resources/api-keys.d.mts.map +1 -1
  9. package/resources/api-keys.d.ts +24 -12
  10. package/resources/api-keys.d.ts.map +1 -1
  11. package/resources/approvals.d.mts +24 -12
  12. package/resources/approvals.d.mts.map +1 -1
  13. package/resources/approvals.d.ts +24 -12
  14. package/resources/approvals.d.ts.map +1 -1
  15. package/resources/counterparties.d.mts +6 -3
  16. package/resources/counterparties.d.mts.map +1 -1
  17. package/resources/counterparties.d.ts +6 -3
  18. package/resources/counterparties.d.ts.map +1 -1
  19. package/resources/customers.d.mts +12 -6
  20. package/resources/customers.d.mts.map +1 -1
  21. package/resources/customers.d.ts +12 -6
  22. package/resources/customers.d.ts.map +1 -1
  23. package/resources/external-accounts.d.mts +12 -6
  24. package/resources/external-accounts.d.mts.map +1 -1
  25. package/resources/external-accounts.d.ts +12 -6
  26. package/resources/external-accounts.d.ts.map +1 -1
  27. package/resources/invitations.d.mts +18 -9
  28. package/resources/invitations.d.mts.map +1 -1
  29. package/resources/invitations.d.ts +18 -9
  30. package/resources/invitations.d.ts.map +1 -1
  31. package/resources/parties.d.mts +24 -12
  32. package/resources/parties.d.mts.map +1 -1
  33. package/resources/parties.d.ts +24 -12
  34. package/resources/parties.d.ts.map +1 -1
  35. package/resources/payment-requests.d.mts +66 -59
  36. package/resources/payment-requests.d.mts.map +1 -1
  37. package/resources/payment-requests.d.ts +66 -59
  38. package/resources/payment-requests.d.ts.map +1 -1
  39. package/resources/payment-requests.js +46 -33
  40. package/resources/payment-requests.js.map +1 -1
  41. package/resources/payment-requests.mjs +46 -33
  42. package/resources/payment-requests.mjs.map +1 -1
  43. package/resources/payments.d.mts +46 -43
  44. package/resources/payments.d.mts.map +1 -1
  45. package/resources/payments.d.ts +46 -43
  46. package/resources/payments.d.ts.map +1 -1
  47. package/resources/payments.js +30 -23
  48. package/resources/payments.js.map +1 -1
  49. package/resources/payments.mjs +30 -23
  50. package/resources/payments.mjs.map +1 -1
  51. package/resources/transactions.d.mts +23 -15
  52. package/resources/transactions.d.mts.map +1 -1
  53. package/resources/transactions.d.ts +23 -15
  54. package/resources/transactions.d.ts.map +1 -1
  55. package/resources/transactions.js +18 -6
  56. package/resources/transactions.js.map +1 -1
  57. package/resources/transactions.mjs +18 -6
  58. package/resources/transactions.mjs.map +1 -1
  59. package/resources/transfers.d.mts +48 -43
  60. package/resources/transfers.d.mts.map +1 -1
  61. package/resources/transfers.d.ts +48 -43
  62. package/resources/transfers.d.ts.map +1 -1
  63. package/resources/transfers.js +29 -20
  64. package/resources/transfers.js.map +1 -1
  65. package/resources/transfers.mjs +29 -20
  66. package/resources/transfers.mjs.map +1 -1
  67. package/resources/wallet.d.mts +12 -6
  68. package/resources/wallet.d.mts.map +1 -1
  69. package/resources/wallet.d.ts +12 -6
  70. package/resources/wallet.d.ts.map +1 -1
  71. package/resources/webhooks.d.mts +36 -18
  72. package/resources/webhooks.d.mts.map +1 -1
  73. package/resources/webhooks.d.ts +36 -18
  74. package/resources/webhooks.d.ts.map +1 -1
  75. package/src/resources/agents.ts +54 -27
  76. package/src/resources/api-keys.ts +24 -12
  77. package/src/resources/approvals.ts +24 -12
  78. package/src/resources/counterparties.ts +6 -3
  79. package/src/resources/customers.ts +12 -6
  80. package/src/resources/external-accounts.ts +12 -6
  81. package/src/resources/invitations.ts +18 -9
  82. package/src/resources/parties.ts +24 -12
  83. package/src/resources/payment-requests.ts +110 -70
  84. package/src/resources/payments.ts +83 -53
  85. package/src/resources/transactions.ts +44 -21
  86. package/src/resources/transfers.ts +79 -51
  87. package/src/resources/wallet.ts +12 -6
  88. package/src/resources/webhooks.ts +36 -18
  89. package/src/version.ts +1 -1
  90. package/version.d.mts +1 -1
  91. package/version.d.ts +1 -1
  92. package/version.js +1 -1
  93. package/version.mjs +1 -1
@@ -21,8 +21,6 @@ export class PaymentRequests extends APIResource {
21
21
  * amount: 1,
22
22
  * payer: { type: 'email', value: 'dev@stainless.com' },
23
23
  * 'Idempotency-Key': 'Idempotency-Key',
24
- * 'X-Agent-ID': 'X-Agent-ID',
25
- * 'X-Instance-ID': 'X-Instance-ID',
26
24
  * });
27
25
  * ```
28
26
  */
@@ -40,7 +38,11 @@ export class PaymentRequests extends APIResource {
40
38
  body,
41
39
  ...options,
42
40
  headers: buildHeaders([
43
- { 'Idempotency-Key': idempotencyKey, 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID },
41
+ {
42
+ 'Idempotency-Key': idempotencyKey,
43
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
44
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
45
+ },
44
46
  options?.headers,
45
47
  ]),
46
48
  });
@@ -51,18 +53,24 @@ export class PaymentRequests extends APIResource {
51
53
  *
52
54
  * @example
53
55
  * ```ts
54
- * const paymentRequests = await client.paymentRequests.list({
55
- * 'X-Agent-ID': 'X-Agent-ID',
56
- * 'X-Instance-ID': 'X-Instance-ID',
57
- * });
56
+ * const paymentRequests = await client.paymentRequests.list();
58
57
  * ```
59
58
  */
60
- list(params: PaymentRequestListParams, options?: RequestOptions): APIPromise<PaymentRequestListResponse> {
61
- const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params;
59
+ list(
60
+ params: PaymentRequestListParams | null | undefined = {},
61
+ options?: RequestOptions,
62
+ ): APIPromise<PaymentRequestListResponse> {
63
+ const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
62
64
  return this._client.get('/payment-requests', {
63
65
  query,
64
66
  ...options,
65
- headers: buildHeaders([{ 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID }, options?.headers]),
67
+ headers: buildHeaders([
68
+ {
69
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
70
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
71
+ },
72
+ options?.headers,
73
+ ]),
66
74
  });
67
75
  }
68
76
 
@@ -74,11 +82,7 @@ export class PaymentRequests extends APIResource {
74
82
  * ```ts
75
83
  * const response = await client.paymentRequests.decline(
76
84
  * 'prq_ecc2efdd09bd231a9ad9bd2aada37aa7',
77
- * {
78
- * 'Idempotency-Key': 'Idempotency-Key',
79
- * 'X-Agent-ID': 'X-Agent-ID',
80
- * 'X-Instance-ID': 'X-Instance-ID',
81
- * },
85
+ * { 'Idempotency-Key': 'Idempotency-Key' },
82
86
  * );
83
87
  * ```
84
88
  */
@@ -95,7 +99,11 @@ export class PaymentRequests extends APIResource {
95
99
  return this._client.post(path`/payment-requests/${paymentRequestID}/decline`, {
96
100
  ...options,
97
101
  headers: buildHeaders([
98
- { 'Idempotency-Key': idempotencyKey, 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID },
102
+ {
103
+ 'Idempotency-Key': idempotencyKey,
104
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
105
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
106
+ },
99
107
  options?.headers,
100
108
  ]),
101
109
  });
@@ -114,8 +122,6 @@ export class PaymentRequests extends APIResource {
114
122
  * walletId: 'wal_ecc2efdd09bd231a9ad9bd2aada37aa7',
115
123
  * },
116
124
  * 'Idempotency-Key': 'Idempotency-Key',
117
- * 'X-Agent-ID': 'X-Agent-ID',
118
- * 'X-Instance-ID': 'X-Instance-ID',
119
125
  * },
120
126
  * );
121
127
  * ```
@@ -135,7 +141,11 @@ export class PaymentRequests extends APIResource {
135
141
  body,
136
142
  ...options,
137
143
  headers: buildHeaders([
138
- { 'Idempotency-Key': idempotencyKey, 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID },
144
+ {
145
+ 'Idempotency-Key': idempotencyKey,
146
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
147
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
148
+ },
139
149
  options?.headers,
140
150
  ]),
141
151
  });
@@ -148,22 +158,24 @@ export class PaymentRequests extends APIResource {
148
158
  * ```ts
149
159
  * const paymentRequest = await client.paymentRequests.get(
150
160
  * 'prq_ecc2efdd09bd231a9ad9bd2aada37aa7',
151
- * {
152
- * 'X-Agent-ID': 'X-Agent-ID',
153
- * 'X-Instance-ID': 'X-Instance-ID',
154
- * },
155
161
  * );
156
162
  * ```
157
163
  */
158
164
  get(
159
165
  paymentRequestID: string,
160
- params: PaymentRequestGetParams,
166
+ params: PaymentRequestGetParams | null | undefined = {},
161
167
  options?: RequestOptions,
162
168
  ): APIPromise<PaymentRequestGetResponse> {
163
- const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID } = params;
169
+ const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID } = params ?? {};
164
170
  return this._client.get(path`/payment-requests/${paymentRequestID}`, {
165
171
  ...options,
166
- headers: buildHeaders([{ 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID }, options?.headers]),
172
+ headers: buildHeaders([
173
+ {
174
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
175
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
176
+ },
177
+ options?.headers,
178
+ ]),
167
179
  });
168
180
  }
169
181
 
@@ -172,21 +184,25 @@ export class PaymentRequests extends APIResource {
172
184
  *
173
185
  * @example
174
186
  * ```ts
175
- * const response = await client.paymentRequests.listIncoming({
176
- * 'X-Agent-ID': 'X-Agent-ID',
177
- * 'X-Instance-ID': 'X-Instance-ID',
178
- * });
187
+ * const response =
188
+ * await client.paymentRequests.listIncoming();
179
189
  * ```
180
190
  */
181
191
  listIncoming(
182
- params: PaymentRequestListIncomingParams,
192
+ params: PaymentRequestListIncomingParams | null | undefined = {},
183
193
  options?: RequestOptions,
184
194
  ): APIPromise<PaymentRequestListIncomingResponse> {
185
- const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params;
195
+ const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
186
196
  return this._client.get('/payment-requests/incoming', {
187
197
  query,
188
198
  ...options,
189
- headers: buildHeaders([{ 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID }, options?.headers]),
199
+ headers: buildHeaders([
200
+ {
201
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
202
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
203
+ },
204
+ options?.headers,
205
+ ]),
190
206
  });
191
207
  }
192
208
  }
@@ -1640,16 +1656,6 @@ export interface PaymentRequestCreateParams {
1640
1656
  */
1641
1657
  'Idempotency-Key': string;
1642
1658
 
1643
- /**
1644
- * Header param: Agent ID (agt_xxx) used for attribution and audit.
1645
- */
1646
- 'X-Agent-ID': string;
1647
-
1648
- /**
1649
- * Header param: Stable run, session, or conversation ID for agent observability.
1650
- */
1651
- 'X-Instance-ID': string;
1652
-
1653
1659
  /**
1654
1660
  * Body param: Currency code (currently only USD)
1655
1661
  */
@@ -1676,6 +1682,20 @@ export interface PaymentRequestCreateParams {
1676
1682
  * party's default wallet.
1677
1683
  */
1678
1684
  walletId?: string;
1685
+
1686
+ /**
1687
+ * Header param: Conditionally required for payment-related API requests. Pass an
1688
+ * agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
1689
+ * one active agent, which Natural defaults automatically.
1690
+ */
1691
+ 'X-Agent-ID'?: string;
1692
+
1693
+ /**
1694
+ * Header param: Stable run, session, or conversation ID for agent observability.
1695
+ * If omitted on a payment-related API request, Natural generates one after
1696
+ * resolving the attribution agent.
1697
+ */
1698
+ 'X-Instance-ID'?: string;
1679
1699
  }
1680
1700
 
1681
1701
  export namespace PaymentRequestCreateParams {
@@ -1718,24 +1738,28 @@ export namespace PaymentRequestCreateParams {
1718
1738
 
1719
1739
  export interface PaymentRequestListParams {
1720
1740
  /**
1721
- * Header param: Agent ID (agt_xxx) used for attribution and audit.
1741
+ * Query param: Pagination cursor returned by the previous response
1722
1742
  */
1723
- 'X-Agent-ID': string;
1743
+ cursor?: string;
1724
1744
 
1725
1745
  /**
1726
- * Header param: Stable run, session, or conversation ID for agent observability.
1746
+ * Query param: Results per page (1-100)
1727
1747
  */
1728
- 'X-Instance-ID': string;
1748
+ limit?: number;
1729
1749
 
1730
1750
  /**
1731
- * Query param: Pagination cursor returned by the previous response
1751
+ * Header param: Conditionally required for payment-related API requests. Pass an
1752
+ * agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
1753
+ * one active agent, which Natural defaults automatically.
1732
1754
  */
1733
- cursor?: string;
1755
+ 'X-Agent-ID'?: string;
1734
1756
 
1735
1757
  /**
1736
- * Query param: Results per page (1-100)
1758
+ * Header param: Stable run, session, or conversation ID for agent observability.
1759
+ * If omitted on a payment-related API request, Natural generates one after
1760
+ * resolving the attribution agent.
1737
1761
  */
1738
- limit?: number;
1762
+ 'X-Instance-ID'?: string;
1739
1763
  }
1740
1764
 
1741
1765
  export interface PaymentRequestDeclineParams {
@@ -1746,14 +1770,18 @@ export interface PaymentRequestDeclineParams {
1746
1770
  'Idempotency-Key': string;
1747
1771
 
1748
1772
  /**
1749
- * Agent ID (agt_xxx) used for attribution and audit.
1773
+ * Conditionally required for payment-related API requests. Pass an agent ID
1774
+ * (agt_xxx) for attribution, or omit it only when your party has exactly one
1775
+ * active agent, which Natural defaults automatically.
1750
1776
  */
1751
- 'X-Agent-ID': string;
1777
+ 'X-Agent-ID'?: string;
1752
1778
 
1753
1779
  /**
1754
- * Stable run, session, or conversation ID for agent observability.
1780
+ * Stable run, session, or conversation ID for agent observability. If omitted on a
1781
+ * payment-related API request, Natural generates one after resolving the
1782
+ * attribution agent.
1755
1783
  */
1756
- 'X-Instance-ID': string;
1784
+ 'X-Instance-ID'?: string;
1757
1785
  }
1758
1786
 
1759
1787
  export interface PaymentRequestFulfillParams {
@@ -1769,14 +1797,18 @@ export interface PaymentRequestFulfillParams {
1769
1797
  'Idempotency-Key': string;
1770
1798
 
1771
1799
  /**
1772
- * Header param: Agent ID (agt_xxx) used for attribution and audit.
1800
+ * Header param: Conditionally required for payment-related API requests. Pass an
1801
+ * agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
1802
+ * one active agent, which Natural defaults automatically.
1773
1803
  */
1774
- 'X-Agent-ID': string;
1804
+ 'X-Agent-ID'?: string;
1775
1805
 
1776
1806
  /**
1777
1807
  * Header param: Stable run, session, or conversation ID for agent observability.
1808
+ * If omitted on a payment-related API request, Natural generates one after
1809
+ * resolving the attribution agent.
1778
1810
  */
1779
- 'X-Instance-ID': string;
1811
+ 'X-Instance-ID'?: string;
1780
1812
  }
1781
1813
 
1782
1814
  export namespace PaymentRequestFulfillParams {
@@ -1795,36 +1827,44 @@ export namespace PaymentRequestFulfillParams {
1795
1827
 
1796
1828
  export interface PaymentRequestGetParams {
1797
1829
  /**
1798
- * Agent ID (agt_xxx) used for attribution and audit.
1830
+ * Conditionally required for payment-related API requests. Pass an agent ID
1831
+ * (agt_xxx) for attribution, or omit it only when your party has exactly one
1832
+ * active agent, which Natural defaults automatically.
1799
1833
  */
1800
- 'X-Agent-ID': string;
1834
+ 'X-Agent-ID'?: string;
1801
1835
 
1802
1836
  /**
1803
- * Stable run, session, or conversation ID for agent observability.
1837
+ * Stable run, session, or conversation ID for agent observability. If omitted on a
1838
+ * payment-related API request, Natural generates one after resolving the
1839
+ * attribution agent.
1804
1840
  */
1805
- 'X-Instance-ID': string;
1841
+ 'X-Instance-ID'?: string;
1806
1842
  }
1807
1843
 
1808
1844
  export interface PaymentRequestListIncomingParams {
1809
1845
  /**
1810
- * Header param: Agent ID (agt_xxx) used for attribution and audit.
1846
+ * Query param: Pagination cursor returned by the previous response
1811
1847
  */
1812
- 'X-Agent-ID': string;
1848
+ cursor?: string;
1813
1849
 
1814
1850
  /**
1815
- * Header param: Stable run, session, or conversation ID for agent observability.
1851
+ * Query param: Results per page (1-100)
1816
1852
  */
1817
- 'X-Instance-ID': string;
1853
+ limit?: number;
1818
1854
 
1819
1855
  /**
1820
- * Query param: Pagination cursor returned by the previous response
1856
+ * Header param: Conditionally required for payment-related API requests. Pass an
1857
+ * agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
1858
+ * one active agent, which Natural defaults automatically.
1821
1859
  */
1822
- cursor?: string;
1860
+ 'X-Agent-ID'?: string;
1823
1861
 
1824
1862
  /**
1825
- * Query param: Results per page (1-100)
1863
+ * Header param: Stable run, session, or conversation ID for agent observability.
1864
+ * If omitted on a payment-related API request, Natural generates one after
1865
+ * resolving the attribution agent.
1826
1866
  */
1827
- limit?: number;
1867
+ 'X-Instance-ID'?: string;
1828
1868
  }
1829
1869
 
1830
1870
  export declare namespace PaymentRequests {
@@ -22,8 +22,6 @@ export class Payments extends APIResource {
22
22
  * value: 'dev@stainless.com',
23
23
  * },
24
24
  * 'Idempotency-Key': 'Idempotency-Key',
25
- * 'X-Agent-ID': 'X-Agent-ID',
26
- * 'X-Instance-ID': 'X-Instance-ID',
27
25
  * });
28
26
  * ```
29
27
  */
@@ -38,7 +36,11 @@ export class Payments extends APIResource {
38
36
  body,
39
37
  ...options,
40
38
  headers: buildHeaders([
41
- { 'Idempotency-Key': idempotencyKey, 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID },
39
+ {
40
+ 'Idempotency-Key': idempotencyKey,
41
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
42
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
43
+ },
42
44
  options?.headers,
43
45
  ]),
44
46
  });
@@ -49,18 +51,24 @@ export class Payments extends APIResource {
49
51
  *
50
52
  * @example
51
53
  * ```ts
52
- * const payments = await client.payments.list({
53
- * 'X-Agent-ID': 'X-Agent-ID',
54
- * 'X-Instance-ID': 'X-Instance-ID',
55
- * });
54
+ * const payments = await client.payments.list();
56
55
  * ```
57
56
  */
58
- list(params: PaymentListParams, options?: RequestOptions): APIPromise<PaymentListResponse> {
59
- const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params;
57
+ list(
58
+ params: PaymentListParams | null | undefined = {},
59
+ options?: RequestOptions,
60
+ ): APIPromise<PaymentListResponse> {
61
+ const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
60
62
  return this._client.get('/payments', {
61
63
  query,
62
64
  ...options,
63
- headers: buildHeaders([{ 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID }, options?.headers]),
65
+ headers: buildHeaders([
66
+ {
67
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
68
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
69
+ },
70
+ options?.headers,
71
+ ]),
64
72
  });
65
73
  }
66
74
 
@@ -71,11 +79,7 @@ export class Payments extends APIResource {
71
79
  * ```ts
72
80
  * const response = await client.payments.cancel(
73
81
  * 'pay_ecc2efdd09bd231a9ad9bd2aada37aa7',
74
- * {
75
- * 'Idempotency-Key': 'Idempotency-Key',
76
- * 'X-Agent-ID': 'X-Agent-ID',
77
- * 'X-Instance-ID': 'X-Instance-ID',
78
- * },
82
+ * { 'Idempotency-Key': 'Idempotency-Key' },
79
83
  * );
80
84
  * ```
81
85
  */
@@ -92,7 +96,11 @@ export class Payments extends APIResource {
92
96
  return this._client.post(path`/payments/${paymentID}/cancel`, {
93
97
  ...options,
94
98
  headers: buildHeaders([
95
- { 'Idempotency-Key': idempotencyKey, 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID },
99
+ {
100
+ 'Idempotency-Key': idempotencyKey,
101
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
102
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
103
+ },
96
104
  options?.headers,
97
105
  ]),
98
106
  });
@@ -105,19 +113,25 @@ export class Payments extends APIResource {
105
113
  * ```ts
106
114
  * const payment = await client.payments.get(
107
115
  * 'pay_ecc2efdd09bd231a9ad9bd2aada37aa7',
108
- * {
109
- * 'X-Agent-ID': 'X-Agent-ID',
110
- * 'X-Instance-ID': 'X-Instance-ID',
111
- * },
112
116
  * );
113
117
  * ```
114
118
  */
115
- get(paymentID: string, params: PaymentGetParams, options?: RequestOptions): APIPromise<PaymentGetResponse> {
116
- const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params;
119
+ get(
120
+ paymentID: string,
121
+ params: PaymentGetParams | null | undefined = {},
122
+ options?: RequestOptions,
123
+ ): APIPromise<PaymentGetResponse> {
124
+ const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
117
125
  return this._client.get(path`/payments/${paymentID}`, {
118
126
  query,
119
127
  ...options,
120
- headers: buildHeaders([{ 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID }, options?.headers]),
128
+ headers: buildHeaders([
129
+ {
130
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
131
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
132
+ },
133
+ options?.headers,
134
+ ]),
121
135
  });
122
136
  }
123
137
  }
@@ -1046,16 +1060,6 @@ export interface PaymentCreateParams {
1046
1060
  */
1047
1061
  'Idempotency-Key': string;
1048
1062
 
1049
- /**
1050
- * Header param: Agent ID (agt_xxx) used for attribution and audit.
1051
- */
1052
- 'X-Agent-ID': string;
1053
-
1054
- /**
1055
- * Header param: Stable run, session, or conversation ID for agent observability.
1056
- */
1057
- 'X-Instance-ID': string;
1058
-
1059
1063
  /**
1060
1064
  * Body param: Currency code
1061
1065
  */
@@ -1071,6 +1075,20 @@ export interface PaymentCreateParams {
1071
1075
  * Body param: Payment description. Maximum 500 characters.
1072
1076
  */
1073
1077
  description?: string;
1078
+
1079
+ /**
1080
+ * Header param: Conditionally required for payment-related API requests. Pass an
1081
+ * agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
1082
+ * one active agent, which Natural defaults automatically.
1083
+ */
1084
+ 'X-Agent-ID'?: string;
1085
+
1086
+ /**
1087
+ * Header param: Stable run, session, or conversation ID for agent observability.
1088
+ * If omitted on a payment-related API request, Natural generates one after
1089
+ * resolving the attribution agent.
1090
+ */
1091
+ 'X-Instance-ID'?: string;
1074
1092
  }
1075
1093
 
1076
1094
  export namespace PaymentCreateParams {
@@ -1112,16 +1130,6 @@ export namespace PaymentCreateParams {
1112
1130
  }
1113
1131
 
1114
1132
  export interface PaymentListParams {
1115
- /**
1116
- * Header param: Agent ID (agt_xxx) used for attribution and audit.
1117
- */
1118
- 'X-Agent-ID': string;
1119
-
1120
- /**
1121
- * Header param: Stable run, session, or conversation ID for agent observability.
1122
- */
1123
- 'X-Instance-ID': string;
1124
-
1125
1133
  /**
1126
1134
  * Query param: Pagination cursor from previous response
1127
1135
  */
@@ -1136,6 +1144,20 @@ export interface PaymentListParams {
1136
1144
  * Query param: Party ID for delegated payment lookup
1137
1145
  */
1138
1146
  partyId?: string;
1147
+
1148
+ /**
1149
+ * Header param: Conditionally required for payment-related API requests. Pass an
1150
+ * agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
1151
+ * one active agent, which Natural defaults automatically.
1152
+ */
1153
+ 'X-Agent-ID'?: string;
1154
+
1155
+ /**
1156
+ * Header param: Stable run, session, or conversation ID for agent observability.
1157
+ * If omitted on a payment-related API request, Natural generates one after
1158
+ * resolving the attribution agent.
1159
+ */
1160
+ 'X-Instance-ID'?: string;
1139
1161
  }
1140
1162
 
1141
1163
  export interface PaymentCancelParams {
@@ -1146,31 +1168,39 @@ export interface PaymentCancelParams {
1146
1168
  'Idempotency-Key': string;
1147
1169
 
1148
1170
  /**
1149
- * Agent ID (agt_xxx) used for attribution and audit.
1171
+ * Conditionally required for payment-related API requests. Pass an agent ID
1172
+ * (agt_xxx) for attribution, or omit it only when your party has exactly one
1173
+ * active agent, which Natural defaults automatically.
1150
1174
  */
1151
- 'X-Agent-ID': string;
1175
+ 'X-Agent-ID'?: string;
1152
1176
 
1153
1177
  /**
1154
- * Stable run, session, or conversation ID for agent observability.
1178
+ * Stable run, session, or conversation ID for agent observability. If omitted on a
1179
+ * payment-related API request, Natural generates one after resolving the
1180
+ * attribution agent.
1155
1181
  */
1156
- 'X-Instance-ID': string;
1182
+ 'X-Instance-ID'?: string;
1157
1183
  }
1158
1184
 
1159
1185
  export interface PaymentGetParams {
1160
1186
  /**
1161
- * Header param: Agent ID (agt_xxx) used for attribution and audit.
1187
+ * Query param: Party ID for delegated payment lookup
1162
1188
  */
1163
- 'X-Agent-ID': string;
1189
+ partyId?: string;
1164
1190
 
1165
1191
  /**
1166
- * Header param: Stable run, session, or conversation ID for agent observability.
1192
+ * Header param: Conditionally required for payment-related API requests. Pass an
1193
+ * agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
1194
+ * one active agent, which Natural defaults automatically.
1167
1195
  */
1168
- 'X-Instance-ID': string;
1196
+ 'X-Agent-ID'?: string;
1169
1197
 
1170
1198
  /**
1171
- * Query param: Party ID for delegated payment lookup
1199
+ * Header param: Stable run, session, or conversation ID for agent observability.
1200
+ * If omitted on a payment-related API request, Natural generates one after
1201
+ * resolving the attribution agent.
1172
1202
  */
1173
- partyId?: string;
1203
+ 'X-Instance-ID'?: string;
1174
1204
  }
1175
1205
 
1176
1206
  export declare namespace Payments {
@@ -13,12 +13,21 @@ export class Transactions extends APIResource {
13
13
  /**
14
14
  * List transactions visible to your party.
15
15
  */
16
- list(params: TransactionListParams, options?: RequestOptions): APIPromise<TransactionListResponse> {
17
- const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params;
16
+ list(
17
+ params: TransactionListParams | null | undefined = {},
18
+ options?: RequestOptions,
19
+ ): APIPromise<TransactionListResponse> {
20
+ const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
18
21
  return this._client.get('/transactions', {
19
22
  query,
20
23
  ...options,
21
- headers: buildHeaders([{ 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID }, options?.headers]),
24
+ headers: buildHeaders([
25
+ {
26
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
27
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
28
+ },
29
+ options?.headers,
30
+ ]),
22
31
  });
23
32
  }
24
33
 
@@ -27,14 +36,20 @@ export class Transactions extends APIResource {
27
36
  */
28
37
  get(
29
38
  transactionID: string,
30
- params: TransactionGetParams,
39
+ params: TransactionGetParams | null | undefined = {},
31
40
  options?: RequestOptions,
32
41
  ): APIPromise<TransactionGetResponse> {
33
- const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params;
42
+ const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
34
43
  return this._client.get(path`/transactions/${transactionID}`, {
35
44
  query,
36
45
  ...options,
37
- headers: buildHeaders([{ 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID }, options?.headers]),
46
+ headers: buildHeaders([
47
+ {
48
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
49
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
50
+ },
51
+ options?.headers,
52
+ ]),
38
53
  });
39
54
  }
40
55
  }
@@ -464,16 +479,6 @@ export namespace TransactionGetResponse {
464
479
  }
465
480
 
466
481
  export interface TransactionListParams {
467
- /**
468
- * Header param: Agent ID (agt_xxx) used for attribution and audit.
469
- */
470
- 'X-Agent-ID': string;
471
-
472
- /**
473
- * Header param: Stable run, session, or conversation ID for agent observability.
474
- */
475
- 'X-Instance-ID': string;
476
-
477
482
  /**
478
483
  * Query param: Pagination cursor from previous response
479
484
  */
@@ -488,23 +493,41 @@ export interface TransactionListParams {
488
493
  * Query param
489
494
  */
490
495
  type?: 'payment' | 'transfer' | 'all';
491
- }
492
496
 
493
- export interface TransactionGetParams {
494
497
  /**
495
- * Header param: Agent ID (agt_xxx) used for attribution and audit.
498
+ * Header param: Conditionally required for payment-related API requests. Pass an
499
+ * agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
500
+ * one active agent, which Natural defaults automatically.
496
501
  */
497
- 'X-Agent-ID': string;
502
+ 'X-Agent-ID'?: string;
498
503
 
499
504
  /**
500
505
  * Header param: Stable run, session, or conversation ID for agent observability.
506
+ * If omitted on a payment-related API request, Natural generates one after
507
+ * resolving the attribution agent.
501
508
  */
502
- 'X-Instance-ID': string;
509
+ 'X-Instance-ID'?: string;
510
+ }
503
511
 
512
+ export interface TransactionGetParams {
504
513
  /**
505
514
  * Query param: Party ID for delegated transaction lookup
506
515
  */
507
516
  partyId?: string;
517
+
518
+ /**
519
+ * Header param: Conditionally required for payment-related API requests. Pass an
520
+ * agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
521
+ * one active agent, which Natural defaults automatically.
522
+ */
523
+ 'X-Agent-ID'?: string;
524
+
525
+ /**
526
+ * Header param: Stable run, session, or conversation ID for agent observability.
527
+ * If omitted on a payment-related API request, Natural generates one after
528
+ * resolving the attribution agent.
529
+ */
530
+ 'X-Instance-ID'?: string;
508
531
  }
509
532
 
510
533
  export declare namespace Transactions {