Skip to main content

Config File

The bankr.x402.json file defines your x402 Cloud services — pricing, methods, and schemas for agent discovery.

Created automatically by bankr x402 init and updated by bankr x402 add and bankr x402 configure.

Example

{
"network": "base",
"currency": "USDC",
"services": {
"weather": {
"description": "Real-time weather data for any city",
"price": "0.001",
"methods": ["GET"],
"category": "data",
"tags": ["weather", "forecast"],
"schema": {
"input": {
"type": "object",
"properties": {
"city": { "type": "string", "description": "City name" },
"units": { "type": "string", "description": "Temperature units", "enum": ["celsius", "fahrenheit"] }
},
"required": ["city"]
},
"output": {
"type": "object",
"properties": {
"temperature": { "type": "number", "description": "Current temperature" },
"conditions": { "type": "string", "description": "Weather conditions" }
}
}
}
},
"sentiment": {
"description": "AI-powered sentiment analysis",
"price": "0.01",
"methods": ["POST"],
"schema": {
"input": {
"type": "object",
"properties": {
"text": { "type": "string", "description": "Text to analyze" }
},
"required": ["text"]
},
"output": {
"type": "object",
"properties": {
"sentiment": { "type": "string", "description": "positive, negative, or neutral" },
"score": { "type": "number", "description": "Sentiment score from -1 to 1" },
"confidence": { "type": "number", "description": "Confidence level 0-1" }
}
}
}
}
}
}

Top-Level Fields

FieldDefaultDescription
payToYour Bankr walletWallet address to receive payments
network"base"Blockchain network
currency"USDC"Token symbol (display only)
tokenAddressnull (USDC)ERC-20 contract address (only USDC is supported currently)

Service Fields

Each key in services is the service name. Names must be alphanumeric, hyphens, or underscores — max 47 characters.

FieldDefaultDescription
price"0.001"Price per request in the configured token (minimum: 0.000001)
descriptionHuman-readable description shown to agents during discovery
methods["GET", "POST"]Accepted HTTP methods
currencyInherits top-levelToken symbol (display only)
networkInherits top-levelBlockchain network
tokenAddressInherits top-levelERC-20 contract address
categoryCategory for discovery
tags[]Tags for discovery search
schemaInput/output schema for agent discovery (see below)

Service-level currency, network, and tokenAddress override the top-level defaults.

Schema

The schema field describes your service's inputs and outputs using JSON Schema so AI agents can discover and call your endpoint automatically.

The schema has two fields:

FieldDescription
inputJSON Schema object describing request parameters. For GET services, properties map to query params. For POST services, properties map to JSON body fields.
outputJSON Schema object describing the response shape.

Each schema is a JSON Schema object with properties, optional required array, and optional description on each property.

Supported JSON Schema properties

PropertyDescription
type"string", "number", "integer", "boolean", "array", "object"
descriptionHuman-readable description of the field
requiredArray of required property names (on the parent object)
enumArray of allowed values
itemsSchema for array items
propertiesNested object properties

GET service

For GET services, input properties are sent as query parameters:

{
"schema": {
"input": {
"type": "object",
"properties": {
"city": { "type": "string", "description": "City name" },
"units": { "type": "string", "description": "Temperature units", "enum": ["celsius", "fahrenheit"] }
},
"required": ["city"]
},
"output": {
"type": "object",
"properties": {
"temperature": { "type": "number" },
"conditions": { "type": "string" }
}
}
}
}

Callers send: GET /weather?city=London&units=celsius

POST service

For POST services, input properties are sent as a JSON body:

{
"schema": {
"input": {
"type": "object",
"properties": {
"text": { "type": "string", "description": "Text to analyze" },
"language": { "type": "string", "description": "ISO language code" }
},
"required": ["text"]
},
"output": {
"type": "object",
"properties": {
"sentiment": { "type": "string" },
"score": { "type": "number" }
}
}
}
}

Callers send: POST /sentiment with body {"text": "Hello world", "language": "en"}

Array and nested types

{
"schema": {
"input": {
"type": "object",
"properties": {
"symbols": {
"type": "array",
"items": { "type": "string" },
"description": "List of token symbols"
}
},
"required": ["symbols"]
},
"output": {
"type": "object",
"properties": {
"prices": {
"type": "array",
"items": {
"type": "object",
"properties": {
"symbol": { "type": "string" },
"price": { "type": "number" }
}
}
}
}
}
}
}
Backward Compatibility

The legacy queryParams, body, and input schema fields are still accepted for existing endpoints. New services should use the JSON Schema input/output format described above.