Skip to main content
POST
Create x402 Session
工作階段允許您預授權消費預算,用於重複的 x402 API 呼叫。工作階段內的支付從工作階段預算中扣除,無需對每次呼叫單獨核准。

請求內容

string
必填
為工作階段提供資金的代理。
string
必填
工作階段可消費的最大總額(例如 "100.00")。
string
必填
用於結算的 CAIP-2 鏈識別碼(例如 eip155:84532)。
integer
必填
工作階段存活時間(秒)。工作階段在此期限後過期。
string[]
此工作階段授權支付的 URL 清單(選填)。如果省略,則允許所有支援 x402 的 URL。

範例

Response

授權

X-API-Key
string
header
必填

API key authentication. Keys are prefixed with awx_.

主體

application/json
agent_id
string
必填

The agent whose wallet funds the session.

budget_limit
string
必填

Maximum total amount the session can spend (e.g., "100.00").

chain
string
必填

CAIP-2 chain identifier for settlement (e.g., eip155:84532).

ttl_seconds
integer
必填

Session time-to-live in seconds. The session expires after this duration.

allowed_urls
string<uri>[]

Optional list of URLs this session is authorized to pay. If omitted, all x402-enabled URLs are allowed.

回應

Session created successfully.

An x402 payment session with a pre-authorized spending budget.

id
string

Unique session identifier (e.g., sess_xyz789).

agent_id
string

Agent whose wallet funds the session.

budget_limit
string

Maximum total amount the session can spend.

budget_spent
string

Total amount spent so far.

budget_remaining
string

Remaining budget available.

chain
string

CAIP-2 chain identifier for settlement.

status
enum<string>

Session status.

可用選項:
active,
expired,
deleted
allowed_urls
string<uri>[]

URLs this session is authorized to pay.

expires_at
string<date-time>

ISO 8601 expiration timestamp.

created_at
string<date-time>

ISO 8601 creation timestamp.