@valiron/sdk 0.12.0 → 1.0.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.
@@ -2,11 +2,16 @@
2
2
 
3
3
  Base URL: `https://valiron-edge-proxy.onrender.com`
4
4
 
5
- All endpoints are under the `/operator/` path prefix.
5
+ Endpoints are organized into two groups:
6
+
7
+ - **Trust evaluation** (`/operator/agent/*`, `/operator/gate/*`, etc.) — No authentication required. Used by the SDK to evaluate agents.
8
+ - **Dashboard** (`/operator/register`, `/operator/login`, `/operator/endpoints`, etc.) — JWT-authenticated. Used by the Operator Dashboard. See [DASHBOARD.md](./DASHBOARD.md) for the UI guide.
6
9
 
7
10
  ---
8
11
 
9
- ## GET /operator/agent/:agentId
12
+ ## Trust Evaluation Endpoints
13
+
14
+ ### GET /operator/agent/:agentId
10
15
 
11
16
  Retrieve the complete trust profile for an agent.
12
17
 
@@ -126,13 +131,7 @@ Execute real-time sandbox tests against an agent and compute a trust evaluation.
126
131
  "tier": "AAA",
127
132
  "riskLevel": "GREEN",
128
133
  "meetsThreshold": true,
129
- "testSummary": {
130
- "totalRequests": 25,
131
- "successCount": 18,
132
- "rateLimitCount": 5,
133
- "errorCount": 2,
134
- "avgLatencyMs": 120
135
- },
134
+ "testSummary": {},
136
135
  "chain": {
137
136
  "name": "ethereum",
138
137
  "chainId": 1
@@ -141,6 +140,8 @@ Execute real-time sandbox tests against an agent and compute a trust evaluation.
141
140
  }
142
141
  ```
143
142
 
143
+ > **Note:** The `testSummary` object contains opaque test metrics. Its internal structure is proprietary and may change without notice.
144
+
144
145
  ---
145
146
 
146
147
  ## POST /operator/gate/:agentId
@@ -268,6 +269,10 @@ When an evaluation completes, Valiron POSTs the following to your registered URL
268
269
  {
269
270
  "event": "evaluation_complete",
270
271
  "agentId": "25459",
272
+ "tier": "AAA",
273
+ "riskLevel": "GREEN",
274
+ "route": "prod",
275
+ "meetsThreshold": true,
271
276
  "snapshotHash": "0x3a7f2b...",
272
277
  "previousHash": "0x8b2c1a...",
273
278
  "encryptedDataUri": null,
@@ -276,276 +281,226 @@ When an evaluation completes, Valiron POSTs the following to your registered URL
276
281
  }
277
282
  ```
278
283
 
284
+ #### Webhook Payload Fields
285
+
286
+ | Field | Type | Description |
287
+ |-------|------|-------------|
288
+ | `event` | string | Always `"evaluation_complete"` |
289
+ | `agentId` | string | The evaluated agent ID |
290
+ | `tier` | string | Moody's-style trust tier (AAA–C) |
291
+ | `riskLevel` | string | GREEN / YELLOW / RED |
292
+ | `route` | string | Route decision (`prod`, `prod_throttled`, `sandbox`, `sandbox_only`) |
293
+ | `meetsThreshold` | boolean | Whether the agent passed the trust gate |
294
+ | `snapshotHash` | string | Deterministic hash of the behavioral evaluation |
295
+ | `previousHash` | string | Hash from the prior evaluation |
296
+ | `encryptedDataUri` | string\|null | IPFS CID of encrypted snapshot data |
297
+ | `timestamp` | string | ISO 8601 timestamp |
298
+ | `interactionCount` | number | Total interactions in the evaluation window |
299
+
300
+ #### Webhook Limitations
301
+
302
+ - **Maximum registrations:** 1,000 per operator
303
+ - **Delivery:** Fire-and-forget — no retries on failure
304
+ - **Timeout:** 10 seconds — your endpoint must respond within 10s
305
+ - **Signatures:** Webhooks are not signed — verify via IP allowlisting or shared secrets if needed
306
+ - **Events:** Only `evaluation_complete` is currently supported
307
+
279
308
  ---
280
309
 
281
- ## GET /operator/health
310
+ ## POST /operator/proxy/:agentId (Pro)
282
311
 
283
- Health check endpoint.
312
+ Forward a request through Valiron's edge proxy with automatic trust gating, logging, and SSRF protection.
284
313
 
