@valiron/sdk 1.0.1 → 1.1.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/README.md +15 -2
- package/dist/clients.d.ts +40 -1
- package/dist/clients.js +69 -6
- package/dist/index.d.ts +50 -1
- package/dist/index.js +51 -0
- package/dist/middleware.d.ts +9 -1
- package/dist/middleware.js +228 -9
- package/dist/operatorSdk.d.ts +11 -1
- package/dist/operatorSdk.js +152 -3
- package/dist/telemetry.js +1 -1
- package/dist/types.d.ts +101 -2
- package/docs/AGENT-READY-APIS.md +417 -0
- package/docs/API-REFERENCE.md +208 -26
- package/docs/DASHBOARD.md +107 -28
- package/docs/ERRORS.md +12 -2
- package/docs/IDENTITY.md +67 -14
- package/docs/QUICKSTART.md +67 -5
- package/docs/README.md +20 -4
- package/docs/SDK-REFERENCE.md +58 -12
- package/docs/TRUST-MODEL.md +38 -4
- package/docs/llms.txt +119 -7
- package/package.json +2 -2
package/docs/API-REFERENCE.md
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Base URL: `https://valiron-edge-proxy.onrender.com`
|
|
4
4
|
|
|
5
|
-
Endpoints are organized into
|
|
5
|
+
Endpoints are organized into three groups:
|
|
6
6
|
|
|
7
7
|
- **Trust evaluation** (`/operator/agent/*`, `/operator/gate/*`, etc.) — No authentication required. Used by the SDK to evaluate agents.
|
|
8
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.
|
|
9
|
+
- **Agent-ready wrappers** (`/wrap/:operatorId/*`) — Public agent-facing URLs created from Dashboard endpoint configs. These can enforce x402/MPP payment, optional trust checks, rate limits, and upstream forwarding.
|
|
9
10
|
|
|
10
11
|
---
|
|
11
12
|
|
|
@@ -357,7 +358,7 @@ Forward a request through Valiron's edge proxy with automatic trust gating, logg
|
|
|
357
358
|
|
|
358
359
|
For Web2 agents that don't have on-chain identities, Valiron supports key-based authentication using EIP-191 challenge-response.
|
|
359
360
|
|
|
360
|
-
###
|
|
361
|
+
### POST /operator/key/:agentAddress/challenge
|
|
361
362
|
|
|
362
363
|
Get a challenge nonce for key-based authentication.
|
|
363
364
|
|
|
@@ -370,7 +371,8 @@ Get a challenge nonce for key-based authentication.
|
|
|
370
371
|
```json
|
|
371
372
|
{
|
|
372
373
|
"challenge": "valiron-challenge-abc123...",
|
|
373
|
-
"expiresAt": "2026-04-01T12:05:00.000Z"
|
|
374
|
+
"expiresAt": "2026-04-01T12:05:00.000Z",
|
|
375
|
+
"agentAddress": "0x..."
|
|
374
376
|
}
|
|
375
377
|
```
|
|
376
378
|
|
|
@@ -382,7 +384,8 @@ Verify a signed challenge to authenticate a key-based agent.
|
|
|
382
384
|
|
|
383
385
|
```json
|
|
384
386
|
{
|
|
385
|
-
"
|
|
387
|
+
"agentAddress": "0x...",
|
|
388
|
+
"challenge": "valiron-challenge-abc123...",
|
|
386
389
|
"signature": "0x..."
|
|
387
390
|
}
|
|
388
391
|
```
|
|
@@ -392,11 +395,17 @@ Verify a signed challenge to authenticate a key-based agent.
|
|
|
392
395
|
```json
|
|
393
396
|
{
|
|
394
397
|
"verified": true,
|
|
395
|
-
"
|
|
396
|
-
"
|
|
397
|
-
"tier":
|
|
398
|
-
"riskLevel":
|
|
399
|
-
"route":
|
|
398
|
+
"agentAddress": "0x...",
|
|
399
|
+
"score": null,
|
|
400
|
+
"tier": null,
|
|
401
|
+
"riskLevel": null,
|
|
402
|
+
"route": null,
|
|
403
|
+
"icebreaker": null,
|
|
404
|
+
"reasons": [
|
|
405
|
+
"Identity verified via cryptographic challenge-response",
|
|
406
|
+
"No behavioral data yet — agent has not been scored"
|
|
407
|
+
],
|
|
408
|
+
"timestamp": "2026-04-01T12:00:00.000Z"
|
|
400
409
|
}
|
|
401
410
|
```
|
|
402
411
|
|
|
@@ -408,13 +417,18 @@ Get the profile of a key-based agent.
|
|
|
408
417
|
|
|
409
418
|
```json
|
|
410
419
|
{
|
|
411
|
-
"
|
|
412
|
-
"
|
|
413
|
-
"
|
|
414
|
-
"
|
|
415
|
-
"
|
|
416
|
-
"
|
|
417
|
-
"
|
|
420
|
+
"agentAddress": "0x...",
|
|
421
|
+
"verified": true,
|
|
422
|
+
"score": 82,
|
|
423
|
+
"tier": "A",
|
|
424
|
+
"riskLevel": "GREEN",
|
|
425
|
+
"route": "prod",
|
|
426
|
+
"icebreaker": null,
|
|
427
|
+
"reasons": [
|
|
428
|
+
"Identity verified via cryptographic challenge-response",
|
|
429
|
+
"Valiron behavioral tier: A (GREEN)"
|
|
430
|
+
],
|
|
431
|
+
"timestamp": "2026-04-01T12:00:00.000Z"
|
|
418
432
|
}
|
|
419
433
|
```
|
|
420
434
|
|
|
@@ -487,6 +501,84 @@ Get full World ID profile including verification details.
|
|
|
487
501
|
|
|
488
502
|
---
|
|
489
503
|
|
|
504
|
+
## Self Endpoints
|
|
505
|
+
|
|
506
|
+
Create Self Enterprise verification sessions, receive signed Self webhooks, and read Self eligible-human verification plus optional Self Agent ID binding. Use the `self` trust signal when an endpoint should consider Self proof during Valiron scoring.
|
|
507
|
+
|
|
508
|
+
### POST /operator/self/session/:agentId
|
|
509
|
+
|
|
510
|
+
Create a Self Enterprise verification session for an agent.
|
|
511
|
+
|
|
512
|
+
| Parameter | Location | Type | Required | Description |
|
|
513
|
+
|-----------|----------|------|----------|-------------|
|
|
514
|
+
| `agentId` | path | string | yes | ERC-8004 token ID |
|
|
515
|
+
|
|
516
|
+
#### Request Body
|
|
517
|
+
|
|
518
|
+
```json
|
|
519
|
+
{
|
|
520
|
+
"selfAgentId": "self-agent-...",
|
|
521
|
+
"selfAgentRegistry": "0x...",
|
|
522
|
+
"successUrl": "https://example.com/verified",
|
|
523
|
+
"failureUrl": "https://example.com/failed",
|
|
524
|
+
"expiresInSeconds": 900,
|
|
525
|
+
"metadata": {}
|
|
526
|
+
}
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
#### Response — 200 OK
|
|
530
|
+
|
|
531
|
+
```json
|
|
532
|
+
{
|
|
533
|
+
"ok": true,
|
|
534
|
+
"agentId": "25459",
|
|
535
|
+
"self": {
|
|
536
|
+
"sessionId": "sess_...",
|
|
537
|
+
"externalUuid": "00000000-0000-0000-0000-000000000000",
|
|
538
|
+
"verificationUrl": "https://verify.self.xyz/s/...",
|
|
539
|
+
"status": "pending",
|
|
540
|
+
"expiresAt": "2026-04-01T12:15:00.000Z"
|
|
541
|
+
},
|
|
542
|
+
"timestamp": "2026-04-01T12:00:00.000Z"
|
|
543
|
+
}
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
### POST /operator/self/webhook
|
|
547
|
+
|
|
548
|
+
Receive signed Self Enterprise webhooks. This endpoint verifies the raw request body with `SelfWebhooks.verify(...)`, stores only valid `verification.completed` events, and optionally re-verifies proofs when `SELF_TEST_ORG_ID` or `SELF_LIVE_ORG_ID` is configured.
|
|
549
|
+
|
|
550
|
+
Configure this URL in the Self dashboard:
|
|
551
|
+
|
|
552
|
+
```text
|
|
553
|
+
https://<edge-proxy-host>/operator/self/webhook
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
Self environment variables are split by deployment mode. `SELF_ENV=test` or `SELF_ENV=live` selects which credentials create new sessions; the webhook accepts both configured test and live signing secrets.
|
|
557
|
+
|
|
558
|
+
```text
|
|
559
|
+
SELF_ENV=test
|
|
560
|
+
SELF_TEST_API_KEY=sk_test_...
|
|
561
|
+
SELF_TEST_FLOW_ID=...
|
|
562
|
+
SELF_TEST_WEBHOOK_SECRET=whsec_...
|
|
563
|
+
SELF_LIVE_API_KEY=sk_live_...
|
|
564
|
+
SELF_LIVE_FLOW_ID=...
|
|
565
|
+
SELF_LIVE_WEBHOOK_SECRET=whsec_...
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
### GET /operator/self/status/:agentId
|
|
569
|
+
|
|
570
|
+
Check if an agent has a verified Self eligible-human link.
|
|
571
|
+
|
|
572
|
+
### GET /operator/self/profile/:agentId
|
|
573
|
+
|
|
574
|
+
Get full Self eligible-human / Agent ID profile.
|
|
575
|
+
|
|
576
|
+
### POST /operator/self/verify/:agentId
|
|
577
|
+
|
|
578
|
+
Trusted-payload ingestion for local/internal tests only. Disabled unless `SELF_ALLOW_TRUSTED_PAYLOADS=true`; production should use `/operator/self/session/:agentId` and `/operator/self/webhook`.
|
|
579
|
+
|
|
580
|
+
---
|
|
581
|
+
|
|
490
582
|
## GET /operator/health
|
|
491
583
|
|
|
492
584
|
Health check endpoint.
|
|
@@ -771,7 +863,7 @@ Revoke an API key. Requires JWT.
|
|
|
771
863
|
|
|
772
864
|
### GET /operator/endpoints
|
|
773
865
|
|
|
774
|
-
List all registered
|
|
866
|
+
List all registered agent-ready wrappers for the current operator. Requires JWT.
|
|
775
867
|
|
|
776
868
|
#### Response — 200 OK
|
|
777
869
|
|
|
@@ -779,11 +871,16 @@ List all registered endpoints for the current operator. Requires JWT.
|
|
|
779
871
|
[
|
|
780
872
|
{
|
|
781
873
|
"id": "uuid",
|
|
782
|
-
"path": "/
|
|
874
|
+
"path": "/weather",
|
|
783
875
|
"method": "GET",
|
|
784
|
-
"pricePerCall": "0.
|
|
876
|
+
"pricePerCall": "0.001000",
|
|
785
877
|
"description": "Returns weather data",
|
|
786
878
|
"rateLimit": 60,
|
|
879
|
+
"targetUrl": "https://api.example.com",
|
|
880
|
+
"paymentProtocol": "x402",
|
|
881
|
+
"paymentNetwork": "eip155:8453",
|
|
882
|
+
"trustEnabled": false,
|
|
883
|
+
"upstreamAuthType": "none",
|
|
787
884
|
"active": true,
|
|
788
885
|
"createdAt": "2026-01-01T00:00:00.000Z"
|
|
789
886
|
}
|
|
@@ -794,29 +891,43 @@ List all registered endpoints for the current operator. Requires JWT.
|
|
|
794
891
|
|
|
795
892
|
### POST /operator/endpoints
|
|
796
893
|
|
|
797
|
-
|
|
894
|
+
Create a hosted agent-ready API wrapper. Requires JWT.
|
|
798
895
|
|
|
799
896
|
#### Request Body
|
|
800
897
|
|
|
801
898
|
```json
|
|
802
899
|
{
|
|
803
|
-
"path": "/
|
|
900
|
+
"path": "/weather",
|
|
804
901
|
"method": "GET",
|
|
805
|
-
"pricePerCall": 0.
|
|
902
|
+
"pricePerCall": 0.001,
|
|
806
903
|
"description": "Returns weather data",
|
|
807
904
|
"rateLimit": 60,
|
|
808
|
-
"targetUrl": "https://
|
|
905
|
+
"targetUrl": "https://api.example.com",
|
|
906
|
+
"paymentProtocol": "x402",
|
|
907
|
+
"paymentNetwork": "eip155:8453",
|
|
908
|
+
"payoutAddress": "0xYourReceivingWallet",
|
|
909
|
+
"trustEnabled": false,
|
|
910
|
+
"upstreamAuthType": "header",
|
|
911
|
+
"upstreamAuthHeader": "Authorization",
|
|
912
|
+
"upstreamAuthSecret": "Bearer upstream-secret"
|
|
809
913
|
}
|
|
810
914
|
```
|
|
811
915
|
|
|
812
916
|
| Field | Type | Required | Description |
|
|
813
917
|
|-------|------|----------|-------------|
|
|
814
|
-
| `path` | string | yes |
|
|
918
|
+
| `path` | string | yes | Public wrapper path (e.g. `/weather`). Callers use `/wrap/{operatorId}/weather`. |
|
|
815
919
|
| `method` | string | no | HTTP method (default: `GET`) |
|
|
816
|
-
| `pricePerCall` | number | yes | Price in USD per call
|
|
920
|
+
| `pricePerCall` | number | yes | Price in USD per call. Use `0` for a free wrapper. |
|
|
817
921
|
| `description` | string | no | Endpoint description |
|
|
818
922
|
| `rateLimit` | number | no | Max requests/min per agent (null = unlimited) |
|
|
819
|
-
| `targetUrl` | string |
|
|
923
|
+
| `targetUrl` | string | yes | Existing upstream API base URL. Valiron appends `path` to this base URL when forwarding. Must be HTTPS in production. Private/internal addresses are blocked. |
|
|
924
|
+
| `paymentProtocol` | string | no | `x402` or `mpp`. Defaults to `x402`. |
|
|
925
|
+
| `paymentNetwork` | string | no | Payment network. Use `eip155:8453` or `eip155:84532` for x402, and `tempo:4217` or `tempo:42431` for MPP. |
|
|
926
|
+
| `payoutAddress` | string | no | Receiving wallet for paid x402 wrappers. Required if no platform default receiving address is configured. |
|
|
927
|
+
| `trustEnabled` | boolean | no | When true, the wrapper requires Valiron agent identity headers and checks trust before forwarding. |
|
|
928
|
+
| `upstreamAuthType` | string | no | `none` or `header`. Defaults to `none`. |
|
|
929
|
+
| `upstreamAuthHeader` | string | no | Header name to attach to the upstream request, such as `Authorization` or `X-API-Key`. |
|
|
930
|
+
| `upstreamAuthSecret` | string | no | Secret value for `upstreamAuthHeader`. Stored encrypted at rest. |
|
|
820
931
|
|
|
821
932
|
---
|
|
822
933
|
|
|
@@ -826,6 +937,77 @@ Deactivate an endpoint (soft delete). Requires JWT.
|
|
|
826
937
|
|
|
827
938
|
---
|
|
828
939
|
|
|
940
|
+
## Agent-Ready Wrapper Endpoint
|
|
941
|
+
|
|
942
|
+
### ALL /wrap/:operatorId/*
|
|
943
|
+
|
|
944
|
+
Public agent-facing wrapper URL. This endpoint is created by `POST /operator/endpoints` or the **Make API Agent-Ready** dashboard flow.
|
|
945
|
+
|
|
946
|
+
```text
|
|
947
|
+
https://valiron-edge-proxy.onrender.com/wrap/{operatorId}/{path}
|
|
948
|
+
```
|
|
949
|
+
|
|
950
|
+
The wrapper matches the operator ID, path, and HTTP method to an active endpoint config. It can enforce payment, optional trust checks, rate limits, SSRF protection, upstream auth injection, and request forwarding.
|
|
951
|
+
|
|
952
|
+
#### Caller Headers
|
|
953
|
+
|
|
954
|
+
| Header | Required | Description |
|
|
955
|
+
|--------|----------|-------------|
|
|
956
|
+
| `X-PAYMENT` | paid x402 retry | x402 payment payload returned by an x402-capable client. |
|
|
957
|
+
| `Authorization: Payment ...` | paid MPP retry | MPP payment authorization header. |
|
|
958
|
+
| `x-agent-id` | if trust enabled | ERC-8004 agent ID. |
|
|
959
|
+
| `x-agent-address` | if trust enabled | Key-based agent wallet address. |
|
|
960
|
+
| `x-agent-session` | key agents | Session token from key-based challenge-response. |
|
|
961
|
+
|
|
962
|
+
#### Free Wrapper Response
|
|
963
|
+
|
|
964
|
+
If `pricePerCall` is `0`, the wrapper forwards directly to the upstream API:
|
|
965
|
+
|
|
966
|
+
```bash
|
|
967
|
+
curl https://valiron-edge-proxy.onrender.com/wrap/{operatorId}/status
|
|
968
|
+
```
|
|
969
|
+
|
|
970
|
+
#### x402 Paid Wrapper Response
|
|
971
|
+
|
|
972
|
+
If `paymentProtocol` is `x402` and no valid payment is attached, the wrapper returns:
|
|
973
|
+
|
|
974
|
+
```http
|
|
975
|
+
HTTP/1.1 402 Payment Required
|
|
976
|
+
X-PAYMENT-RESPONSE: ...
|
|
977
|
+
Content-Type: application/json
|
|
978
|
+
```
|
|
979
|
+
|
|
980
|
+
The caller should retry with a valid `X-PAYMENT` header. See [AGENT-READY-APIS.md](./AGENT-READY-APIS.md#paid-x402-client) for a complete TypeScript client.
|
|
981
|
+
|
|
982
|
+
#### MPP Paid Wrapper Response
|
|
983
|
+
|
|
984
|
+
If `paymentProtocol` is `mpp` and no valid payment is attached, the wrapper returns:
|
|
985
|
+
|
|
986
|
+
```http
|
|
987
|
+
HTTP/1.1 402 Payment Required
|
|
988
|
+
WWW-Authenticate: Payment ...
|
|
989
|
+
Content-Type: application/json
|
|
990
|
+
```
|
|
991
|
+
|
|
992
|
+
The caller should retry with `Authorization: Payment ...`. For command-line testing:
|
|
993
|
+
|
|
994
|
+
```bash
|
|
995
|
+
pnpm exec mppx https://valiron-edge-proxy.onrender.com/wrap/{operatorId}/research
|
|
996
|
+
```
|
|
997
|
+
|
|
998
|
+
#### Error Responses
|
|
999
|
+
|
|
1000
|
+
| Status | Code | Meaning |
|
|
1001
|
+
|--------|------|---------|
|
|
1002
|
+
| 402 | `payment_required` | Paid wrapper needs valid x402 or MPP payment. |
|
|
1003
|
+
| 403 | `trust_denied` | Trust checks are enabled and the agent did not pass. |
|
|
1004
|
+
| 404 | `wrapper_not_found` | No active wrapper matched operator ID, path, and method. |
|
|
1005
|
+
| 413 | `payload_too_large` | Request body exceeds wrapper limit. |
|
|
1006
|
+
| 429 | `rate_limit_exceeded` | Caller exceeded wrapper rate limit. |
|
|
1007
|
+
| 502 | `wrapper_request_failed` | Upstream request failed or returned an invalid response. |
|
|
1008
|
+
|
|
1009
|
+
---
|
|
1010
|
+
|
|
829
1011
|
### GET /operator/analytics/stats
|
|
830
1012
|
|
|
831
1013
|
Aggregate stats for the current operator. Requires JWT.
|
package/docs/DASHBOARD.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Manage your Valiron integration from a single web interface — register endpoints, monitor agent activity, test trust evaluations, and view analytics.
|
|
4
4
|
|
|
5
|
-
**Dashboard URL:** [https://valiron.co/dashboard](https://valiron.co/dashboard)
|
|
5
|
+
**Dashboard URL:** [https://www.valiron.co/dashboard](https://www.valiron.co/dashboard)
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
To create an account:
|
|
12
12
|
|
|
13
|
-
1. Go to [valiron.co/dashboard](https://valiron.co/dashboard) and click **Create account**
|
|
13
|
+
1. Go to [valiron.co/dashboard](https://www.valiron.co/dashboard) and click **Create account**
|
|
14
14
|
2. Enter your name, email, and password
|
|
15
15
|
3. On success, you'll see a **one-time API key** — copy it immediately (it won't be shown again)
|
|
16
16
|
|
|
@@ -27,7 +27,7 @@ Your landing page after signing in. Shows a summary of your integration at a gla
|
|
|
27
27
|
- **Top stats** — Total Revenue, Total Calls, Unique Agents, Avg Latency
|
|
28
28
|
- **Secondary stats** — Active API Keys, Registered Endpoints, Calls Today, Plan + fee rate
|
|
29
29
|
- **Recent Activity** — Last 5 call logs with method, path, agent, cost, and timestamp
|
|
30
|
-
- **Quick Start** — 3-step guide: get API key →
|
|
30
|
+
- **Quick Start** — 3-step guide: get API key → make an API agent-ready → test with agents
|
|
31
31
|
|
|
32
32
|
---
|
|
33
33
|
|
|
@@ -98,26 +98,99 @@ Each key shows its prefix, label, last used date, and creation date.
|
|
|
98
98
|
|
|
99
99
|
---
|
|
100
100
|
|
|
101
|
-
##
|
|
101
|
+
## Make API Agent-Ready
|
|
102
102
|
|
|
103
103
|
**Route:** `/dashboard/endpoints`
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
Create hosted Valiron wrappers for existing HTTP APIs. A wrapper provides a public agent-facing URL, handles optional x402/MPP payment challenges, optionally checks Valiron trust, applies rate limits, forwards to the upstream API, and records call logs.
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
This product is appropriate when an API must be callable by autonomous agents without requiring immediate SDK integration in the provider backend.
|
|
108
|
+
|
|
109
|
+
### Hosted wrapper flow
|
|
110
|
+
|
|
111
|
+
1. Open **Make API Agent-Ready**.
|
|
112
|
+
2. Click **Make API Agent-Ready**.
|
|
113
|
+
3. Enter your upstream API details and payment settings.
|
|
114
|
+
4. Save the wrapper.
|
|
115
|
+
5. Distribute the generated wrapper URL to agent clients:
|
|
116
|
+
|
|
117
|
+
```text
|
|
118
|
+
https://valiron-edge-proxy.onrender.com/wrap/{operatorId}/{path}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
When an agent calls the wrapper:
|
|
122
|
+
|
|
123
|
+
1. Valiron matches `{operatorId}`, path, and method to your wrapper config.
|
|
124
|
+
2. If `pricePerCall` is greater than `0`, Valiron returns a `402 Payment Required` challenge unless valid payment is attached.
|
|
125
|
+
3. If trust checks are enabled, Valiron evaluates the agent identity headers.
|
|
126
|
+
4. Valiron appends the wrapper path to `targetUrl`, forwards the request, and adds Valiron metadata headers.
|
|
127
|
+
5. Valiron returns the upstream response and records analytics.
|
|
128
|
+
|
|
129
|
+
### Wrapper fields
|
|
108
130
|
|
|
109
131
|
| Field | Required | Description |
|
|
110
132
|
|-------|----------|-------------|
|
|
111
|
-
|
|
|
133
|
+
| Public path | Yes | Agent-facing path (for example `/weather`). This becomes `/wrap/{operatorId}/weather`. |
|
|
112
134
|
| Method | Yes | HTTP method: GET, POST, PUT, PATCH, DELETE |
|
|
113
|
-
|
|
|
135
|
+
| Upstream API base URL | Yes | Existing API base URL, for example `https://api.example.com`. Must be HTTPS in production. Private/internal addresses are blocked. |
|
|
136
|
+
| Price per call (USD) | Yes | `0` for free wrappers, or a positive USD amount for paid wrappers. |
|
|
137
|
+
| Payment protocol | Yes | `x402` or `mpp`. `x402` is used by default and for free wrappers. |
|
|
138
|
+
| Payment network | No | Network for paid wrappers. Common values: `eip155:8453` for Base x402 and `tempo:4217` for MPP. |
|
|
139
|
+
| Payout wallet | No | Required for paid x402 wrappers unless a platform default receiving address is configured. |
|
|
140
|
+
| Require Valiron trust | No | When enabled, callers must provide agent identity headers and pass the trust threshold. |
|
|
114
141
|
| Rate limit (req/min) | No | Max requests per minute per agent (null = unlimited) |
|
|
115
|
-
|
|
|
142
|
+
| Upstream auth | No | Optional static header secret Valiron should attach to your upstream request. |
|
|
116
143
|
| Description | No | What this endpoint does |
|
|
117
144
|
|
|
118
|
-
**Removing
|
|
145
|
+
**Removing a wrapper** performs a soft-delete. The wrapper stops matching new calls but historical logs remain available.
|
|
146
|
+
|
|
147
|
+
### Free wrapper example
|
|
148
|
+
|
|
149
|
+
```text
|
|
150
|
+
Public path: /status
|
|
151
|
+
Method: GET
|
|
152
|
+
Upstream API base URL: https://api.example.com
|
|
153
|
+
Price: 0
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Agents call:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
curl https://valiron-edge-proxy.onrender.com/wrap/{operatorId}/status
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Paid x402 wrapper example
|
|
163
|
+
|
|
164
|
+
```text
|
|
165
|
+
Public path: /weather
|
|
166
|
+
Method: GET
|
|
167
|
+
Upstream API base URL: https://api.example.com
|
|
168
|
+
Price: 0.001
|
|
169
|
+
Payment protocol: x402
|
|
170
|
+
Payment network: eip155:8453
|
|
171
|
+
Payout wallet: 0x...
|
|
172
|
+
```
|
|
119
173
|
|
|
120
|
-
|
|
174
|
+
Agents call the wrapper once, receive a `402` with an x402 payment challenge, then retry with a valid `X-PAYMENT` header.
|
|
175
|
+
|
|
176
|
+
### Paid MPP wrapper example
|
|
177
|
+
|
|
178
|
+
```text
|
|
179
|
+
Public path: /research
|
|
180
|
+
Method: GET
|
|
181
|
+
Upstream API base URL: https://api.example.com
|
|
182
|
+
Price: 0.001
|
|
183
|
+
Payment protocol: mpp
|
|
184
|
+
Payment network: tempo:4217
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Agents call the wrapper once, receive `WWW-Authenticate: Payment`, then retry with `Authorization: Payment ...`. For command-line testing, use `mppx`:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
pnpm exec mppx https://valiron-edge-proxy.onrender.com/wrap/{operatorId}/research
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
For the complete setup guide, see [AGENT-READY-APIS.md](./AGENT-READY-APIS.md).
|
|
121
194
|
|
|
122
195
|
---
|
|
123
196
|
|
|
@@ -149,10 +222,10 @@ Toggle **Dry Run** on to see the trust evaluation without logging the call:
|
|
|
149
222
|
|
|
150
223
|
With dry-run off, the playground performs the full trust evaluation and logs the call to your Analytics/Logs pages.
|
|
151
224
|
|
|
152
|
-
- **If your endpoint has
|
|
153
|
-
- **If no
|
|
225
|
+
- **If your endpoint has an upstream base URL** — the playground forwards the request to your backend with Valiron headers (`X-Agent-Id`, `X-Valiron-Chain`, `X-Valiron-Tier`, `X-Valiron-Route`). You'll see the real HTTP response from your server.
|
|
226
|
+
- **If no upstream base URL is set** — the playground returns the trust evaluation only (tier, route, cost, on-chain score).
|
|
154
227
|
|
|
155
|
-
> **Tip:** Add
|
|
228
|
+
> **Tip:** Add an upstream base URL to your wrapper to enable end-to-end testing in the playground.
|
|
156
229
|
|
|
157
230
|
### Response panel
|
|
158
231
|
|
|
@@ -195,17 +268,9 @@ Platform-wide administration. Only visible to operators with `role: "admin"`.
|
|
|
195
268
|
|
|
196
269
|
---
|
|
197
270
|
|
|
198
|
-
## Integration
|
|
271
|
+
## Middleware Integration
|
|
199
272
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
### Step 1 — Dashboard setup
|
|
203
|
-
|
|
204
|
-
1. Create your account on the dashboard
|
|
205
|
-
2. Copy your API key from the Keys page
|
|
206
|
-
3. Register your endpoints on the Endpoints page (path, method, pricing)
|
|
207
|
-
|
|
208
|
-
### Step 2 — SDK integration
|
|
273
|
+
Valiron's core product is SDK middleware deployed within the API backend. Use this path when trust checks, route decisions, sandbox triggers, payment gating, and usage tracking must execute before the API handler.
|
|
209
274
|
|
|
210
275
|
Install the SDK and add it to your backend:
|
|
211
276
|
|
|
@@ -213,7 +278,7 @@ Install the SDK and add it to your backend:
|
|
|
213
278
|
npm install @valiron/sdk
|
|
214
279
|
```
|
|
215
280
|
|
|
216
|
-
**
|
|
281
|
+
**Express middleware:**
|
|
217
282
|
|
|
218
283
|
```typescript
|
|
219
284
|
import { ValironOperator } from "@valiron/sdk";
|
|
@@ -222,7 +287,7 @@ const operator = new ValironOperator({ apiKey: "val_op_xxxx" });
|
|
|
222
287
|
app.use("/api/weather", operator.paywall({ pricePerCall: 0.05 }));
|
|
223
288
|
```
|
|
224
289
|
|
|
225
|
-
**
|
|
290
|
+
**Manual gating:**
|
|
226
291
|
|
|
227
292
|
```typescript
|
|
228
293
|
import { ValironSDK } from "@valiron/sdk";
|
|
@@ -240,7 +305,7 @@ app.use("/api/weather", async (req, res, next) => {
|
|
|
240
305
|
});
|
|
241
306
|
```
|
|
242
307
|
|
|
243
|
-
###
|
|
308
|
+
### Test with the Playground
|
|
244
309
|
|
|
245
310
|
Before going live, use the Playground to verify:
|
|
246
311
|
- That your endpoint pricing and rate limits are configured correctly
|
|
@@ -248,6 +313,20 @@ Before going live, use the Playground to verify:
|
|
|
248
313
|
- That low/zero-reputation agents get sandboxed or blocked
|
|
249
314
|
- What the full request/response cycle looks like with real latency numbers
|
|
250
315
|
|
|
251
|
-
###
|
|
316
|
+
### Monitor
|
|
252
317
|
|
|
253
318
|
Use the dashboard to track agent activity, review call logs, and monitor revenue.
|
|
319
|
+
|
|
320
|
+
## Separate Product: API Scaffolding
|
|
321
|
+
|
|
322
|
+
API Scaffolding is a separate product that provides a hosted, agent-facing wrapper URL for an existing HTTPS API. A hosted wrapper can collect x402/MPP payment, apply optional trust checks, enforce rate limits, forward upstream, and log usage.
|
|
323
|
+
|
|
324
|
+
1. Create your account on the dashboard.
|
|
325
|
+
2. Copy your API key from the Keys page.
|
|
326
|
+
3. Create a wrapper from **Make API Agent-Ready**.
|
|
327
|
+
4. Test the generated `/wrap/{operatorId}/{path}` URL.
|
|
328
|
+
5. Monitor calls in Analytics and Logs.
|
|
329
|
+
|
|
330
|
+
For deployments requiring full backend control, protect the API directly with Valiron middleware using `createValironGate()` or `ValironOperator.paywall()`.
|
|
331
|
+
|
|
332
|
+
For full hosted wrapper docs, see [AGENT-READY-APIS.md](./AGENT-READY-APIS.md).
|
package/docs/ERRORS.md
CHANGED
|
@@ -94,7 +94,7 @@ First-time agents that haven't been sandbox-tested yet receive provisional score
|
|
|
94
94
|
|
|
95
95
|
### Timeout errors
|
|
96
96
|
|
|
97
|
-
The default
|
|
97
|
+
The SDK uses method-aware default timeouts: 10 seconds generally, 15 seconds for `gate()`/`proxy()`, and 30 seconds for sandbox triggers. To force a single timeout for all calls, configure it explicitly:
|
|
98
98
|
|
|
99
99
|
```typescript
|
|
100
100
|
const valiron = new ValironSDK({ timeout: 30000 }); // 30 seconds
|
|
@@ -167,7 +167,7 @@ All Valiron middleware (Express, Fastify, Next.js, generic) returns consistent e
|
|
|
167
167
|
| 400 | Missing `targetUrl` or invalid request | Check your proxy request fields |
|
|
168
168
|
| 403 | Agent denied by trust gate | Agent does not meet the trust threshold |
|
|
169
169
|
| 403 | SSRF blocked | The `targetUrl` resolves to a private IP, localhost, or metadata endpoint |
|
|
170
|
-
| 503 | Origin server unreachable | Your
|
|
170
|
+
| 503 | Origin server unreachable | Your upstream API base URL is down or timed out |
|
|
171
171
|
|
|
172
172
|
## Key-Based Agent Errors
|
|
173
173
|
|
|
@@ -184,3 +184,13 @@ All Valiron middleware (Express, Fastify, Next.js, generic) returns consistent e
|
|
|
184
184
|
| 400 | Invalid or malformed proof | Verify your World ID proof payload fields |
|
|
185
185
|
| 404 | Agent has no World ID verification | The agent hasn't completed World ID verification yet |
|
|
186
186
|
| 409 | Nullifier hash already used | This World ID proof has already been submitted |
|
|
187
|
+
|
|
188
|
+
## Self Errors
|
|
189
|
+
|
|
190
|
+
| Status | When | Action |
|
|
191
|
+
|--------|------|--------|
|
|
192
|
+
| 400 | Raw webhook body unavailable or Self webhook signature invalid | Configure Self to call `/operator/self/webhook` and keep the endpoint's `whsec_...` value in `SELF_TEST_WEBHOOK_SECRET` or `SELF_LIVE_WEBHOOK_SECRET` |
|
|
193
|
+
| 400 | Self webhook cannot be mapped to a Valiron session | Create sessions through `createSelfSession()` or `POST /operator/self/session/:agentId` so `externalUuid` is stored before the webhook arrives |
|
|
194
|
+
| 403 | Trusted Self payload ingestion is disabled | Use the production session + signed webhook flow, or set `SELF_ALLOW_TRUSTED_PAYLOADS=true` only for local/internal tests |
|
|
195
|
+
| 404 | Agent not found on-chain | Use an existing ERC-8004 agent ID or a supported Solana agent ID before creating a Self session |
|
|
196
|
+
| 409 | Agent already has a verified Self link | Self links are immutable once verified |
|