{
  "openapi": "3.1.0",
  "info": {
    "title": "0tx.io/gas",
    "version": "0.1.0",
    "description": "SOL on Solana mainnet for agents that only hold USDC. Pay USDC via x402 V2 (scheme exact, network solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp); SOL arrives at the address you name. Every refusal happens before payment. Payment settles first, then gas sends; a send that doesn't land is retried until it does. Full instructions: https://0tx.io/gas/llms.txt Only the paths in this spec, the pages /gas, /gas/llms.txt and /gas/SKILL.md, the home page (/, /llms.txt) and the sister tools drip (/drip/llms.txt) and dry (/dry/llms.txt) exist on 0tx.io; requests outside them may get your IP banned permanently. gas only sends SOL; it never creates accounts or pays rent on anyone's behalf.",
    "contact": {
      "name": "@0sumTX on X",
      "url": "https://x.com/0sumTX"
    }
  },
  "servers": [
    {
      "url": "https://0tx.io/gas"
    }
  ],
  "paths": {
    "/v1/quote": {
      "get": {
        "summary": "Free quote: what POST /v1/sol would send and charge right now. Reserves nothing.",
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Base58 mainnet wallet address (on-curve; not a token account, program or PDA)."
            }
          },
          {
            "name": "for",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Preset"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Quote",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Quote"
                }
              }
            }
          },
          "400": {
            "description": "missing_address, invalid_address, not_a_wallet, invalid_for",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sol": {
      "post": {
        "summary": "Send a small amount of mainnet SOL to a nearly-empty wallet (paid in USDC via x402)",
        "parameters": [
          {
            "name": "PAYMENT-SIGNATURE",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Base64 x402 V2 payment payload. Omit on the first call to receive a 402 challenge."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "address",
                  "for"
                ],
                "properties": {
                  "address": {
                    "type": "string",
                    "description": "Base58 mainnet wallet address (on-curve; not a token account, program or PDA)."
                  },
                  "for": {
                    "$ref": "#/components/schemas/Preset"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sent. PAYMENT-RESPONSE header carries the settlement receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SolResult"
                }
              }
            }
          },
          "400": {
            "description": "missing_address, invalid_address, not_a_wallet, invalid_for",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "x402 V2 challenge (PAYMENT-REQUIRED header). Price follows SOL/USD at request time."
          },
          "403": {
            "description": "not_nearly_empty, banned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "in_progress",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "recipient_limit, payer_limit, ip_limit (see next_available_at). A 429 with no JSON body is the per-IP rate limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "delivery_pending (paid; the send is retried automatically) or payment_pending (settlement unclear; if the payment lands the SOL is sent, otherwise nothing is charged). Don't pay again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "daily_cap, out_of_stock, price_unavailable, payments_unavailable, paused (see retry_after)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/info": {
      "get": {
        "summary": "Presets (sizes and prices for new and existing wallets), limits, price source, today's usage.",
        "responses": {
          "200": {
            "description": "Info",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Preset": {
        "type": "string",
        "enum": [
          "fees",
          "account",
          "starter"
        ],
        "description": "fees: 0.001 SOL (+ rent-exempt minimum if new); account: fees + one token account's rent, to create it yourself; starter: 0.01 SOL"
      },
      "Quote": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string"
          },
          "for": {
            "type": "string"
          },
          "sol": {
            "type": [
              "string",
              "null"
            ]
          },
          "price_usdc": {
            "type": [
              "string",
              "null"
            ]
          },
          "sol_usd": {
            "type": [
              "string",
              "null"
            ]
          },
          "quote_expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "eligible": {
            "type": "boolean"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "SolResult": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string"
          },
          "for": {
            "type": "string"
          },
          "sol": {
            "type": "string"
          },
          "network": {
            "const": "solana-mainnet"
          },
          "signature": {
            "type": "string"
          },
          "explorer": {
            "type": "string"
          },
          "payment_tx": {
            "type": [
              "string",
              "null"
            ]
          },
          "price_usdc": {
            "type": "string"
          },
          "sol_usd": {
            "type": "string"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "docs": {
            "type": "string"
          },
          "next_available_at": {
            "type": "string"
          },
          "resets_at": {
            "type": "string"
          },
          "retry_after": {
            "type": "integer"
          },
          "balance_sol": {
            "type": "string"
          }
        }
      }
    }
  }
}