285
- ### Response — 200 OK
314
+ ### Parameters
315
+
316
+ | Parameter | Location | Type | Required | Description |
317
+ |-----------|----------|------|----------|-------------|
318
+ | `agentId` | path | string | yes | Agent to gate |
319
+
320
+ ### Request Body
286
321
 
287
322
  ```json
288
323
  {
289
- "status": "ok",
290
- "supportedChains": ["ethereum", "monad", "arbitrum", "base", ...],
291
- "defaultChain": "ethereum"
324
+ "targetUrl": "https://your-api.com/data",
325
+ "method": "POST",
326
+ "headers": { "Content-Type": "application/json" },
327
+ "body": "{\"query\": \"example\"}"
292
328
  }
293
329
  ```
294
330
 
295
- ---
331
+ | Field | Type | Required | Description |
332
+ |-------|------|----------|-------------|
333
+ | `targetUrl` | string | yes | Your origin URL to forward to |
334
+ | `method` | string | no | HTTP method (default: `GET`) |
335
+ | `headers` | object | no | Headers to forward |
336
+ | `body` | string | no | Request body |
296
337
 
297
- ## Payment Channels (Solana)
338
+ ### Response — 200 OK
298
339
 
299
- Trust-adaptive USDC payment channels on Solana. Base URL: `https://valiron-edge-proxy.onrender.com`
340
+ ```json
341
+ {
342
+ "statusCode": 200,
343
+ "responseHeaders": {},
344
+ "responseBody": "...",
345
+ "responseMs": 145,
346
+ "costCharged": "0.0500",
347
+ "route": "prod",
348
+ "tierResolved": "AA"
349
+ }
350
+ ```
300
351
 
301
- All channel endpoints are under the `/channel/` prefix (not `/operator/`).
352
+ > **SSRF Protection:** The proxy blocks requests to private IPs (10.x, 172.16-31.x, 192.168.x), localhost, link-local addresses, and cloud metadata endpoints (169.254.169.254).
302
353
 
303
- ### POST /channel/preflight/:agentId
354
+ ---
304
355
 
305
- Pre-flight gate check. Returns escrow address, credit line, and tier policy.
356
+ ## Key-Based Agent Endpoints
306
357
 
307
- #### Parameters
358
+ For Web2 agents that don't have on-chain identities, Valiron supports key-based authentication using EIP-191 challenge-response.
308
359
 
309
- | Parameter | Location | Type | Required | Description |
310
- |-----------|----------|------|----------|-------------|
311
- | `agentId` | path | string | yes | Agent ID (ERC-8004 or Solana sequential) |
312
- | `walletAddress` | body | string | yes | Agent's Solana wallet pubkey |
360
+ ### GET /operator/key/:agentAddress/challenge
313
361
 
314
- #### Request
362
+ Get a challenge nonce for key-based authentication.
315
363
 
316
- ```bash
317
- curl -X POST https://valiron-edge-proxy.onrender.com/channel/preflight/1226 \
318
- -H "Content-Type: application/json" \
319
- -d '{"walletAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU"}'
320
- ```
364
+ | Parameter | Location | Type | Required | Description |
365
+ |-----------|----------|------|----------|-------------|
366
+ | `agentAddress` | path | string | yes | Ethereum address (0x...) |
321
367
 
322
368
  #### Response — 200 OK
323
369
 
324
370
  ```json
325
371
  {
326
- "agentId": "1226",
327
- "tier": "AA",
328
- "score": 85,
329
- "riskLevel": "GREEN",
330
- "creditLine": "50000000",
331
- "creditLineReadable": "$50.00",
332
- "maxRequests": null,
333
- "durationSeconds": 2700,
334
- "escrowAddress": "EscrowPubkey..."
372
+ "challenge": "valiron-challenge-abc123...",
373
+ "expiresAt": "2026-04-01T12:05:00.000Z"
335
374
  }
336
375
  ```
337
376
 
338
- #### Error Responses
377
+ ### POST /operator/key/verify
339
378
 
340
- | Status | Error | Meaning |
341
- |--------|-------|---------|
342
- | 400 | `wallet_required` | Missing `walletAddress` in body |
343
- | 403 | `agent_denied` | Agent trust score below threshold |
344
- | 503 | `escrow_not_configured` | Server has no escrow wallet configured |
379
+ Verify a signed challenge to authenticate a key-based agent.
345
380
 
