forked from x402-foundation/x402
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.json
More file actions
178 lines (178 loc) · 6.56 KB
/
Copy pathopenapi.json
File metadata and controls
178 lines (178 loc) · 6.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
{
"openapi": "3.1.0",
"info": {
"title": "AgentPay x402 Facilitator",
"version": "1.0.0",
"description": "Production x402 payment facilitator for AI agents. Handles atomic USDC settlements, escrow, and agent identity on Base L2. ERC-8183 compliant. No API keys required — agents pay per call.",
"x-guidance": "Use POST /pay to settle a USDC payment between two agents. Use POST /escrow to hold funds in escrow pending job completion. Use POST /escrow/release to release escrowed funds. Use GET /metrics for live platform stats. All payments settle on Base L2 in USDC. Flat fee: $0.02 per settlement."
},
"x-discovery": {
"ownershipProofs": []
},
"servers": [
{
"url": "https://x402-agent-pay.com",
"description": "AgentPay Production Facilitator"
}
],
"paths": {
"/pay": {
"post": {
"operationId": "settlePayment",
"summary": "Settle Payment — Atomic USDC transfer between agents on Base L2",
"description": "Initiates an atomic x402 USDC payment from payer to payee on Base L2. Settlement is on-chain. Flat fee of $0.02 deducted per transaction. Supports optional partner_id for revenue sharing.",
"tags": ["Payments"],
"x-payment-info": {
"price": {
"mode": "fixed",
"currency": "USD",
"amount": "0.020000"
},
"protocols": [
{ "x402": {} }
]
},
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"payer": {
"type": "string",
"description": "Base L2 wallet address of the paying agent (0x...)"
},
"payee": {
"type": "string",
"description": "Base L2 wallet address of the receiving agent (0x...)"
},
"amount_usdc": {
"type": "number",
"description": "Amount in USDC to transfer"
},
"partner_id": {
"type": "string",
"description": "Optional partner identifier for revenue share tracking"
},
"memo": {
"type": "string",
"description": "Optional memo or job reference ID"
}
},
"required": ["payer", "payee", "amount_usdc"]
}
}
}
},
"responses": {
"200": {
"description": "Payment settled successfully",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"tx_hash": { "type": "string", "description": "On-chain transaction hash" },
"amount_usdc": { "type": "number" },
"fee_usdc": { "type": "number" },
"status": { "type": "string" }
}
}
}
}
},
"402": {
"description": "Payment Required — include x402 payment header"
}
}
}
},
"/escrow": {
"post": {
"operationId": "createEscrow",
"summary": "Create Escrow — Hold USDC pending job completion",
"description": "Locks USDC in escrow between a payer and payee, tied to a job ID. Funds are released only when the job is marked complete or via dispute resolution. Ideal for agent-to-agent service agreements.",
"tags": ["Escrow"],
"x-payment-info": {
"price": {
"mode": "fixed",
"currency": "USD",
"amount": "0.020000"
},
"protocols": [
{ "x402": {} }
]
},
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"payer": { "type": "string", "description": "Base L2 wallet of payer" },
"payee": { "type": "string", "description": "Base L2 wallet of payee" },
"amount_usdc": { "type": "number", "description": "USDC to lock in escrow" },
"job_id": { "type": "string", "description": "Unique job or task reference ID" },
"timeout_hours": { "type": "integer", "description": "Hours until escrow auto-expires (default: 72)" }
},
"required": ["payer", "payee", "amount_usdc", "job_id"]
}
}
}
},
"responses": {
"200": {
"description": "Escrow created successfully",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"escrow_id": { "type": "string" },
"job_id": { "type": "string" },
"amount_usdc": { "type": "number" },
"status": { "type": "string" },
"expires_at": { "type": "string" }
}
}
}
}
},
"402": { "description": "Payment Required" }
}
}
},
"/metrics": {
"get": {
"operationId": "getMetrics",
"summary": "Platform Metrics — Live facilitator stats",
"description": "Returns live platform statistics including total payment volume, active escrows, fee totals, and treasury balance. Free to call — no payment required.",
"tags": ["Info"],
"responses": {
"200": {
"description": "Live platform metrics",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"total_payments": { "type": "integer" },
"total_volume_usdc": { "type": "number" },
"total_fees_usdc": { "type": "number" },
"active_escrows": { "type": "integer" },
"escrow_held_usdc": { "type": "number" },
"unique_payers": { "type": "integer" },
"flat_fee_usdc": { "type": "number" },
"treasury": { "type": "string" }
}
}
}
}
}
}
}
}
}
}