@iteradian-rpc/sdk 1.0.1 → 1.2.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.
package/dist/index.d.ts CHANGED
@@ -1,73 +1,225 @@
1
+ /** A number the API may send as a JSON number or as a numeric string. */
2
+ type Numeric = number | string;
3
+ /** An open string union: known values autocomplete, unknown ones still type-check. */
4
+ type OpenString<T extends string> = T | (string & {});
5
+ /** Plain `{ message }` acknowledgement. */
6
+ interface MessageResponse {
7
+ message: string;
8
+ }
1
9
  interface RegisterRequest {
2
10
  email: string;
3
11
  password: string;
12
+ /**
13
+ * The caller confirms the user agreed to the Terms of Service, Privacy
14
+ * Policy and DPA (https://iteradian.com/terms, /privacy, /dpa). Always
15
+ * sent; the server rejects registration (400) unless this is `true`.
16
+ */
17
+ acceptedTerms: boolean;
18
+ /** @deprecated Ignored by the API. */
4
19
  organizationName?: string;
5
20
  }
6
21
  interface LoginRequest {
7
22
  email: string;
8
23
  password: string;
24
+ /** Current 6-digit authenticator code, when two-factor auth is on. */
9
25
  twoFactorCode?: string;
26
+ /** One-time backup code, used instead of `twoFactorCode`. */
10
27
  backupCode?: string;
11
28
  }
29
+ /**
30
+ * What `POST /auth/register` answers — whether or not the address already has
31
+ * an account (so it cannot be used to probe for accounts). No session is
32
+ * created: the user confirms their address from the email, then logs in.
33
+ */
34
+ interface RegisterResponse {
35
+ message: string;
36
+ email: string;
37
+ }
38
+ /** The signed-in user as returned with tokens. */
39
+ interface AuthUser {
40
+ id: string;
41
+ email?: string;
42
+ personalOrgId?: string | null;
43
+ emailVerified?: boolean;
44
+ twoFactorEnabled?: boolean;
45
+ systemRole?: OpenString<"user" | "admin" | "super_admin">;
46
+ isIteradianMember?: boolean;
47
+ }
48
+ /**
49
+ * What login answers. With two-factor auth on and no code sent, the API
50
+ * answers `{ requires2FA: true }` and no tokens: check `requires2FA`, then
51
+ * log in again with `twoFactorCode` or `backupCode`.
52
+ */
53
+ interface LoginResult {
54
+ accessToken?: string;
55
+ refreshToken?: string;
56
+ user?: AuthUser;
57
+ requires2FA?: boolean;
58
+ }
59
+ /** What refresh answers: both tokens are always present. */
12
60
  interface AuthTokens {
13
61
  accessToken: string;
14
62
  refreshToken: string;
15
- user: User;
63
+ user?: AuthUser;
16
64
  }
17
65
  interface TwoFASetup {
18
66
  secret: string;
19
67
  qrCode: string;
20
68
  }
