Skip to main content

Servers

ASDO: x402 Payment:

Endpoints

Transaction Router

POST / (eth_routerTransaction)

Constructs the correct original transaction parameters before sending it to the right chain. Request Body (RouterTransaction):
  • from (string): The address from which the transaction is sent
  • to (string): The address the transaction is directed to
  • data (string): The compiled code of a contract or the hash of the invoked method signature and encoded parameters
  • value (string): The integer of the value sent with this transaction, in wei
Response (RouterTransactionRes):
  • chainId (string): The hex value of the matched chain ID
  • nonce (string): The integer of a nonce
  • gasLimit (string): Estimated gas limit
  • maxFeePerGas (string): Max gas fee
  • maxPriorityFeePerGas (string): Priority fee

x402 Payment Protocol

GET /supported

Get supported network and payment methods. Response:
  • Returns a list of supported payment kinds (e.g., mesherX, mesherX-testnet).

POST /settle

Settle x402 payments. Request Body:
  • x402Version: Protocol version
  • paymentPayload: The payment payload (EVM or Solana)
  • paymentRequirements: Requirements expected by the resource server
Response:
  • Returns success status and transaction details.

POST /verify

Verify x402 payment validity. Request Body:
  • Similar structure to /settle
Response:
  • Returns isValid boolean and payer address.

OpenAPI Specification