346
- ---
381
+ #### Request Body
347
382
 
348
- ### POST /channel/open/:agentId
349
-
350
- Open a payment channel by verifying a USDC deposit transaction.
383
+ ```json
384
+ {
385
+ "address": "0x...",
386
+ "signature": "0x..."
387
+ }
388
+ ```
351
389
 
352
- #### Parameters
390
+ #### Response — 200 OK
353
391
 
354
- | Parameter | Location | Type | Required | Description |
355
- |-----------|----------|------|----------|-------------|
356
- | `agentId` | path | string | yes | Agent ID |
357
- | `walletAddress` | body | string | yes | Agent's Solana wallet |
358
- | `depositSignature` | body | string | yes | Solana TX signature of USDC deposit |
392
+ ```json
393
+ {
394
+ "verified": true,
395
+ "address": "0x...",
396
+ "isKeyAgent": true,
397
+ "tier": "C",
398
+ "riskLevel": "YELLOW",
399
+ "route": "sandbox"
400
+ }
401
+ ```
359
402
 
360
- #### Request
403
+ ### GET /operator/key/:agentAddress
361
404
 
362
- ```bash
363
- curl -X POST https://valiron-edge-proxy.onrender.com/channel/open/1226 \
364
- -H "Content-Type: application/json" \
365
- -d '{"walletAddress": "7xKXtg...", "depositSignature": "5eykt..."}'
366
- ```
405
+ Get the profile of a key-based agent.
367
406
 
368
407
  #### Response — 200 OK
369
408
 
370
409
  ```json
371
410
  {
372
- "sessionId": "ch_a1b2c3d4",
373
- "agentId": "1226",
374
- "tier": "AA",
375
- "score": 85,
376
- "riskLevel": "GREEN",
377
- "creditLine": "50000000",
378
- "creditLineReadable": "$50.00",
379
- "maxRequests": null,
380
- "expiresAt": "2026-04-23T13:45:00.000Z",
381
- "durationSeconds": 2700,
382
- "depositConfirmed": true,
383
- "depositSignature": "5eykt...",
384
- "escrowAddress": "EscrowPubkey..."
411
+ "address": "0x...",
412
+ "isKeyAgent": true,
413
+ "tier": "C",
414
+ "riskLevel": "YELLOW",
415
+ "route": "sandbox",
416
+ "firstSeen": "2026-04-01T12:00:00.000Z",
417
+ "totalRequests": 42
385
418
  }
386
419
  ```
387
420
 
388
- #### Error Responses
389
-
390
- | Status | Error | Meaning |
391
- |--------|-------|---------|
392
- | 400 | `wallet_required` | Missing wallet address |
393
- | 400 | `deposit_required` | Missing deposit signature |
394
- | 409 | `deposit_already_claimed` | TX signature already used for another channel |
395
- | 503 | `escrow_not_configured` | No escrow wallet on server |
396
-
397
421
  ---
398
422
 
399
- ### POST /channel/consume/:sessionId
423
+ ## World ID Endpoints
424
+
425
+ Verify agent-human linkage via Worldcoin's zero-knowledge proof system.
400
426
 
401
- Charge against an open channel. Requires the session ID as a Bearer token.
427
+ ### POST /operator/world-id/verify/:agentId
402
428
 
403
- #### Parameters
429
+ Submit a World ID proof for verification.
404
430
 
405
431
  | Parameter | Location | Type | Required | Description |
406
432
  |-----------|----------|------|----------|-------------|
407
- | `sessionId` | path | string | yes | Channel session ID |
408
- | `Authorization` | header | string | yes | `Bearer <sessionId>` |
409
- | `cost` | body | number | yes | Amount to charge (USDC, e.g. 0.50) |
410
- | `description` | body | string | no | Description of the charge |
433
+ | `agentId` | path | string | yes | ERC-8004 token ID |
411
434
 
412
- #### Request
435
+ #### Request Body
413
436
 
414
- ```bash
415
- curl -X POST https://valiron-edge-proxy.onrender.com/channel/consume/ch_a1b2c3d4 \
416
- -H "Content-Type: application/json" \
417
- -H "Authorization: Bearer ch_a1b2c3d4" \
418
- -d '{"cost": 0.50, "description": "GPT-4o inference"}'
437
+ ```json
438
+ {
439
+ "merkle_root": "0x...",
440
+ "nullifier_hash": "0x...",
441
+ "proof": "0x...",
442
+ "signal": "0x..."
443
+ }
419
444
  ```
420
445
 
421
446
  #### Response — 200 OK
422
447
 
423
448
  ```json