21
- interface User {
22
- id: string;
23
- email: string;
24
- emailVerified: boolean;
25
- systemRole: "user" | "admin" | "super_admin";
26
- twoFactorEnabled: boolean;
27
- createdAt: string;
28
- updatedAt: string;
69
+ interface BackupCodes {
70
+ backupCodes: string[];
29
71
  }
72
+ type User = AuthUser;
30
73
  interface Membership {
31
74
  id: string;
32
- userId: string;
33
- organizationId: string;
34
- role: OrgRole;
35
- joinedAt: string;
75
+ userId?: string;
76
+ organizationId?: string;
77
+ role?: OrgRole;
78
+ joinedAt?: string;
36
79
  }
37
80
  type OrgRole = "owner" | "admin" | "developer" | "viewer";
81
+ type BillingInterval = "month" | "year";
82
+ /** Request body of `organizations.create`. */
83
+ interface CreateOrganizationRequest {
84
+ name: string;
85
+ /** Plan to start on, e.g. `"plan_free"`. */
86
+ planId: string;
87
+ /**
88
+ * The caller confirms the user ticked "I agree to the Terms of Service,
89
+ * Privacy Policy and DPA". The server requires the field.
90
+ */
91
+ acceptedTerms: boolean;
92
+ /** Lowercase letters, digits and hyphens, 2-50 characters. */
93
+ slug?: string;
94
+ billingInterval?: BillingInterval;
95
+ }
96
+ interface UpdateOrganizationRequest {
97
+ name?: string;
98
+ slug?: string;
99
+ }
100
+ interface OrgPlanSummary {
101
+ id: string;
102
+ name?: string;
103
+ tier?: string;
104
+ displayName?: string;
105
+ description?: string;
106
+ priceMonthly?: Numeric;
107
+ priceAnnual?: Numeric | null;
108
+ limits?: PlanLimits;
109
+ features?: string[];
110
+ isActive?: boolean;
111
+ }
112
+ interface OrgSubscriptionSummary {
113
+ id?: string;
114
+ organizationId?: string;
115
+ planId?: string;
116
+ plan?: OrgPlanSummary;
117
+ billingInterval?: string;
118
+ status?: string;
119
+ currentPeriodStart?: string;
120
+ currentPeriodEnd?: string;
121
+ cancelAtPeriodEnd?: boolean;
122
+ trialStart?: string | null;
123
+ trialEnd?: string | null;
124
+ }
125
+ /**
126
+ * An organization. Which fields are filled depends on the call: `list` adds
127
+ * `subscription` (summary), `get` adds `subscription` (full) and `members`,
128
+ * `create` adds `onboardingComplete`, `billingProvider`, `checkoutUrl` and
129
+ * `paddleCheckout`.
130
+ */
38
131
  interface Organization {
39
132
  id: string;
40
- name: string;
41
- slug: string;
42
- createdAt: string;
43
- updatedAt: string;
133
+ name?: string;
134
+ slug?: string;
135
+ avatarUrl?: string | null;
136
+ avatarUrlDark?: string | null;
137
+ role?: OrgRole;
138
+ onboardingCompletedAt?: string | null;
139
+ onboardingComplete?: boolean;
140
+ billingProvider?: string | null;
141
+ checkoutUrl?: string | null;
142
+ paddleCheckout?: unknown;
143
+ subscription?: OrgSubscriptionSummary;
144
+ members?: OrgMember[];
44
145
  }
45
146
  interface OrgMember {
46
147
  id: string;
47
- userId: string;
48
- email: string;
49
- role: OrgRole;
50
- joinedAt: string;
148
+ userId?: string;
149
+ email?: string;
150
+ avatarUrl?: string | null;
151
+ avatarUrlDark?: string | null;
152
+ role?: OrgRole;
153
+ joinedAt?: string;
154
+ userCreatedAt?: string;
155
+ }
156
+ /** An invitation to join an organization, as its owners/admins see it. */
157
+ interface OrgInvite {
158
+ id: string;
159
+ email?: string;
160
+ role?: OrgRole;
161
+ /** "expired" invitations stay listed until revoked or re-sent. */
162
+ status?: OpenString<"pending" | "expired">;
163
+ expiresAt?: string;
164
+ createdAt?: string;
165
+ /** Email of the member who sent it. */
166
+ invitedBy?: string | null;
167
+ }
168
+ /** An invitation addressed to the signed-in user. */
169
+ interface MyInvite {
170
+ id: string;
171
+ role?: OrgRole;
172
+ expiresAt?: string;
173
+ createdAt?: string;
174
+ invitedBy?: string | null;
175
+ organization?: {
176
+ id: string;
177
+ name?: string;
178
+ avatarUrl?: string | null;
179
+ avatarUrlDark?: string | null;
180
+ };
181
+ }
182
+ interface MyInvites {
183
+ /** Invitations can only be accepted once the user's email is verified. */
184
+ emailVerified?: boolean;
185
+ invites: MyInvite[];
186
+ }
187
+ /** Options for `organizations.acceptInvite`. */
188
+ interface AcceptInviteOptions {
189
+ /**
190
+ * The caller confirms the user agreed to the current Terms of Service,
191
+ * Privacy Policy and DPA. Only needed when the user has not accepted the
192
+ * current terms version yet; without it the API answers 403
193
+ * `TERMS_ACCEPTANCE_REQUIRED`. Sent only when given.
194
+ */
195
+ acceptedTerms?: boolean;
196
+ }
197
+ /** The membership created by accepting an invitation. */
198
+ interface InviteAcceptance {
199
+ organizationId?: string;
200
+ membershipId?: string;
201
+ role?: OrgRole;
51
202
  }
52
203
  interface UserPermissions {
53
- role: OrgRole;
54
- roleLabel: string;
55
- roleDescription: string;
56
- permissions: string[];
204
+ role?: OrgRole;
205
+ roleLabel?: string;
206
+ roleDescription?: string;
207
+ permissions?: string[];
57
208
  }
58
209
  interface ApiKey {
59
210
  id: string;
60
- name: string;
61
- prefix: string;
62
- environment: "live" | "test";
63
- status: "active" | "revoked";
64
- ipAllowlist: string[];
65
- allowedNetworks: string[];
66
- rateLimit: number | null;
67
- dailyLimit: number | null;
68
- expiresAt: string | null;
69
- lastUsedAt: string | null;
70
- createdAt: string;
211
+ name?: string;
212
+ prefix?: string;
213
+ environment?: OpenString<"live" | "test">;
214
+ status?: OpenString<"active" | "revoked">;
215
+ ipAllowlist?: string[];
216
+ allowedNetworks?: string[];
217
+ rateLimit?: number | null;
218
+ dailyLimit?: number | null;
219
+ expiresAt?: string | null;
220
+ walletUrlAuth?: boolean;
221
+ lastUsedAt?: string | null;
222
+ createdAt?: string;
71
223
  revokedAt?: string | null;
72
224
  }
73
225
  interface CreateApiKeyRequest {
@@ -78,6 +230,8 @@ interface CreateApiKeyRequest {
78
230
  rateLimit?: number;
79
231
  dailyLimit?: number;
80
232
  expiresAt?: string;
233
+ /** Allow the key as `?key=` in the RPC URL (wallets). Needs exactly one EVM network. */
234
+ walletUrlAuth?: boolean;
81
235
  }
82
236
  interface UpdateApiKeyRequest {
83
237
  name?: string;
@@ -87,72 +241,90 @@ interface UpdateApiKeyRequest {
87
241
  dailyLimit?: number | null;
88
242
  expiresAt?: string | null;
89
243
  }
244
+ /** An API key as returned by create and rotate: the only time the secret is shown. */
90
245
  interface ApiKeyWithSecret extends ApiKey {
246
+ /** The full API key. Shown only once. */
247
+ secret: string;
248
+ /** @deprecated Same value as `secret`. Use `secret`. */
91
249
  key: string;
92
250
  }
93
251
  interface ApiKeyAnalytics {
94
- keyId: string;
95
- keyName: string;
96
- keyPrefix: string;
97
- period: {
98
- from: string;
99
- to: string;
100
- days: number;
252
+ keyId?: string;
253
+ keyName?: string;
254
+ keyPrefix?: string;
255
+ period?: {
256
+ from?: string;
257
+ to?: string;
258
+ days?: number;
101
259
  };
102
- totals: {
103
- requests: number;
104
- errors: number;
105
- throttled: number;
106
- avgLatencyMs: number;
107
- errorRate: number;
108
- successRate: number;
260
+ totals?: {
261
+ requests?: Numeric;
262
+ errors?: Numeric;
263
+ throttled?: Numeric;
264
+ avgLatencyMs?: Numeric;
265
+ errorRate?: Numeric;
266
+ successRate?: Numeric;
109
267
  };
110
- dailyData: {
111
- date: string;
112
- requests: number;
113
- errors: number;
114
- throttled: number;
115
- avgLatencyMs: number;
268
+ dailyData?: {
269
+ date?: string;
270
+ requests?: Numeric;
271
+ errors?: Numeric;
272
+ throttled?: Numeric;
273
+ avgLatencyMs?: Numeric;
116
274
  }[];
275
+ peakDay?: {
276
+ date?: string;
277
+ requests?: Numeric;
278
+ } | null;
279
+ trends?: {
280
+ requests?: string;
281
+ errors?: string;
282
+ requestsPercent?: Numeric;
283
+ errorsPercent?: Numeric;
284
+ };
117
285
  }
118
- type EndpointRegion = "us_east" | "us_west" | "eu_west" | "eu_central" | "asia_east" | "asia_south";
286
+ type EndpointRegion = "eu_central" | "us_east" | "us_central" | "us_west" | "uk" | "asia_southeast" | "asia_east" | "australia" | "india" | "eu_west" | "asia_south";
119
287
  type EndpointStatus = "active" | "degraded" | "down" | "maintenance";
120
288
  type NetworkType = "mainnet" | "testnet";
121
289
  interface Network {
122
290
  id: string;
123
- slug: string;
124
- name: string;
125
- chainId: number;
126
- type: NetworkType;
127
- environment: string;
128
- rpcUrl?: string;
129
- wsUrl?: string;
130
- explorerUrl?: string;
131
- iconUrl?: string;
132
- isActive: boolean;
291
+ type?: OpenString<NetworkType>;
292
+ environment?: string;
293
+ name?: string;
294
+ chainId?: number;
295
+ nativeCurrency?: string;
296
+ nativeCurrencyName?: string;
297
+ nativeCurrencyDecimals?: number;
298
+ blockExplorerUrl?: string | null;
299
+ iconUrl?: string | null;
300
+ isActive?: boolean;
301
+ createdAt?: string;
302
+ updatedAt?: string;
303
+ /** Only on the list call. */
304
+ availableNodes?: number;
133
305
  }
134
306
  interface Endpoint {
135
307
  id: string;
136
- organizationId: string;
137
- networkId: string;
308
+ organizationId?: string;
309
+ networkId?: string;
138
310
  network?: Network;
139
- region: EndpointRegion;
140
- name: string;
141
- priority: number;
142
- status: EndpointStatus;
143
- isEnabled: boolean;
144
- rateLimitOverride?: number;
145
- timeoutMs: number;
146
- retryCount: number;
147
- lastHealthCheck?: string;
148
- healthCheckStatus?: EndpointStatus;
149
- avgLatencyMs?: number;
150
- successRate?: number;
151
- totalRequests?: number;
152
- totalErrors?: number;
153
- uptime?: number;
154
- createdAt: string;
155
- updatedAt: string;
311
+ region?: OpenString<EndpointRegion>;
312
+ name?: string;
313
+ priority?: number;
314
+ status?: OpenString<EndpointStatus>;
315
+ isEnabled?: boolean;
316
+ rateLimitOverride?: number | null;
317
+ timeoutMs?: number;
318
+ retryCount?: number;
319
+ lastHealthCheck?: string | null;
320
+ healthCheckStatus?: string | null;
321
+ avgLatencyMs?: Numeric | null;
322
+ successRate?: Numeric | null;
323
+ totalRequests?: Numeric;
324
+ totalErrors?: Numeric;
325
+ uptime?: Numeric | null;
326
+ createdAt?: string;
327
+ updatedAt?: string;
156
328
  }
157
329
  interface CreateEndpointRequest {
158
330
  networkId: string;
@@ -167,252 +339,591 @@ interface UpdateEndpointRequest {
167
339
  name?: string;
168
340
  region?: EndpointRegion;
169
341
  priority?: number;
342
+ isEnabled?: boolean;
170
343
  timeoutMs?: number;
171
344
  retryCount?: number;
172
345
  rateLimitOverride?: number;
173
346
  }
347
+ /** Answer of `POST .../health-check`. */
348
+ interface EndpointHealthCheck {
349
+ status?: string;
350
+ latencyMs?: Numeric | null;
351
+ checkedAt?: string | null;
352
+ }
353
+ /** Answer of `GET .../health`. */
354
+ interface EndpointHealth {
355
+ endpointId?: string;
356
+ name?: string;
357
+ network?: string;
358
+ region?: string;
359
+ status?: OpenString<"healthy" | "degraded" | "down" | "unknown">;
360
+ nodeCount?: number;
361
+ healthyNodeCount?: number;
362
+ latencyMs?: Numeric | null;
363
+ lastCheck?: string | null;
364
+ successRate?: Numeric | null;
365
+ uptime?: Numeric | null;
366
+ totalRequests?: Numeric;
367
+ totalErrors?: Numeric;
368
+ }
369
+ /** Answer of `GET .../endpoints/summary`. */
370
+ interface EndpointSummary {
371
+ total?: number;
372
+ active?: number;
373
+ degraded?: number;
374
+ down?: number;
375
+ /** Endpoint count keyed by network name. */
376
+ byNetwork?: Record<string, number>;
377
+ /** Endpoint count keyed by region. */
378
+ byRegion?: Record<string, number>;
379
+ totalRequests?: Numeric;
380
+ avgLatencyMs?: Numeric;
381
+ avgSuccessRate?: Numeric;
382
+ }
174
383
  interface EndpointMetric {
175
- id: string;
176
- endpointId: string;
177
- timestamp: string;
178
- requests: number;
179
- errors: number;
180
- avgLatencyMs: number;
181
- p50LatencyMs?: number;
182
- p95LatencyMs?: number;
183
- p99LatencyMs?: number;
184
- throttled: number;
384
+ id?: string;
385
+ endpointId?: string;
386
+ timestamp?: string;
387
+ requests?: Numeric;
388
+ errors?: Numeric;
389
+ avgLatencyMs?: Numeric;
390
+ p50LatencyMs?: Numeric;
391
+ p95LatencyMs?: Numeric;
392
+ p99LatencyMs?: Numeric;
393
+ throttled?: Numeric;
394
+ }
395
+ /** One row of `usage.get`: usage of one key on one day. */
396
+ interface UsageRow {
397
+ date?: string;
398
+ requests?: Numeric;
399
+ errors?: Numeric;
400
+ avgLatencyMs?: Numeric;
401
+ throttled?: Numeric;
402
+ keyName?: string;
403
+ keyPrefix?: string;
185
404
  }
186
405
  interface UsageSummary {
187
- totalRequests: number;
188
- totalErrors: number;
189
- avgLatencyMs: number;
190
- byNetwork: UsageByNetwork[];
191
- byRegion: UsageByRegion[];
192
- byMethod: UsageByMethod[];
193
- daily: DailyUsage[];
406
+ period?: {
407
+ from?: string;
408
+ to?: string;
409
+ };
410
+ totals?: {
411
+ requests?: Numeric;
412
+ errors?: Numeric;
413
+ throttled?: Numeric;
414
+ avgLatencyMs?: Numeric;
415
+ errorRate?: Numeric;
416
+ };
417
+ last7Days?: {
418
+ requests?: Numeric;
419
+ errors?: Numeric;
420
+ };
421
+ dailyAvgRequests?: Numeric;
422
+ byKey?: UsageByKey[];
423
+ dailyData?: DailyUsage[];
424
+ byNetwork?: UsageByNetwork[];
425
+ byRegion?: UsageByRegion[];
426
+ byMethod?: UsageByMethod[];
427
+ quotaForecast?: QuotaForecast;
428
+ }
429
+ interface UsageByKey {
430
+ keyId?: string;
431
+ keyName?: string;
432
+ keyPrefix?: string;
433
+ requests?: Numeric;
434
+ errors?: Numeric;
435
+ throttled?: Numeric;
194
436
  }
195
437
  interface UsageByNetwork {
196
- networkId: string;
197
- networkName: string;
198
- networkType: string;
199
- requests: number;
200
- errors: number;
201
- avgLatencyMs: number;
438
+ networkId?: string;
439
+ networkName?: string;
440
+ networkType?: string;
441
+ chainId?: number;
442
+ iconUrl?: string | null;
443
+ requests?: Numeric;
444
+ errors?: Numeric;
445
+ avgLatencyMs?: Numeric;
446
+ latencySum?: Numeric;
447
+ requestCount?: Numeric;
202
448
  }
203
449
  interface UsageByRegion {
204
- region: string;
205
- requests: number;
206
- errors: number;
207
- avgLatencyMs: number;
450
+ region?: string;
451
+ requests?: Numeric;
452
+ errors?: Numeric;
453
+ avgLatencyMs?: Numeric;
454
+ latencySum?: Numeric;
455
+ requestCount?: Numeric;
208
456
  }
209
457
  interface UsageByMethod {
210
- method: string;
211
- requests: number;
212
- errors: number;
213
- avgLatencyMs: number;
458
+ method?: string;
459
+ requests?: Numeric;
460
+ errors?: Numeric;
461
+ avgLatencyMs?: Numeric;
462
+ latencySum?: Numeric;
463
+ requestCount?: Numeric;
214
464
  }
215
465
  interface DailyUsage {
216
- date: string;
217
- requests: number;
218
- errors: number;
219
- avgLatencyMs: number;
220
- }
221
- interface DashboardData {
222
- quickStats: QuickStats;
223
- requestRate: DataPoint[];
224
- errorRate: DataPoint[];
466
+ date?: string;
467
+ requests?: Numeric;
468
+ errors?: Numeric;
469
+ throttled?: Numeric;
470
+ avgLatencyMs?: Numeric;
471
+ }
472
+ interface QuotaForecast {
473
+ hasQuota?: boolean;
474
+ unlimited?: boolean;
475
+ monthlyQuota?: Numeric;
476
+ usedThisMonth?: Numeric;
477
+ remainingQuota?: Numeric;
478
+ usagePercentage?: Numeric;
479
+ dailyAverage?: Numeric;
480
+ daysRemainingInMonth?: Numeric;
481
+ daysUntilExhaustion?: Numeric | null;
482
+ projectedUsage?: Numeric;
483
+ projectedPercentage?: Numeric;
484
+ status?: string;
225
485
  }
226
- interface QuickStats {
227
- totalRequests: number;
228
- totalErrors: number;
229
- avgLatencyMs: number;
230
- successRate: number;
231
- activeEndpoints: number;
486
+ /**
487
+ * Dashboard time range. The API values are `last_hour`, `last_24_hours`
488
+ * (default), `last_7_days`, `last_30_days` and `custom` (needs `from` and
489
+ * `to`). The short forms `1h`, `24h`, `7d` and `30d` are translated.
490
+ */
491
+ type DashboardTimeRange = "last_hour" | "last_24_hours" | "last_7_days" | "last_30_days" | "custom" | "1h" | "24h" | "7d" | "30d";
492
+ /** ISO 8601 dates for `timeRange: "custom"`. */
493
+ interface CustomRange {
494
+ from?: string;
495
+ to?: string;
232
496
  }
233
497
  interface DataPoint {
234
- timestamp: string;
235
- value: number;
498
+ timestamp?: string;
499
+ value?: Numeric;
500
+ }
501
+ interface ServiceStatus {
502
+ status?: string;
503
+ latency?: Numeric;
236
504
  }
505
+ interface EndpointHealthEntry {
506
+ endpoint?: string;
507
+ status?: string;
508
+ latency?: Numeric;
509
+ uptime?: Numeric;
510
+ lastCheck?: string | null;
511
+ }
512
+ /** Answer of `dashboard.getHealth` (also `DashboardData.health`). */
237
513
  interface HealthStatus {
238
- status: "healthy" | "degraded" | "down";
239
- endpoints: {
240
- id: string;
241
- name: string;
242
- status: string;
514
+ overallStatus?: string;
515
+ database?: ServiceStatus;
516
+ redis?: ServiceStatus;
517
+ endpoints?: EndpointHealthEntry[];
518
+ timestamp?: string;
519
+ }
520
+ interface QuickStats {
521
+ totalRequests?: Numeric;
522
+ totalErrors?: Numeric;
523
+ avgLatency?: Numeric;
524
+ activeKeys?: Numeric;
525
+ quotaUsed?: Numeric;
526
+ quotaLimit?: Numeric;
527
+ quotaPercentage?: Numeric;
528
+ quotaPeriodStart?: string;
529
+ quotaPeriodEnd?: string;
530
+ quotaUnmetered?: boolean;
531
+ quotaMode?: string;
532
+ quotaLabel?: string | null;
533
+ overageEnabled?: boolean;
534
+ overageRatePer1k?: Numeric;
535
+ overageRequests?: Numeric;
536
+ overageCapUsd?: Numeric;
537
+ hardLimitRequests?: Numeric;
538
+ }
539
+ interface RequestRate {
540
+ currentRate?: Numeric;
541
+ avgRate?: Numeric;
542
+ peakRate?: Numeric;
543
+ totalRequests?: Numeric;
544
+ trend?: string;
545
+ trendPercent?: Numeric;
546
+ timeSeries?: DataPoint[];
547
+ }
548
+ interface ErrorRate {
549
+ currentErrorRate?: Numeric;
550
+ avgErrorRate?: Numeric;
551
+ totalErrors?: Numeric;
552
+ trend?: string;
553
+ trendPercent?: Numeric;
554
+ timeSeries?: DataPoint[];
555
+ topErrors?: {
556
+ code?: string;
557
+ count?: Numeric;
558
+ percentage?: Numeric;
243
559
  }[];
244
560
  }
245
- type AlertSeverity = "info" | "warning" | "critical";
561
+ interface LatencyStats {
562
+ currentLatency?: Numeric;
563
+ avgLatency?: Numeric;
564
+ p50?: Numeric;
565
+ p95?: Numeric;
566
+ p99?: Numeric;
567
+ trend?: string;
568
+ trendPercent?: Numeric;
569
+ timeSeries?: DataPoint[];
570
+ }
571
+ /** Answer of `dashboard.getPerformance`. Sub-objects vary, so they are loosely typed. */
572
+ interface PerformanceStats {
573
+ latency?: LatencyStats;
574
+ cache?: Record<string, unknown>;
575
+ saturation?: Record<string, unknown>;
576
+ failover?: Record<string, unknown>;
577
+ timestamp?: string;
578
+ }
579
+ interface DashboardData {
580
+ health?: HealthStatus;
581
+ quickStats?: QuickStats;
582
+ requestRate?: RequestRate;
583
+ errorRate?: ErrorRate;
584
+ latency?: LatencyStats;
585
+ alerts?: {
586
+ alerts?: Alert[];
587
+ unacknowledgedCount?: Numeric;
588
+ criticalCount?: Numeric;
589
+ };
590
+ }
591
+ type AlertSeverity = "info" | "warning" | "error" | "critical";
246
592
  type AlertStatus = "active" | "acknowledged" | "resolved";
247
- type AlertMetric = "error_rate" | "latency" | "request_count" | "uptime";
248
- type AlertCondition = "greater_than" | "less_than" | "equals";
593
+ type AlertRuleType = "high_error_rate" | "high_latency" | "rate_limit_exceeded" | "quota_warning" | "service_down" | "key_expiring" | "unusual_traffic";
594
+ type AlertChannelType = "email" | "webhook" | "slack";
249
595
  interface Alert {
250
596
  id: string;
251
- organizationId: string;
252
- ruleId: string;
253
- severity: AlertSeverity;
254
- status: AlertStatus;
255
- title: string;
256
- message: string;
257
- metadata?: Record<string, unknown>;
258
- acknowledgedAt?: string;
259
- resolvedAt?: string;
260
- createdAt: string;
597
+ ruleId?: string;
598
+ ruleName?: string;
599
+ type?: OpenString<AlertRuleType>;
600
+ severity?: OpenString<AlertSeverity>;
601
+ status?: OpenString<AlertStatus>;
602
+ title?: string;
603
+ message?: string;
604
+ metadata?: Record<string, unknown> | null;
605
+ firedAt?: string;
606
+ acknowledgedAt?: string | null;
607
+ resolvedAt?: string | null;
608
+ }
609
+ /**
610
+ * What `GET .../alerts` answers. `alerts.list` returns only the `alerts`
611
+ * array of it; the counters are available through `alerts.overview`.
612
+ */
613
+ interface AlertsOverview {
614
+ alerts: Alert[];
615
+ total?: number;
616
+ activeCount?: number;
617
+ acknowledgedCount?: number;
618
+ criticalCount?: number;
619
+ rules?: AlertRule[];
620
+ channels?: AlertChannel[];
261
621
  }
262
622
  interface AlertRule {
263
623
  id: string;
264
- organizationId: string;
265
- name: string;
266
- description?: string;
267
- metric: AlertMetric;
268
- condition: AlertCondition;
269
- threshold: number;
270
- severity: AlertSeverity;
271
- isEnabled: boolean;
272
- cooldownMinutes: number;
273
- createdAt: string;
274
- updatedAt: string;
624
+ name?: string;
625
+ type?: OpenString<AlertRuleType>;
626
+ severity?: OpenString<AlertSeverity>;
627
+ isEnabled?: boolean;
628
+ /** Rule settings; the keys depend on `type`, e.g. `{ threshold: 5 }`. */
629
+ config?: Record<string, unknown>;
630
+ cooldownSeconds?: number;
631
+ createdAt?: string;
632
+ updatedAt?: string;
275
633
  }
276
634
  interface CreateAlertRuleRequest {
277
635
  name: string;
278
- description?: string;
279
- metric: AlertMetric;
280
- condition: AlertCondition;
281
- threshold: number;
282
- severity: AlertSeverity;
283
- cooldownMinutes?: number;
636
+ type: AlertRuleType;
637
+ config: Record<string, unknown>;
638
+ severity?: AlertSeverity;
639
+ /** At least 60. */
640
+ cooldownSeconds?: number;
641
+ isEnabled?: boolean;
642
+ }
643
+ /** Update body: `type` cannot be changed. */
644
+ interface UpdateAlertRuleRequest {
645
+ name?: string;
646
+ config?: Record<string, unknown>;
647
+ severity?: AlertSeverity;
648
+ cooldownSeconds?: number;
649
+ isEnabled?: boolean;
284
650
  }
285
651
  interface AlertChannel {
286
652
  id: string;
287
- organizationId: string;
288
- type: "email" | "webhook" | "slack";
289
- name: string;
290
- config: Record<string, unknown>;
291
- isEnabled: boolean;
292
- createdAt: string;
653
+ name?: string;
654
+ type?: OpenString<AlertChannelType>;
655
+ isEnabled?: boolean;
656
+ /** email: `{ recipients }`, webhook: `{ url, secret? }`, slack: `{ webhookUrl }`. */
657
+ config?: Record<string, unknown>;
658
+ createdAt?: string;
659
+ updatedAt?: string;
293
660
  }
294
661
  interface CreateAlertChannelRequest {
295
- type: "email" | "webhook" | "slack";
296
662
  name: string;
663
+ type: AlertChannelType;
297
664
  config: Record<string, unknown>;
665
+ isEnabled?: boolean;
666
+ }
667
+ /** Update body: `type` cannot be changed. */
668
+ interface UpdateAlertChannelRequest {
669
+ name?: string;
670
+ config?: Record<string, unknown>;
671
+ isEnabled?: boolean;
672
+ }
673
+ interface TestChannelResult {
674
+ success?: boolean;
675
+ message?: string;
298
676
  }
299
677
  type LogStatus = "success" | "error" | "timeout" | "throttled";
300
678
  interface RequestLog {
301
679
  id: string;
302
- organizationId: string;
303
- apiKeyId?: string;
304
- apiKeyPrefix?: string;
305
- method: string;
680
+ method?: string;
306
681
  path?: string;
307
682
  network?: string;
308
- region?: string;
309
- status: LogStatus;
310
- statusCode?: number;
311
- latencyMs?: number;
312
- requestBody?: string;
313
- responseBody?: string;
314
- errorMessage?: string;
315
- ipAddress?: string;
316
- userAgent?: string;
317
- timestamp: string;
683
+ region?: string | null;
684
+ status?: OpenString<LogStatus>;
685
+ statusCode?: number | null;
686
+ latencyMs?: Numeric;
687
+ responseSize?: Numeric | null;
688
+ errorCode?: string | null;
689
+ errorMessage?: string | null;
690
+ apiKeyId?: string | null;
691
+ apiKeyPrefix?: string | null;
692
+ ipAddress?: string | null;
693
+ userAgent?: string | null;
694
+ requestBody?: unknown;
695
+ responseBody?: unknown;
696
+ timestamp?: string;
697
+ }
698
+ interface LogStats {
699
+ totalRequests?: Numeric;
700
+ successCount?: Numeric;
701
+ errorCount?: Numeric;
702
+ timeoutCount?: Numeric;
703
+ throttledCount?: Numeric;
704
+ avgLatencyMs?: Numeric;
705
+ p50LatencyMs?: Numeric;
706
+ p95LatencyMs?: Numeric;
707
+ p99LatencyMs?: Numeric;
708
+ /** Percentage, 0-100. */
709
+ errorRate?: Numeric;
710
+ topMethods?: {
711
+ method?: string;
712
+ count?: Numeric;
713
+ }[];
714
+ topErrors?: {
715
+ errorCode?: string;
716
+ count?: Numeric;
717
+ message?: string;
718
+ }[];
719
+ statusBreakdown?: {
720
+ status?: string;
721
+ count?: Numeric;
722
+ }[];
318
723
  }
319
724
  interface LogsResponse {
320
725
  logs: RequestLog[];
321
- total: number;
322
- page: number;
323
- pageSize: number;
324
- totalPages: number;
726
+ total?: number;
727
+ stats?: LogStats;
325
728
  }
326
729
  interface LogFilterOptions {
327
- methods: string[];
328
- networks: string[];
329
- regions: string[];
330
- apiKeys: {
730
+ methods?: string[];
731
+ networks?: string[];
732
+ regions?: string[];
733
+ apiKeys?: {
331
734
  id: string;
332
- name: string;
333
- prefix: string;
735
+ name?: string;
736
+ prefix?: string;
334
737
  }[];
335
738
  }
336
739
  interface LogQueryParams {
337
- page?: number;
338
- pageSize?: number;
740
+ /** 1-200. */
741
+ limit?: number;
742
+ offset?: number;
339
743
  status?: LogStatus;
340
744
  method?: string;
745
+ apiKeyId?: string;
341
746
  network?: string;
342
747
  region?: string;
343
- apiKeyId?: string;
344
748
  search?: string;
749
+ statusCode?: number;
750
+ minLatencyMs?: number;
751
+ maxLatencyMs?: number;
752
+ /** ISO 8601 date. */
345
753
  from?: string;
754
+ /** ISO 8601 date. */
346
755
  to?: string;
347
- minLatency?: number;
348
- maxLatency?: number;
349
756
  sortBy?: "timestamp" | "latencyMs" | "statusCode";
350
757
  sortOrder?: "asc" | "desc";
351
758
  }
759
+ /** Options for `subscriptions.changePlan`. */
760
+ interface ChangePlanOptions {
761
+ /**
762
+ * The caller confirms the user accepted the plan-change billing terms.
763
+ * The server rejects the change (400) unless this is `true`.
764
+ */
765
+ acceptedTerms: boolean;
766
+ }
767
+ interface SubscriptionPlan {
768
+ id: string;
769
+ name?: string;
770
+ displayName?: string;
771
+ price?: Numeric;
772
+ priceMonthly?: Numeric;
773
+ priceAnnual?: Numeric | null;
774
+ limits?: PlanLimits;
775
+ features?: string[];
776
+ }
352
777
  interface Subscription {
353
778
  id: string;
354
- organizationId: string;
355
- planId: string;
356
- status: "active" | "cancelled" | "past_due" | "trialing";
357
- currentPeriodStart: string;
358
- currentPeriodEnd: string;
359
- cancelAtPeriodEnd: boolean;
360
- plan: Plan;
779
+ plan?: SubscriptionPlan;
780
+ status?: OpenString<"active" | "cancelled" | "past_due" | "trialing">;
781
+ billingInterval?: string;
782
+ currentPeriodStart?: string;
783
+ currentPeriodEnd?: string;
784
+ usagePeriod?: {
785
+ start?: string;
786
+ end?: string;
787
+ };
788
+ cancelAtPeriodEnd?: boolean;
789
+ trialStart?: string | null;
790
+ trialEnd?: string | null;
791
+ recentInvoices?: Invoice[];
792
+ }
793
+ /** Answer of `subscriptions.changePlan`. */
794
+ interface ChangePlanResult {
795
+ message?: string;
796
+ subscription?: {
797
+ id: string;
798
+ plan?: {
799
+ id: string;
800
+ name?: string;
801
+ displayName?: string;
802
+ price?: Numeric;
803
+ };
804
+ billingInterval?: string;
805
+ status?: string;
806
+ };
807
+ }
808
+ /** Answer of `subscriptions.cancel`. */
809
+ interface CancelSubscriptionResult {
810
+ message?: string;
811
+ cancelAt?: string;
812
+ accessEndsAt?: string;
813
+ pendingOverageEstimate?: Numeric;
814
+ currency?: string;
361
815
  }
362
816
  interface Plan {
363
817
  id: string;
364
- name: string;
365
- slug: string;
366
- price: number;
367
- currency: string;
368
- interval: "month" | "year";
369
- features: Record<string, unknown>;
370
- limits: PlanLimits;
371
- isActive: boolean;
818
+ name?: string;
819
+ tier?: string;
820
+ displayName?: string;
821
+ description?: string;
822
+ priceMonthly?: Numeric;
823
+ priceAnnual?: Numeric | null;
824
+ stripePriceId?: string | null;
825
+ stripePriceIdAnnual?: string | null;
826
+ paddlePriceId?: string | null;
827
+ paddlePriceIdAnnual?: string | null;
828
+ contactSalesOnly?: boolean;
829
+ limits?: PlanLimits;
830
+ features?: string[];
831
+ isActive?: boolean;
832
+ annualAvailable?: boolean;
833
+ createdAt?: string;
834
+ updatedAt?: string;
372
835
  }
373
836
  interface PlanLimits {
374
- requestsPerMonth: number;
375
- requestsPerSecond: number;
376
- apiKeys: number;
377
- endpoints: number;
378
- teamMembers: number;
379
- logRetentionDays: number;
380
- }
837
+ rps?: Numeric;
838
+ burst?: Numeric;
839
+ concurrency?: Numeric;
840
+ monthlyRequests?: Numeric;
841
+ overageEnabled?: boolean;
842
+ overageRatePer1k?: Numeric;
843
+ overageCapUsd?: Numeric;
844
+ overageRequestsAllowed?: Numeric;
845
+ dedicated?: boolean;
846
+ /**
847
+ * Limits sold as something other than a plain number, keyed by the API's
848
+ * limit name (`rps`, `concurrency`, `maxApiKeys`, `monthlyRequests`,
849
+ * `overageRatePer1k`, `overageCapUsd`). `"unlimited"`: not enforced per
850
+ * plan. `"custom"`: negotiated per contract. Such a limit carries no number.
851
+ * Absent on plans where every limit is a number.
852
+ */
853
+ limitModes?: Partial<Record<PlanLimitKey, PlanLimitMode>>;
854
+ /** Display text for those limits, e.g. "Quoted per contract". */
855
+ limitLabels?: Partial<Record<PlanLimitKey, string>>;
856
+ }
857
+ /** How a plan limit is sold. Absent from `limitModes` means a plain number. */
858
+ type PlanLimitMode = "unlimited" | "custom";
859
+ /** Limit names that may appear in `PlanLimits.limitModes`. */
860
+ type PlanLimitKey = "rps" | "concurrency" | "maxApiKeys" | "monthlyRequests" | "overageRatePer1k" | "overageCapUsd";
381
861
  interface Invoice {
382
862
  id: string;
383
- amount: number;
384
- currency: string;
385
- status: string;
386
- periodStart: string;
387
- periodEnd: string;
388
- paidAt?: string;
389
- createdAt: string;
863
+ amount?: Numeric;
864
+ currency?: string;
865
+ status?: string;
866
+ periodStart?: string;
867
+ periodEnd?: string;
868
+ paidAt?: string | null;
869
+ createdAt?: string;
390
870
  }
391
871
  type TicketPriority = "low" | "medium" | "high" | "urgent";
392
- type TicketStatus = "open" | "in_progress" | "waiting" | "resolved" | "closed";
393
- type TicketCategory = "billing" | "technical" | "account" | "feature_request" | "other";
872
+ type TicketStatus = "open" | "in_progress" | "waiting_on_customer" | "resolved" | "closed";
873
+ type TicketCategory = "general" | "billing" | "technical" | "api_keys" | "endpoints" | "performance" | "security" | "feature_request" | "bug_report";
874
+ interface TicketAuthor {
875
+ id: string;
876
+ email?: string;
877
+ }
878
+ interface TicketMessage {
879
+ id: string;
880
+ ticketId?: string;
881
+ authorId?: string;
882
+ body?: string;
883
+ isStaff?: boolean;
884
+ createdAt?: string;
885
+ author?: TicketAuthor;
886
+ }
394
887
  interface SupportTicket {
395
888
  id: string;
396
- organizationId: string;
397
- subject: string;
398
- category: TicketCategory;
399
- priority: TicketPriority;
400
- status: TicketStatus;
401
- createdAt: string;
402
- updatedAt: string;
889
+ organizationId?: string;
890
+ createdById?: string;
891
+ assignedToId?: string | null;
892
+ subject?: string;
893
+ category?: OpenString<TicketCategory>;
894
+ priority?: OpenString<TicketPriority>;
895
+ status?: OpenString<TicketStatus>;
896
+ closedAt?: string | null;
897
+ createdAt?: string;
898
+ updatedAt?: string;
899
+ createdBy?: TicketAuthor;
900
+ /** On create and get only. */
901
+ messages?: TicketMessage[];
902
+ /** On list and status update only. */
903
+ _count?: {
904
+ messages?: number;
905
+ };
403
906
  }
404
907
  interface CreateTicketRequest {
908
+ /** 5-200 characters. */
405
909
  subject: string;
406
- message: string;
407
- category: TicketCategory;
408
- priority: TicketPriority;
409
- }
410
- interface TicketMessage {
411
- id: string;
412
- ticketId: string;
413
- content: string;
414
- isStaff: boolean;
415
- createdAt: string;
910
+ /** The first message, 10-5000 characters. */
911
+ body: string;
912
+ category?: TicketCategory;
913
+ priority?: TicketPriority;
914
+ }
915
+ interface TicketStats {
916
+ open?: number;
917
+ inProgress?: number;
918
+ waitingOnCustomer?: number;
919
+ resolved?: number;
920
+ closed?: number;
921
+ total?: number;
922
+ }
923
+ /** What `GET .../support/tickets` answers; `support.listTickets` returns only `tickets`. */
924
+ interface TicketList {
925
+ tickets: SupportTicket[];
926
+ total?: number;
416
927
  }
417
928
  interface IteradianConfig {
418
929
  /** Base URL of the Iteradian control-plane API (default: https://api.iteradian.com/api/v1) */
@@ -482,6 +993,8 @@ declare class IteradianError extends Error {
482
993
  * -32005 rate limit or concurrency limit exceeded (retry shortly)
483
994
  * -32006 monthly quota exhausted (retrying will not help until `resetsAt`)
484
995
  * -32007 overage spend limit reached (same — needs a plan change)
996
+ * -32008 per-API-key daily limit reached (no retry until `data.resetsAt`,
997
+ * the next 00:00 UTC)
485
998
  */
486
999
  readonly rpcCode?: number;
487
1000
  /** Seconds to wait before retrying, when the gateway supplied one. */
@@ -493,8 +1006,18 @@ declare class IteradianError extends Error {
493
1006
  retryAfter?: number;
494
1007
  data?: Record<string, unknown>;
495
1008
  });
496
- /** True when the request failed because the subscription is out of allowance. */
1009
+ /**
1010
+ * True when the request failed because an allowance is used up and retrying
1011
+ * will not help until it resets: the subscription quota (-32006), the
1012
+ * overage spend cap (-32007) or the API key's daily limit (-32008).
1013
+ */
497
1014
  get isQuotaExhausted(): boolean;
1015
+ /**
1016
+ * True when the API key's own daily limit is reached (-32008). `data` then
1017
+ * carries `{ dailyLimit, used, cost, resetsAt }`; `resetsAt` is the next
1018
+ * 00:00 UTC.
1019
+ */
1020
+ get isDailyLimitReached(): boolean;
498
1021
  /** True when the request was throttled and is worth retrying. */
499
1022
  get isRateLimited(): boolean;
500
1023
  }
@@ -530,38 +1053,52 @@ declare class HttpClient {
530
1053
  declare class AuthResource {
531
1054
  private http;
532
1055
  constructor(http: HttpClient);
533
- /** Register a new user account */
534
- register(data: RegisterRequest): Promise<AuthTokens>;
535
- /** Login with email/password (optionally with 2FA code) */
536
- login(data: LoginRequest): Promise<AuthTokens>;
1056
+ /**
1057
+ * Register a new user account. Does not sign in: the API answers
1058
+ * `{ message, email }` (the same for an address that already has an
1059
+ * account) and emails a confirmation link. Call `login()` once the address
1060
+ * is confirmed.
1061
+ *
1062
+ * The server rejects registration (400) unless the user agreed to the
1063
+ * Terms of Service, Privacy Policy and DPA, so `data.acceptedTerms` is
1064
+ * required and always sent. Pass `acceptedTerms: true` only after the user
1065
+ * has ticked the agreement.
1066
+ */
1067
+ register(data: RegisterRequest): Promise<RegisterResponse>;
1068
+ /**
1069
+ * Login with email/password (optionally with a 2FA code or a backup code).
1070
+ *
1071
+ * When two-factor auth is on and no code was sent, the API answers
1072
+ * `{ requires2FA: true }` with no tokens. Check `requires2FA` and call
1073
+ * again with `twoFactorCode` or `backupCode`. The stored access token is
1074
+ * only replaced when the answer carries one.
1075
+ */
1076
+ login(data: LoginRequest): Promise<LoginResult>;
1077
+ private storeToken;
537
1078
  /** Logout current session */
538
1079
  logout(): Promise<void>;
539
1080
  /** Refresh the access token */
540
1081
  refresh(refreshToken: string): Promise<AuthTokens>;
541
1082
  /** Verify email with token */
542
- verifyEmail(token: string): Promise<void>;
1083
+ verifyEmail(token: string): Promise<MessageResponse>;
543
1084
  /** Resend email verification */
544
- resendVerification(email: string): Promise<void>;
1085
+ resendVerification(email: string): Promise<MessageResponse>;
545
1086
  /** Request password reset email */
546
- forgotPassword(email: string): Promise<void>;
1087
+ forgotPassword(email: string): Promise<MessageResponse>;
547
1088
  /** Reset password with token */
548
- resetPassword(token: string, newPassword: string): Promise<void>;
1089
+ resetPassword(token: string, newPassword: string): Promise<MessageResponse>;
549
1090
  /** Request a magic login link */
550
- requestMagicLink(email: string): Promise<void>;
1091
+ requestMagicLink(email: string): Promise<MessageResponse>;
551
1092
  /** Login via magic link token */
552
- loginWithMagicLink(token: string): Promise<AuthTokens>;
1093
+ loginWithMagicLink(token: string): Promise<LoginResult>;
553
1094
  /** Enable 2FA – returns QR code image and secret */
554
1095
  enable2FA(password: string): Promise<TwoFASetup>;
555
1096
  /** Verify 2FA setup with code from authenticator app */
556
- verify2FA(code: string): Promise<{
557
- backupCodes: string[];
558
- }>;
1097
+ verify2FA(code: string): Promise<BackupCodes>;
559
1098
  /** Disable 2FA */
560
- disable2FA(password: string, code: string): Promise<void>;
1099
+ disable2FA(password: string, code: string): Promise<MessageResponse>;
561
1100
  /** Regenerate backup codes */
562
- regenerateBackupCodes(password: string): Promise<{
563
- backupCodes: string[];
564
- }>;
1101
+ regenerateBackupCodes(password: string): Promise<BackupCodes>;
565
1102
  }
566
1103
 
567
1104
  declare class OrganizationsResource {
@@ -569,33 +1106,53 @@ declare class OrganizationsResource {
569
1106
  constructor(http: HttpClient);
570
1107
  /** List organizations the current user belongs to */
571
1108
  list(): Promise<Organization[]>;
572
- /** Create a new organization */
573
- create(data: {
574
- name: string;
575
- slug?: string;
576
- }): Promise<Organization>;
1109
+ /**
1110
+ * Create a new organization. `name`, `planId` and `acceptedTerms` are
1111
+ * required by the API; pass `acceptedTerms: true` only after the user
1112
+ * agreed to the terms.
1113
+ */
1114
+ create(data: CreateOrganizationRequest): Promise<Organization>;
577
1115
  /** Get organization details */
578
1116
  get(orgId: string): Promise<Organization>;
579
1117
  /** Update an organization */
580
- update(orgId: string, data: {
581
- name?: string;
582
- slug?: string;
583
- }): Promise<Organization>;
1118
+ update(orgId: string, data: UpdateOrganizationRequest): Promise<Organization>;
584
1119
  /** Delete an organization */
585
- delete(orgId: string): Promise<void>;
1120
+ delete(orgId: string): Promise<MessageResponse | void>;
586
1121
  /** Leave an organization */
587
- leave(orgId: string): Promise<void>;
1122
+ leave(orgId: string): Promise<MessageResponse | void>;
588
1123
  /** List organization members */
589
1124
  listMembers(orgId: string): Promise<OrgMember[]>;
590
- /** Invite a member to the organization */
1125
+ /**
1126
+ * Invite someone to the organization by email. Creates (or refreshes) a
1127
+ * pending invitation — nobody becomes a member until the invitee accepts
1128
+ * it while signed in with a verified address.
1129
+ */
591
1130
  inviteMember(orgId: string, data: {
592
1131
  email: string;
593
- role: string;
594
- }): Promise<OrgMember>;
1132
+ role: OrgRole;
1133
+ }): Promise<OrgInvite>;
1134
+ /** Open invitations of the organization (owner/admin) */
1135
+ listInvites(orgId: string): Promise<OrgInvite[]>;
1136
+ /** Revoke an open invitation (owner/admin) */
1137
+ revokeInvite(orgId: string, inviteId: string): Promise<MessageResponse>;
1138
+ /** Invitations addressed to the signed-in user */
1139
+ listMyInvites(): Promise<MyInvites>;
1140
+ /**
1141
+ * Accept an invitation addressed to the signed-in user.
1142
+ *
1143
+ * If the user has not accepted the current terms version yet, the API
1144
+ * answers 403 (`TERMS_ACCEPTANCE_REQUIRED`) unless
1145
+ * `{ acceptedTerms: true }` is passed — only after the user agreed to the
1146
+ * Terms of Service, Privacy Policy and DPA. `acceptedTerms` is sent only
1147
+ * when given.
1148
+ */
1149
+ acceptInvite(inviteId: string, options?: AcceptInviteOptions): Promise<InviteAcceptance>;
1150
+ /** Decline an invitation addressed to the signed-in user */
1151
+ declineInvite(inviteId: string): Promise<MessageResponse>;
595
1152
  /** Update a member's role */
596
- updateMemberRole(orgId: string, memberId: string, role: string): Promise<OrgMember>;
1153
+ updateMemberRole(orgId: string, memberId: string, role: OrgRole): Promise<OrgMember>;
597
1154
  /** Remove a member from the organization */
598
- removeMember(orgId: string, memberId: string): Promise<void>;
1155
+ removeMember(orgId: string, memberId: string): Promise<MessageResponse | void>;
599
1156
  /** Get current user's permissions in the organization */
600
1157
  getMyPermissions(orgId: string): Promise<UserPermissions>;
601
1158
  }
@@ -607,13 +1164,19 @@ declare class ApiKeysResource {
607
1164
  list(orgId: string): Promise<ApiKey[]>;
608
1165
  /** Get a specific API key */
609
1166
  get(orgId: string, keyId: string): Promise<ApiKey>;
610
- /** Create a new API key (returns the full key only once) */
1167
+ /**
1168
+ * Create a new API key. The full key comes back once, in `secret`
1169
+ * (`key` is a deprecated alias with the same value).
1170
+ */
611
1171
  create(orgId: string, data: CreateApiKeyRequest): Promise<ApiKeyWithSecret>;
612
1172
  /** Update an API key */
613
1173
  update(orgId: string, keyId: string, data: UpdateApiKeyRequest): Promise<ApiKey>;
614
1174
  /** Revoke (delete) an API key */
615
- revoke(orgId: string, keyId: string): Promise<void>;
616
- /** Rotate an API key (revoke old, create new) */
1175
+ revoke(orgId: string, keyId: string): Promise<MessageResponse>;
1176
+ /**
1177
+ * Rotate an API key (revoke old, create new). The new full key is in
1178
+ * `secret`; `key` is a deprecated alias.
1179
+ */
617
1180
  rotate(orgId: string, keyId: string): Promise<ApiKeyWithSecret>;
618
1181
  /** Get analytics for an API key */
619
1182
  getAnalytics(orgId: string, keyId: string, timeRange?: "1d" | "7d" | "30d" | "90d"): Promise<ApiKeyAnalytics>;
@@ -635,32 +1198,34 @@ declare class EndpointsResource {
635
1198
  /** Update an endpoint */
636
1199
  update(orgId: string, endpointId: string, data: UpdateEndpointRequest): Promise<Endpoint>;
637
1200
  /** Delete an endpoint */
638
- delete(orgId: string, endpointId: string): Promise<void>;
1201
+ delete(orgId: string, endpointId: string): Promise<MessageResponse>;
639
1202
  /** Pause an endpoint */
640
1203
  pause(orgId: string, endpointId: string): Promise<Endpoint>;
641
1204
  /** Resume an endpoint */
642
1205
  resume(orgId: string, endpointId: string): Promise<Endpoint>;
643
- /** Trigger a health check */
644
- checkHealth(orgId: string, endpointId: string): Promise<{
645
- status: EndpointStatus;
646
- latencyMs?: number;
647
- }>;
1206
+ /** Trigger a health check (POST .../health-check) */
1207
+ checkHealth(orgId: string, endpointId: string): Promise<EndpointHealthCheck>;
1208
+ /** Get the current health of an endpoint (GET .../health) */
1209
+ getHealth(orgId: string, endpointId: string): Promise<EndpointHealth>;
648
1210
  /** Get endpoint health summary */
649
- getHealthOverview(orgId: string): Promise<unknown>;
1211
+ getHealthOverview(orgId: string): Promise<EndpointSummary>;
650
1212
  /** Get endpoint metrics */
651
1213
  getMetrics(orgId: string, endpointId: string, from?: string, to?: string): Promise<EndpointMetric[]>;
652
1214
  /** Update endpoint priorities */
653
1215
  updatePriorities(orgId: string, priorities: {
654
1216
  id: string;
655
1217
  priority: number;
656
- }[]): Promise<void>;
1218
+ }[]): Promise<MessageResponse>;
657
1219
  }
658
1220
 
659
1221
  declare class UsageResource {
660
1222
  private http;
661
1223
  constructor(http: HttpClient);
662
- /** Get usage analytics for a date range */
663
- get(orgId: string, from: string, to: string): Promise<UsageSummary>;
1224
+ /**
1225
+ * Get usage rows (one per key per day) for a date range. `from` and `to`
1226
+ * are ISO dates, e.g. `2026-01-31`.
1227
+ */
1228
+ get(orgId: string, from: string, to: string): Promise<UsageRow[]>;
664
1229
  /** Get usage summary */
665
1230
  getSummary(orgId: string): Promise<UsageSummary>;
666
1231
  }
@@ -669,32 +1234,38 @@ declare class DashboardResource {
669
1234
  private http;
670
1235
  constructor(http: HttpClient);
671
1236
  /** Get full dashboard data */
672
- get(orgId: string, period?: string): Promise<DashboardData>;
1237
+ get(orgId: string, timeRange?: DashboardTimeRange, custom?: CustomRange): Promise<DashboardData>;
673
1238
  /** Get system health overview */
674
1239
  getHealth(orgId: string): Promise<HealthStatus>;
675
1240
  /** Get quick stats */
676
- getQuickStats(orgId: string, period?: string): Promise<QuickStats>;
1241
+ getQuickStats(orgId: string, timeRange?: DashboardTimeRange, custom?: CustomRange): Promise<QuickStats>;
677
1242
  /** Get request rate time series */
678
- getRequestRate(orgId: string, period?: string): Promise<DataPoint[]>;
1243
+ getRequestRate(orgId: string, timeRange?: DashboardTimeRange, custom?: CustomRange): Promise<RequestRate>;
679
1244
  /** Get error rate time series */
680
- getErrorRate(orgId: string, period?: string): Promise<DataPoint[]>;
1245
+ getErrorRate(orgId: string, timeRange?: DashboardTimeRange, custom?: CustomRange): Promise<ErrorRate>;
681
1246
  /** Get latency metrics */
682
- getLatency(orgId: string, period?: string): Promise<DataPoint[]>;
1247
+ getLatency(orgId: string, timeRange?: DashboardTimeRange, custom?: CustomRange): Promise<LatencyStats>;
683
1248
  /** Get performance metrics */
684
- getPerformance(orgId: string): Promise<unknown>;
1249
+ getPerformance(orgId: string): Promise<PerformanceStats>;
685
1250
  }
686
1251
 
687
1252
  declare class AlertsResource {
688
1253
  private http;
689
1254
  constructor(http: HttpClient);
690
- /** List alerts for an organization */
1255
+ /**
1256
+ * List alerts for an organization. The API answers an overview object
1257
+ * (`alerts`, counters, rules, channels); this returns just the alerts.
1258
+ * Use `overview()` for the rest.
1259
+ */
691
1260
  list(orgId: string): Promise<Alert[]>;
1261
+ /** The full alerts overview: alerts, counters, rules and channels. */
1262
+ overview(orgId: string): Promise<AlertsOverview>;
692
1263
  /** Acknowledge an alert */
693
1264
  acknowledge(orgId: string, alertId: string): Promise<Alert>;
694
1265
  /** Resolve an alert */
695
1266
  resolve(orgId: string, alertId: string): Promise<Alert>;
696
1267
  /** Evaluate all alert rules now */
697
- evaluate(orgId: string): Promise<void>;
1268
+ evaluate(orgId: string): Promise<MessageResponse>;
698
1269
  /** List alert rules */
699
1270
  listRules(orgId: string): Promise<AlertRule[]>;
700
1271
  /** Create a new alert rule */
@@ -702,13 +1273,13 @@ declare class AlertsResource {
702
1273
  /** Get a specific alert rule */
703
1274
  getRule(orgId: string, ruleId: string): Promise<AlertRule>;
704
1275
  /** Update an alert rule */
705
- updateRule(orgId: string, ruleId: string, data: Partial<CreateAlertRuleRequest>): Promise<AlertRule>;
1276
+ updateRule(orgId: string, ruleId: string, data: UpdateAlertRuleRequest): Promise<AlertRule>;
706
1277
  /** Delete an alert rule */
707
1278
  deleteRule(orgId: string, ruleId: string): Promise<void>;
708
1279
  /** Toggle an alert rule on/off */
709
1280
  toggleRule(orgId: string, ruleId: string): Promise<AlertRule>;
710
1281
  /** Seed default alert rules */
711
- seedDefaults(orgId: string): Promise<AlertRule[]>;
1282
+ seedDefaults(orgId: string): Promise<MessageResponse>;
712
1283
  /** List notification channels */
713
1284
  listChannels(orgId: string): Promise<AlertChannel[]>;
714
1285
  /** Create a notification channel */
@@ -716,22 +1287,22 @@ declare class AlertsResource {
716
1287
  /** Get a specific channel */
717
1288
  getChannel(orgId: string, channelId: string): Promise<AlertChannel>;
718
1289
  /** Update a notification channel */
719
- updateChannel(orgId: string, channelId: string, data: Partial<CreateAlertChannelRequest>): Promise<AlertChannel>;
1290
+ updateChannel(orgId: string, channelId: string, data: UpdateAlertChannelRequest): Promise<AlertChannel>;
720
1291
  /** Delete a notification channel */
721
1292
  deleteChannel(orgId: string, channelId: string): Promise<void>;
722
1293
  /** Test a notification channel */
723
- testChannel(orgId: string, channelId: string): Promise<void>;
1294
+ testChannel(orgId: string, channelId: string): Promise<TestChannelResult>;
724
1295
  }
725
1296
 
726
1297
  declare class LogsResource {
727
1298
  private http;
728
1299
  constructor(http: HttpClient);
729
- /** Query request logs with filters and pagination */
1300
+ /** Query request logs with filters (`limit` / `offset` paginate) */
730
1301
  query(orgId: string, params?: LogQueryParams): Promise<LogsResponse>;
731
1302
  /** Get a single log entry */
732
1303
  get(orgId: string, logId: string): Promise<RequestLog>;
733
1304
  /** Get log statistics */
734
- getStats(orgId: string): Promise<unknown>;
1305
+ getStats(orgId: string): Promise<LogStats>;
735
1306
  /** Get available filter options */
736
1307
  getFilterOptions(orgId: string): Promise<LogFilterOptions>;
737
1308
  }
@@ -741,12 +1312,19 @@ declare class SubscriptionsResource {
741
1312
  constructor(http: HttpClient);
742
1313
  /** Get current subscription */
743
1314
  get(orgId: string): Promise<Subscription>;
744
- /** Change subscription plan */
745
- changePlan(orgId: string, planId: string): Promise<Subscription>;
1315
+ /**
1316
+ * Change subscription plan.
1317
+ *
1318
+ * The server rejects a plan change unless the caller confirms the
1319
+ * plan-change billing terms, so `options.acceptedTerms` is required and
1320
+ * always sent. Pass `{ acceptedTerms: true }` only after the user has
1321
+ * accepted the terms.
1322
+ */
1323
+ changePlan(orgId: string, planId: string, options: ChangePlanOptions): Promise<ChangePlanResult>;
746
1324
  /** Cancel subscription */
747
- cancel(orgId: string): Promise<Subscription>;
1325
+ cancel(orgId: string): Promise<CancelSubscriptionResult>;
748
1326
  /** Reactivate a cancelled subscription */
749
- reactivate(orgId: string): Promise<Subscription>;
1327
+ reactivate(orgId: string): Promise<MessageResponse>;
750
1328
  /** Get invoices */
751
1329
  getInvoices(orgId: string, limit?: number): Promise<Invoice[]>;
752
1330
  }
@@ -765,16 +1343,21 @@ declare class SupportResource {
765
1343
  constructor(http: HttpClient);
766
1344
  /** Create a support ticket */
767
1345
  createTicket(orgId: string, data: CreateTicketRequest): Promise<SupportTicket>;
768
- /** List support tickets */
1346
+ /**
1347
+ * List support tickets. The API answers `{ tickets, total }`; this
1348
+ * returns the tickets. Use `listTicketsWithTotal()` for the total.
1349
+ */
769
1350
  listTickets(orgId: string): Promise<SupportTicket[]>;
1351
+ /** List support tickets with the total count. */
1352
+ listTicketsWithTotal(orgId: string): Promise<TicketList>;
770
1353
  /** Get ticket statistics */
771
- getStats(orgId: string): Promise<unknown>;
1354
+ getStats(orgId: string): Promise<TicketStats>;
772
1355
  /** Get a specific ticket */
773
1356
  getTicket(orgId: string, ticketId: string): Promise<SupportTicket>;
774
1357
  /** Add a message to a ticket */
775
1358
  addMessage(orgId: string, ticketId: string, content: string): Promise<TicketMessage>;
776
1359
  /** Update ticket status */
777
- updateStatus(orgId: string, ticketId: string, status: string): Promise<SupportTicket>;
1360
+ updateStatus(orgId: string, ticketId: string, status: TicketStatus): Promise<SupportTicket>;
778
1361
  }
779
1362
 
780
1363
  declare class RpcResource {
@@ -837,7 +1420,7 @@ declare class RpcResource {
837
1420
  *
838
1421
  * @example
839
1422
  * ```typescript
840
- * import { IteradianClient } from '@iteradian/sdk';
1423
+ * import { IteradianClient } from '@iteradian-rpc/sdk';
841
1424
  *
842
1425
  * const client = new IteradianClient({
843
1426
  * baseUrl: 'https://api.iteradian.com/api/v1',
@@ -890,4 +1473,5 @@ declare class IteradianClient {
890
1473
  clearAccessToken(): void;
891
1474
  }
892
1475
 
893
- export { type Alert, type AlertChannel, type AlertCondition, type AlertMetric, type AlertRule, type AlertSeverity, type AlertStatus, AlertsResource, type ApiError, type ApiKey, type ApiKeyAnalytics, type ApiKeyWithSecret, ApiKeysResource, type ApiResponse, AuthResource, type AuthTokens, type CreateAlertChannelRequest, type CreateAlertRuleRequest, type CreateApiKeyRequest, type CreateEndpointRequest, type CreateTicketRequest, type DailyUsage, type DashboardData, DashboardResource, type DataPoint, type Endpoint, type EndpointMetric, type EndpointRegion, type EndpointStatus, EndpointsResource, type HealthStatus, type Invoice, IteradianClient, type IteradianConfig, IteradianError, type JsonRpcError, type JsonRpcRequest, type JsonRpcResponse, type LogFilterOptions, type LogQueryParams, type LogStatus, type LoginRequest, LogsResource, type LogsResponse, type Membership, type Network, type NetworkType, type OrgMember, type OrgRole, type Organization, OrganizationsResource, type PaginatedResponse, type Plan, type PlanLimits, PlansResource, type QuickStats, type RegisterRequest, type RequestLog, RpcResource, type Subscription, SubscriptionsResource, SupportResource, type SupportTicket, type TicketCategory, type TicketMessage, type TicketPriority, type TicketStatus, type TwoFASetup, type UpdateApiKeyRequest, type UpdateEndpointRequest, type UsageByMethod, type UsageByNetwork, type UsageByRegion, UsageResource, type UsageSummary, type User, type UserPermissions };
1476
+ export { AlertsResource, ApiKeysResource, AuthResource, DashboardResource, EndpointsResource, IteradianClient, IteradianError, LogsResource, OrganizationsResource, PlansResource, RpcResource, SubscriptionsResource, SupportResource, UsageResource };
1477
+ export type { AcceptInviteOptions, Alert, AlertChannel, AlertChannelType, AlertRule, AlertRuleType, AlertSeverity, AlertStatus, AlertsOverview, ApiError, ApiKey, ApiKeyAnalytics, ApiKeyWithSecret, ApiResponse, AuthTokens, AuthUser, BackupCodes, BillingInterval, CancelSubscriptionResult, ChangePlanOptions, ChangePlanResult, CreateAlertChannelRequest, CreateAlertRuleRequest, CreateApiKeyRequest, CreateEndpointRequest, CreateOrganizationRequest, CreateTicketRequest, CustomRange, DailyUsage, DashboardData, DashboardTimeRange, DataPoint, Endpoint, EndpointHealth, EndpointHealthCheck, EndpointHealthEntry, EndpointMetric, EndpointRegion, EndpointStatus, EndpointSummary, ErrorRate, HealthStatus, InviteAcceptance, Invoice, IteradianConfig, JsonRpcError, JsonRpcRequest, JsonRpcResponse, LatencyStats, LogFilterOptions, LogQueryParams, LogStats, LogStatus, LoginRequest, LoginResult, LogsResponse, Membership, MessageResponse, MyInvite, MyInvites, Network, NetworkType, Numeric, OpenString, OrgInvite, OrgMember, OrgPlanSummary, OrgRole, OrgSubscriptionSummary, Organization, PaginatedResponse, PerformanceStats, Plan, PlanLimitKey, PlanLimitMode, PlanLimits, QuickStats, QuotaForecast, RegisterRequest, RegisterResponse, RequestLog, RequestRate, ServiceStatus, Subscription, SubscriptionPlan, SupportTicket, TestChannelResult, TicketAuthor, TicketCategory, TicketList, TicketMessage, TicketPriority, TicketStats, TicketStatus, TwoFASetup, UpdateAlertChannelRequest, UpdateAlertRuleRequest, UpdateApiKeyRequest, UpdateEndpointRequest, UpdateOrganizationRequest, UsageByKey, UsageByMethod, UsageByNetwork, UsageByRegion, UsageRow, UsageSummary, User, UserPermissions };