{
  "openapi": "3.1.0",
  "info": {
    "title": "Algen API",
    "description": "Some important api listed in there",
    "license": {
      "name": "MIT"
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://asdo.algen.network"
    }
  ],
  "paths": {
    "/": {
      "post": {
        "servers": [
          {
            "url": "https://asdo.algen.network",
            "description": "Transaction router server"
          }
        ],
        "description": "Construct the correct original transaction before sending it to the right chain.",
        "requestBody": {
          "description": "eth_routerTransaction",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RouterTransaction"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Original transaction object",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouterTransactionRes"
                }
              }
            }
          },
          "400": {
            "description": "unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/supported": {
      "get": {
        "servers": [
          {
            "url": "https://x402.algen.network/facilitator",
            "description": "x402 supported API"
          }
        ],
        "description": "Get supported network and pay method",
        "responses": {
          "200": {
            "description": "Successfully retrieved supported payment kinds for the x402 protocol.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "kinds"
                  ],
                  "properties": {
                    "kinds": {
                      "type": "array",
                      "description": "The list of supported payment kinds.",
                      "items": {
                        "$ref": "#/components/schemas/x402SupportedPaymentKind"
                      },
                      "example": [
                        {
                          "x402Version": 1,
                          "scheme": "exact",
                          "network": "mesherX"
                        },
                        {
                          "x402Version": 1,
                          "scheme": "exact",
                          "network": "mesherX-testnet"
                        }
                      ]
                    }
                  }
                },
                "examples": {
                  "example": {
                    "value": {
                      "kinds": [
                        {
                          "x402Version": 1,
                          "scheme": "exact",
                          "network": "mesherX"
                        },
                        {
                          "x402Version": 1,
                          "scheme": "exact",
                          "network": "mesherX-testnet"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/settle": {
      "post": {
        "servers": [
          {
            "url": "https://x402.algen.network/facilitator",
            "description": "POST to settle x402 payments."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "x402Version": {
                      "$ref": "#/components/schemas/X402Version"
                    },
                    "paymentPayload": {
                      "$ref": "#/components/schemas/x402PaymentPayload"
                    },
                    "paymentRequirements": {
                      "$ref": "#/components/schemas/x402PaymentRequirements"
                    }
                  },
                  "required": [
                    "x402Version",
                    "paymentPayload",
                    "paymentRequirements"
                  ]
                }
              },
              "examples": {
                "example": {
                  "value": {
                    "x402Version": 1,
                    "paymentPayload": {
                      "x402Version": 1,
                      "scheme": "exact",
                      "network": "mesherX",
                      "payload": {
                        "signature": "0xf3746613c2d920b5fdabc0856f2aeb2d4f88ee6037b8cc5d04a71a4462f13480",
                        "authorization": {
                          "from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
                          "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
                          "value": "1000000000000000000",
                          "validAfter": "1716150000",
                          "validBefore": "1716150000",
                          "nonce": "0x1234567890abcdef1234567890abcdef12345678"
                        }
                      }
                    },
                    "paymentRequirements": {
                      "scheme": "exact",
                      "network": "mesherX",
                      "maxAmountRequired": "1000000",
                      "resource": "https://api.example.com/premium/resource/123",
                      "description": "Premium API access for data analysis",
                      "mimeType": "application/json",
                      "outputSchema": {
                        "data": "string"
                      },
                      "payTo": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
                      "maxTimeoutSeconds": 10,
                      "asset": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
                      "extra": {
                        "gasLimit": "1000000"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully settled payment on the x402 protocol.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "success": {
                        "type": "boolean",
                        "description": "Indicates whether the payment settlement is successful.",
                        "example": false
                      },
                      "errorReason": {
                        "$ref": "#/components/schemas/x402SettleErrorReason"
                      },
                      "payer": {
                        "type": "string",
                        "description": "The onchain address of the client paying for the resource.",
                        "pattern": "^0x[a-fA-F0-9]{40}|[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$",
                        "example": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
                      },
                      "transaction": {
                        "type": "string",
                        "description": "The settlement transaction hash.",
                        "pattern": "^0x[a-fA-F0-9]{40}|[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$",
                        "example": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
                      },
                      "network": {
                        "type": "string",
                        "description": "The network where settlement occurred.",
                        "example": "mesherX"
                      }
                    },
                    "required": [
                      "success",
                      "payer",
                      "transaction",
                      "network"
                    ]
                  }
                },
                "examples": {
                  "example": {
                    "value": {
                      "success": false,
                      "errorReason": "insufficient_funds",
                      "payer": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
                      "transaction": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
                      "network": "mesherX"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/verify": {
      "post": {
        "servers": [
          {
            "url": "https://x402.algen.network/facilitator",
            "description": "Verify x402 payment."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "x402Version": {
                    "$ref": "#/components/schemas/X402Version"
                  },
                  "paymentPayload": {
                    "$ref": "#/components/schemas/x402PaymentPayload"
                  },
                  "paymentRequirements": {
                    "$ref": "#/components/schemas/x402PaymentRequirements"
                  }
                },
                "required": [
                  "x402Version",
                  "paymentPayload",
                  "paymentRequirements"
                ]
              },
              "examples": {
                "example": {
                  "value": {
                    "x402Version": 1,
                    "paymentPayload": {
                      "x402Version": 1,
                      "scheme": "exact",
                      "network": "mesherX",
                      "payload": {
                        "signature": "0xf3746613c2d920b5fdabc0856f2aeb2d4f88ee6037b8cc5d04a71a4462f13480",
                        "authorization": {
                          "from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
                          "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
                          "value": "1000000000000000000",
                          "validAfter": "1716150000",
                          "validBefore": "1716150000",
                          "nonce": "0x1234567890abcdef1234567890abcdef12345678"
                        }
                      }
                    },
                    "paymentRequirements": {
                      "scheme": "exact",
                      "network": "mesherX",
                      "maxAmountRequired": "1000000",
                      "resource": "[https://api.example.com/premium/resource/123](https://api.example.com/premium/resource/123)",
                      "description": "Premium API access for data analysis",
                      "mimeType": "application/json",
                      "outputSchema": {
                        "data": "string"
                      },
                      "payTo": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
                      "maxTimeoutSeconds": 10,
                      "asset": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
                      "extra": {
                        "gasLimit": "1000000"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully verified payment on the x402 protocol.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "isValid": {
                      "type": "boolean",
                      "description": "Indicates whether the payment is valid.",
                      "example": false
                    },
                    "invalidReason": {
                      "$ref": "#/components/schemas/x402VerifyInvalidReason"
                    },
                    "payer": {
                      "type": "string",
                      "description": "The onchain address of the client that is paying for the resource.",
                      "pattern": "^0x[a-fA-F0-9]{40}|[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$",
                      "example": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
                    }
                  },
                  "required": [
                    "isValid",
                    "payer"
                  ]
                },
                "examples": {
                  "example": {
                    "value": {
                      "isValid": false,
                      "invalidReason": "insufficient_funds",
                      "payer": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "RouterTransaction": {
        "type": "object",
        "required": [
          "from",
          "to",
          "data",
          "value"
        ],
        "properties": {
          "from": {
            "type": "string",
            "description": "The address from which the transaction is sent"
          },
          "to": {
            "type": "string",
            "description": "The address the transaction is directed to"
          },
          "data": {
            "type": "string",
            "description": "The compiled code of a contract or the hash of the invoked method signature and encoded parameters"
          },
          "value": {
            "type": "string",
            "description": "The integer of the value sent with this transaction, in wei"
          }
        }
      },
      "RouterTransactionRes": {
        "type": "object",
        "required": [
          "nonce",
          "chainId",
          "gasLimit"
        ],
        "properties": {
          "nonce": {
            "type": "string",
            "description": "The integer nonce for the transaction"
          },
          "chainId": {
            "type": "string",
            "description": "Hex value of matched chain ID"
          },
          "gasLimit": {
            "type": "string",
            "description": "Estimated gas limit for this transaction"
          },
          "maxFeePerGas": {
            "type": "string",
            "description": "Max gas fee (EIP-1559)"
          },
          "maxPriorityFeePerGas": {
            "type": "string",
            "description": "Priority gas fee (EIP-1559)"
          },
          "gasPrice": {
            "type": "string",
            "description": "Gas price for legacy transactions"
          }
        }
      },
      "x402SupportedPaymentKind": {
        "type": "object",
        "required": [
          "x402Version",
          "scheme",
          "network"
        ],
        "properties": {
          "x402Version": {
            "type": "integer",
            "format": "int32",
            "description": "The version of the payment protocol"
          },
          "scheme": {
            "type": "string",
            "description": "The scheme of the payment protocol",
            "enum": [
              "exact"
            ],
            "example": "exact"
          },
          "network": {
            "type": "string",
            "description": "The network of the blockchain",
            "enum": [
              "mesherX",
              "mesherX-testnet"
            ],
            "example": "mesherX"
          }
        }
      },
      "Url": {
        "type": "string",
        "format": "uri",
        "minLength": 11,
        "maxLength": 2048,
        "pattern": "^https://.*$",
        "description": "A valid HTTPS URL.",
        "example": "https://example.com"
      },
      "X402Version": {
        "type": "integer",
        "description": "The version of the x402 protocol.",
        "enum": [
          1
        ],
        "example": 1
      },
      "x402ExactEvmPayload": {
        "type": "object",
        "title": "x402ExactEvmPayload",
        "description": "The x402 protocol exact scheme payload for EVM networks. Implemented using ERC-3009.",
        "properties": {
          "signature": {
            "type": "string",
            "description": "The EIP-712 hex-encoded signature of the ERC-3009 authorization message.",
            "example": "0xf3746613c2d920b5fdabc0856f2aeb2d4f88ee6037b8cc5d04a71a4462f13480"
          },
          "authorization": {
            "type": "object",
            "description": "The authorization data for the ERC-3009 message.",
            "properties": {
              "from": {
                "type": "string",
                "pattern": "^0x[0-9a-fA-F]{40}$",
                "description": "0x-prefixed, checksum EVM address of the sender.",
                "example": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
              },
              "to": {
                "type": "string",
                "pattern": "^0x[0-9a-fA-F]{40}$",
                "description": "0x-prefixed, checksum EVM address of the recipient.",
                "example": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
              },
              "value": {
                "type": "string",
                "description": "Value of the payment in atomic units.",
                "example": "1000000000000000000"
              },
              "validAfter": {
                "type": "string",
                "description": "Unix timestamp after which payment is valid.",
                "example": "1716150000"
              },
              "validBefore": {
                "type": "string",
                "description": "Unix timestamp before which payment is valid.",
                "example": "1716150000"
              },
              "nonce": {
                "type": "string",
                "description": "Hex-encoded nonce of the payment.",
                "example": "0x1234567890abcdef1234567890abcdef12345678"
              }
            },
            "required": [
              "from",
              "to",
              "value",
              "validAfter",
              "validBefore",
              "nonce"
            ],
            "example": {
              "from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
              "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
              "value": "1000000000000000000",
              "validAfter": "1716150000",
              "validBefore": "1716150000",
              "nonce": "0x1234567890abcdef1234567890abcdef12345678"
            }
          }
        },
        "required": [
          "signature",
          "authorization"
        ],
        "example": {
          "signature": "0xf3746613c2d920b5fdabc0856f2aeb2d4f88ee6037b8cc5d04a71a4462f13480",
          "authorization": {
            "from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
            "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
            "value": "1000000000000000000",
            "validAfter": "1716150000",
            "validBefore": "1716150000",
            "nonce": "0x1234567890abcdef1234567890abcdef12345678"
          }
        }
      },
      "x402PaymentPayload": {
        "type": "object",
        "description": "The x402 protocol payment payload attached to X-PAYMENT header.",
        "properties": {
          "x402Version": {
            "$ref": "#/components/schemas/X402Version"
          },
          "scheme": {
            "type": "string",
            "enum": [
              "exact"
            ],
            "example": "exact"
          },
          "network": {
            "type": "string",
            "enum": [
              "mesherX",
              "mesherX-testnet"
            ],
            "example": "mesherX"
          },
          "payload": {
            "type": "object",
            "oneOf": [
              {
                "$ref": "#/components/schemas/x402ExactEvmPayload"
              }
            ],
            "example": {
              "signature": "0xf3746613c2d920b5fdabc0856f2aeb2d4f88ee6037b8cc5d04a71a4462f13480",
              "authorization": {
                "from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
                "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
                "value": "1000000000000000000",
                "validAfter": "1716150000",
                "validBefore": "1716150000",
                "nonce": "0x1234567890abcdef1234567890abcdef12345678"
              }
            }
          }
        },
        "required": [
          "x402Version",
          "scheme",
          "network",
          "payload"
        ],
        "example": {
          "x402Version": 1,
          "scheme": "exact",
          "network": "mesherX",
          "payload": {
            "signature": "0xf3746613c2d920b5fdabc0856f2aeb2d4f88ee6037b8cc5d04a71a4462f13480",
            "authorization": {
              "from": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
              "to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
              "value": "1000000000000000000",
              "validAfter": "1716150000",
              "validBefore": "1716150000",
              "nonce": "0x1234567890abcdef1234567890abcdef12345678"
            }
          }
        }
      },
      "x402PaymentRequirements": {
        "type": "object",
        "description": "The payment requirements expected by the resource server.",
        "properties": {
          "scheme": {
            "type": "string",
            "enum": [
              "exact"
            ],
            "example": "exact"
          },
          "network": {
            "type": "string",
            "enum": [
              "mesherX",
              "mesherX-testnet"
            ],
            "example": "mesherX"
          },
          "maxAmountRequired": {
            "type": "string",
            "example": "1000000"
          },
          "resource": {
            "$ref": "#/components/schemas/Url",
            "example": "https://api.example.com/premium/resource/123"
          },
          "description": {
            "type": "string",
            "example": "Premium API access for data analysis"
          },
          "mimeType": {
            "type": "string",
            "example": "application/json"
          },
          "outputSchema": {
            "type": "object",
            "additionalProperties": true,
            "example": {
              "data": "string"
            }
          },
          "payTo": {
            "type": "string",
            "pattern": "^0x[a-fA-F0-9]{40}|[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$",
            "example": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
          },
          "maxTimeoutSeconds": {
            "type": "integer",
            "example": 10
          },
          "asset": {
            "type": "string",
            "pattern": "^0x[a-fA-F0-9]{40}|[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$",
            "example": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
          },
          "extra": {
            "type": "object",
            "additionalProperties": true,
            "example": {
              "gasLimit": "1000000"
            }
          }
        },
        "required": [
          "scheme",
          "network",
          "maxAmountRequired",
          "resource",
          "description",
          "mimeType",
          "payTo",
          "asset",
          "maxTimeoutSeconds"
        ]
      },
      "x402SettleErrorReason": {
        "type": "string",
        "description": "The reason the payment settlement errored on the x402 protocol.",
        "enum": [
          "insufficient_funds",
          "invalid_scheme",
          "invalid_network",
          "invalid_x402_version",
          "invalid_payment_requirements",
          "invalid_payload",
          "invalid_exact_evm_payload_authorization_value",
          "invalid_exact_evm_payload_authorization_valid_after",
          "invalid_exact_evm_payload_authorization_valid_before",
          "invalid_exact_evm_payload_authorization_typed_data_message",
          "invalid_exact_evm_payload_authorization_from_address_kyt",
          "invalid_exact_evm_payload_authorization_to_address_kyt",
          "invalid_exact_evm_payload_signature_address",
          "settle_exact_svm_block_height_exceeded",
          "settle_exact_svm_transaction_confirmation_timed_out"
        ],
        "example": "insufficient_funds"
      },
      "x402VerifyInvalidReason": {
        "type": "string",
        "description": "The reason the payment is invalid on the x402 protocol.",
        "enum": [
          "insufficient_funds",
          "invalid_scheme",
          "invalid_network",
          "invalid_x402_version",
          "invalid_payment_requirements",
          "invalid_payload",
          "invalid_exact_evm_payload_authorization_value",
          "invalid_exact_evm_payload_authorization_value_too_low",
          "invalid_exact_evm_payload_authorization_valid_after",
          "invalid_exact_evm_payload_authorization_valid_before",
          "invalid_exact_evm_payload_authorization_typed_data_message",
          "invalid_exact_evm_payload_authorization_from_address_kyt",
          "invalid_exact_evm_payload_authorization_to_address_kyt",
          "invalid_exact_evm_payload_signature",
          "invalid_exact_evm_payload_signature_address",
          "invalid_exact_svm_payload_transaction",
          "invalid_exact_svm_payload_transaction_amount_mismatch",
          "invalid_exact_svm_payload_transaction_create_ata_instruction",
          "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee",
          "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset",
          "invalid_exact_svm_payload_transaction_instructions",
          "invalid_exact_svm_payload_transaction_instructions_length",
          "invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction",
          "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction",
          "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high",
          "invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked",
          "invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked",
          "invalid_exact_svm_payload_transaction_not_a_transfer_instruction",
          "invalid_exact_svm_payload_transaction_cannot_derive_receiver_ata",
          "invalid_exact_svm_payload_transaction_receiver_ata_not_found",
          "invalid_exact_svm_payload_transaction_sender_ata_not_found",
          "invalid_exact_svm_payload_transaction_simulation_failed",
          "invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata",
          "invalid_exact_svm_payload_transaction_fee_payer_included_in_instruction_accounts",
          "invalid_exact_svm_payload_transaction_fee_payer_transferring_funds"
        ],
        "example": "insufficient_funds"
      },
      "Error": {
        "type": "object",
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "integer",
            "format": "int32"
          },
          "message": {
            "type": "string"
          }
        }
      }
    }
  }
}