424
449
  {
425
- "requestId": "req_xyz789",
426
- "cost": "500000",
427
- "costReadable": "$0.50",
428
- "description": "GPT-4o inference",
429
- "session": {
430
- "consumed": "500000",
431
- "consumedReadable": "$0.50",
432
- "remaining": "49500000",
433
- "remainingReadable": "$49.50",
434
- "requestCount": 1,
435
- "maxRequests": null,
436
- "secondsRemaining": 2685
437
- }
450
+ "verified": true,
451
+ "agentId": "25459",
452
+ "level": "orb",
453
+ "verifiedAt": "2026-04-01T12:00:00.000Z"
438
454
  }
439
455
  ```
440
456
 
441
- #### Error Responses
442
-
443
- | Status | Error | Meaning |
444
- |--------|-------|---------|
445
- | 400 | `bad_request` | Missing `cost` field |
446
- | 401 | `unauthorized` | Missing or invalid Authorization header |
447
- | 403 | `credit_exceeded` | Insufficient credit remaining |
448
- | 404 | `not_found` | Channel not found |
449
- | 410 | `channel_expired` | Channel has expired |
450
- | 429 | `max_requests` | Request limit reached |
451
- | 429 | `consume_in_progress` | Another consume is being processed (retry) |
452
-
453
- ---
454
-
455
- ### GET /channel/status/:sessionId
456
-
457
- Get current status of a payment channel.
457
+ ### GET /operator/world-id/status/:agentId
458
458
 
459
- #### Request
460
-
461
- ```bash
462
- curl https://valiron-edge-proxy.onrender.com/channel/status/ch_a1b2c3d4
463
- ```
459
+ Check if an agent has a verified World ID.
464
460
 
465
461
  #### Response — 200 OK
466
462
 
467
463
  ```json
468
464
  {
469
- "sessionId": "ch_a1b2c3d4",
470
- "agentId": "1226",
471
- "tier": "AA",
472
- "creditLine": "50000000",
473
- "creditLineReadable": "$50.00",
474
- "consumed": "500000",
475
- "consumedReadable": "$0.50",
476
- "remaining": "49500000",
477
- "remainingReadable": "$49.50",
478
- "requestCount": 1,
479
- "maxRequests": null,
480
- "expiresAt": "2026-04-23T13:45:00.000Z",
481
- "secondsRemaining": 2685,
482
- "active": true,
483
- "settled": false
465
+ "verified": true,
466
+ "verifiedAt": "2026-04-01T12:00:00.000Z",
467
+ "level": "orb"
484
468
  }
485
469
  ```
486
470
 
487
- #### Error Responses
488
-
489
- | Status | Error | Meaning |
490
- |--------|-------|---------|
491
- | 404 | `not_found` | Channel not found |
492
-
493
- ---
494
-
495
- ### POST /channel/settle/:sessionId
471
+ ### GET /operator/world-id/profile/:agentId
496
472
 
497
- Close a payment channel and refund unused USDC.
498
-
499
- #### Request
500
-
501
- ```bash
502
- curl -X POST https://valiron-edge-proxy.onrender.com/channel/settle/ch_a1b2c3d4 \
503
- -H "Content-Type: application/json" \
504
- -d '{}'
505
- ```
473
+ Get full World ID profile including verification details.
506
474
 
507
475
  #### Response — 200 OK
508
476
 
509
477
  ```json
510
478
  {
511
- "sessionId": "ch_a1b2c3d4",
512
- "settled": true,
513
- "totalConsumed": "500000",
514
- "totalConsumedReadable": "$0.50",
515
- "requestsServed": 1,
516
- "unusedCredit": "49500000",
517
- "unusedCreditReadable": "$49.50",
518
- "refundAmount": "49500000",
519
- "refundReadable": "$49.50",
520
- "refundSignature": "4sGjMW..."
479
+ "agentId": "25459",
480
+ "worldId": {
481
+ "verified": true,
482
+ "level": "orb",
483
+ "verifiedAt": "2026-04-01T12:00:00.000Z"
484
+ }
521
485
  }
522
486
  ```
523
487
 
524
- #### Error Responses
525
-
526
- | Status | Error | Meaning |
527
- |--------|-------|---------|
528
- | 404 | `not_found` | Channel not found |
529
- | 409 | `already_settled` | Channel already settled |
530
-
531
488
  ---
532
489
 
533
- ### GET /channel/health
490
+ ## GET /operator/health
534
491
 
535
- Health check for the payment channel service.
492
+ Health check endpoint.
536
493
 
537
- #### Response — 200 OK
494
+ ### Response — 200 OK
538
495
 
539
496
  ```json
540
497
  {
541
498
  "status": "ok",
542
- "service": "dynamic-payment-channels",
543
- "escrowAddress": "EscrowPubkey..."
499
+ "supportedChains": ["ethereum", "monad", "arbitrum", "base", ...],
500
+ "defaultChain": "ethereum"
544
501
  }
545
502
  ```
546
503
 
547
- `escrowAddress` is `null` if no escrow wallet is configured.
548
-
549
504
  ---
550
505
 
551
506
  ## Solana Support
@@ -663,3 +618,354 @@ curl -X POST "https://valiron-edge-proxy.onrender.com/operator/trigger-sandbox/G
663
618
  | `SOLANA_CLUSTER` | `mainnet-beta` | Solana cluster (`mainnet-beta` or `devnet`) |
664
619
  | `SOLANA_RPC_URL` | Public RPC | Custom Solana RPC endpoint |
665
620
  | `SOLANA_FEEDBACK_KEYPAIR` | — | JSON array secret key (e.g. `[1,2,...,64]`) for feedback write-back. When set, Valiron scores are written on-chain after evaluation. |
621
+
622
+ ---
623
+
624
+ ## Dashboard Endpoints (JWT-Authenticated)
625
+
626
+ All dashboard endpoints require a `Authorization: Bearer <jwt>` header. Get a JWT by calling `POST /operator/login`.
627
+
628
+ ---
629
+
630
+ ### POST /operator/register
631
+
632
+ Create a new operator account.
633
+
634
+ #### Request Body
635
+
636
+ ```json
637
+ {
638
+ "email": "you@example.com",
639
+ "password": "SecurePass123!",
640
+ "name": "Your Name"
641
+ }
642
+ ```
643
+
644
+ #### Response — 200 OK
645
+
646
+ ```json
647
+ {
648
+ "operator": { "id": "uuid", "email": "you@example.com", "name": "Your Name", "role": "operator" },
649
+ "apiKey": "val_op_xxxx..."
650
+ }
651
+ ```
652
+
653
+ > **Important:** The `apiKey` is shown once. Copy it immediately.
654
+
655
+ ---
656
+
657
+ ### POST /operator/login
658
+
659
+ Authenticate and receive a JWT token.
660
+
661
+ #### Request Body
662
+
663
+ ```json
664
+ {
665
+ "email": "you@example.com",
666
+ "password": "SecurePass123!"
667
+ }
668
+ ```
669
+
670
+ #### Response — 200 OK
671
+
672
+ ```json
673
+ {
674
+ "operator": { "id": "uuid", "email": "you@example.com", "name": "Your Name", "role": "operator" },
675
+ "token": "eyJhbGciOi..."
676
+ }
677
+ ```
678
+
679
+ ---
680
+
681
+ ### GET /operator/me
682
+
683
+ Get the current operator's profile. Requires JWT.
684
+
685
+ #### Response — 200 OK
686
+
687
+ ```json
688
+ {
689
+ "ok": true,
690
+ "operator": {
691
+ "id": "uuid",
692
+ "email": "you@example.com",
693
+ "name": "Your Name",
694
+ "role": "operator",
695
+ "plan": "standard",
696
+ "fee_rate": "0.03",
697
+ "created_at": "2026-01-01T00:00:00.000Z",
698
+ "updated_at": "2026-01-01T00:00:00.000Z"
699
+ }
700
+ }
701
+ ```
702
+
703
+ ---
704
+
705
+ ### PATCH /operator/me
706
+
707
+ Update operator name. Requires JWT.
708
+
709
+ #### Request Body
710
+
711
+ ```json
712
+ {
713
+ "name": "New Name"
714
+ }
715
+ ```
716
+
717
+ ---
718
+
719
+ ### GET /operator/keys
720
+
721
+ List all API keys for the current operator. Requires JWT.
722
+
723
+ #### Response — 200 OK
724
+
725
+ ```json
726
+ [
727
+ {
728
+ "id": "uuid",
729
+ "keyPrefix": "val_op_c010...",
730
+ "label": null,
731
+ "revoked": false,
732
+ "lastUsed": "2026-04-01T00:00:00.000Z",
733
+ "createdAt": "2026-01-01T00:00:00.000Z"
734
+ }
735
+ ]
736
+ ```
737
+
738
+ ---
739
+
740
+ ### POST /operator/keys/rotate
741
+
742
+ Generate a new API key. Requires JWT.
743
+
744
+ #### Request Body (optional)
745
+
746
+ ```json
747
+ {
748
+ "label": "production-key"
749
+ }
750
+ ```
751
+
752
+ #### Response — 200 OK
753
+
754
+ ```json
755
+ {
756
+ "key": "val_op_xxxx...",
757
+ "id": "uuid",
758
+ "label": "production-key"
759
+ }
760
+ ```
761
+
762
+ > **Important:** The full key is shown once. Copy it immediately.
763
+
764
+ ---
765
+
766
+ ### DELETE /operator/keys/:keyId
767
+
768
+ Revoke an API key. Requires JWT.
769
+
770
+ ---
771
+
772
+ ### GET /operator/endpoints
773
+
774
+ List all registered endpoints for the current operator. Requires JWT.
775
+
776
+ #### Response — 200 OK
777
+
778
+ ```json
779
+ [
780
+ {
781
+ "id": "uuid",
782
+ "path": "/api/v1/weather",
783
+ "method": "GET",
784
+ "pricePerCall": "0.050000",
785
+ "description": "Returns weather data",
786
+ "rateLimit": 60,
787
+ "active": true,
788
+ "createdAt": "2026-01-01T00:00:00.000Z"
789
+ }
790
+ ]
791
+ ```
792
+
793
+ ---
794
+
795
+ ### POST /operator/endpoints
796
+
797
+ Register a new priced endpoint. Requires JWT.
798
+
799
+ #### Request Body
800
+
801
+ ```json
802
+ {
803
+ "path": "/api/v1/weather",
804
+ "method": "GET",
805
+ "pricePerCall": 0.05,
806
+ "description": "Returns weather data",
807
+ "rateLimit": 60,
808
+ "targetUrl": "https://myapi.com"
809
+ }
810
+ ```
811
+
812
+ | Field | Type | Required | Description |
813
+ |-------|------|----------|-------------|
814
+ | `path` | string | yes | API path (e.g. `/api/v1/weather`) |
815
+ | `method` | string | no | HTTP method (default: `GET`) |
816
+ | `pricePerCall` | number | yes | Price in USD per call (must be ≥ 0) |
817
+ | `description` | string | no | Endpoint description |
818
+ | `rateLimit` | number | no | Max requests/min per agent (null = unlimited) |
819
+ | `targetUrl` | string | no | Backend base URL (e.g. `https://myapi.com`). Must be HTTPS. Private/internal addresses are blocked. When set, the playground forwards requests to this URL + path. |
820
+
821
+ ---
822
+
823
+ ### DELETE /operator/endpoints/:endpointId
824
+
825
+ Deactivate an endpoint (soft delete). Requires JWT.
826
+
827
+ ---
828
+
829
+ ### GET /operator/analytics/stats
830
+
831
+ Aggregate stats for the current operator. Requires JWT.
832
+
833
+ #### Response — 200 OK
834
+
835
+ ```json
836
+ {
837
+ "totalCalls": 1250,
838
+ "totalRevenue": "62.50",
839
+ "uniqueAgents": 18,
840
+ "avgResponseMs": 145,
841
+ "errorRate": "0.024",
842
+ "callsToday": 42,
843
+ "revenueToday": "2.10"
844
+ }
845
+ ```
846
+
847
+ ---
848
+
849
+ ### GET /operator/analytics/revenue?days=30
850
+
851
+ Daily revenue time series. Requires JWT.
852
+
853
+ #### Response — 200 OK
854
+
855
+ ```json
856
+ [
857
+ { "date": "2026-04-01", "revenue": "3.50", "calls": 70 },
858
+ { "date": "2026-04-02", "revenue": "4.25", "calls": 85 }
859
+ ]
860
+ ```
861
+
862
+ ---
863
+
864
+ ### GET /operator/analytics/top-endpoints?limit=10
865
+
866
+ Top endpoints ranked by call volume. Requires JWT.
867
+
868
+ ---
869
+
870
+ ### GET /operator/analytics/agents?sortBy=lastSeen&limit=50&offset=0
871
+
872
+ Paginated agent summaries. Requires JWT.
873
+
874
+ | Parameter | Type | Default | Description |
875
+ |-----------|------|---------|-------------|
876
+ | `sortBy` | string | `lastSeen` | Sort by: `lastSeen`, `calls`, `spent`, `errors` |
877
+ | `limit` | number | 50 | Page size |
878
+ | `offset` | number | 0 | Offset |
879
+
880
+ ---
881
+
882
+ ### GET /operator/analytics/agents/:agentId
883
+
884
+ Detailed view of a single agent. Requires JWT. Returns summary stats, endpoint breakdown, and recent call log.
885
+
886
+ ---
887
+
888
+ ### GET /operator/analytics/logs
889
+
890
+ Paginated call logs. Requires JWT.
891
+
892
+ | Parameter | Type | Default | Description |
893
+ |-----------|------|---------|-------------|
894
+ | `limit` | number | 50 | Page size |
895
+ | `offset` | number | 0 | Offset |
896
+ | `days` | number | — | Filter to last N days |
897
+ | `agentId` | string | — | Filter by agent |
898
+ | `endpointId` | string | — | Filter by endpoint |
899
+
900
+ ---
901
+
902
+ ### POST /operator/playground
903
+
904
+ Execute a test request through the edge proxy as a simulated agent. Requires JWT. See [DASHBOARD.md — API Playground](./DASHBOARD.md#api-playground).
905
+
906
+ #### Request Body
907
+
908
+ ```json
909
+ {
910
+ "method": "GET",
911
+ "path": "/api/v1/weather?city=NYC",
912
+ "headers": { "Content-Type": "application/json" },
913
+ "body": null,
914
+ "agentId": "25459",
915
+ "chain": "ethereum",
916
+ "dryRun": false
917
+ }
918
+ ```
919
+
920
+ | Field | Type | Required | Description |
921
+ |-------|------|----------|-------------|
922
+ | `path` | string | yes | Target path or absolute URL |
923
+ | `agentId` | string | yes | ERC-8004 agent ID to simulate |
924
+ | `method` | string | no | HTTP method (default: `GET`) |
925
+ | `headers` | object | no | Custom request headers |
926
+ | `body` | string | no | Request body (for POST/PUT/PATCH) |
927
+ | `chain` | string | no | Chain (default: `ethereum`) |
928
+ | `dryRun` | boolean | no | If `true`, returns trust evaluation without logging the call |
929
+
930
+ #### Response — 200 OK (standard mode)
931
+
932
+ ```json
933
+ {
934
+ "ok": true,
935
+ "statusCode": 200,
936
+ "statusText": "OK",
937
+ "responseHeaders": {},
938
+ "responseBody": "<downstream response body or trust evaluation JSON>",
939
+ "responseMs": 145,
940
+ "costCharged": "0.0500",
941
+ "route": "prod",
942
+ "tierResolved": "AA"
943
+ }
944
+ ```
945
+
946
+ #### Response — 200 OK (dry-run mode)
947
+
948
+ ```json
949
+ {
950
+ "ok": true,
951
+ "statusCode": null,
952
+ "statusText": null,
953
+ "responseHeaders": {},
954
+ "responseBody": "{\"dryRun\":true,\"message\":\"Routing and pricing validated — request was not forwarded to your backend\",\"agentId\":\"25459\",\"chain\":\"ethereum\",\"tier\":\"AA\",\"route\":\"prod\",\"pricePerCall\":\"0.0500\",\"endpointRegistered\":true,\"trustProfile\":{\"onchainScore\":92.5,\"feedbackCount\":\"12\",\"routingDecision\":null}}",
955
+ "responseMs": null,
956
+ "costCharged": "0.0500",
957
+ "route": "prod",
958
+ "tierResolved": "AA"
959
+ }
960
+ ```
961
+
962
+ ---
963
+
964
+ ### Admin Endpoints (require `role: "admin"`)
965
+
966
+ | Endpoint | Method | Description |
967
+ |----------|--------|-------------|
968
+ | `/operator/admin/stats` | GET | Platform-wide stats |
969
+ | `/operator/admin/operators` | GET | List all operators with aggregate stats |
970
+ | `/operator/admin/operators/:id` | GET | Full operator detail (keys, endpoints, agents, revenue) |
971
+ | `/operator/admin/operators/:id/logs` | GET | Call logs for a specific operator |