{
  "openapi": "3.2.0",
  "info": {
    "title": "getTipFloor",
    "version": "1",
    "description": "Read an edge's observed landed-tip percentiles with getTipFloor or GET /tip_floor and interpret the snapshot."
  },
  "servers": [
    {
      "url": "https://ams.tpu.supanode.xyz"
    },
    {
      "url": "https://fra.tpu.supanode.xyz"
    },
    {
      "url": "https://la.tpu.supanode.xyz"
    },
    {
      "url": "https://lon.tpu.supanode.xyz"
    },
    {
      "url": "https://ny.tpu.supanode.xyz"
    },
    {
      "url": "https://toy.tpu.supanode.xyz"
    }
  ],
  "security": [
    {
      "apiKeyHeader": []
    },
    {
      "apiKeyQuery": []
    },
    {
      "bearer": []
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKeyHeader": {
        "$ref": "#/x-ext/b08d7c8/components/securitySchemes/apiKeyHeader"
      },
      "apiKeyQuery": {
        "$ref": "#/x-ext/b08d7c8/components/securitySchemes/apiKeyQuery"
      },
      "bearer": {
        "$ref": "#/x-ext/b08d7c8/components/securitySchemes/bearer"
      }
    }
  },
  "paths": {
    "/": {
      "post": {
        "operationId": "getTipFloor",
        "summary": "getTipFloor",
        "description": "Read an edge's observed landed-tip percentiles with getTipFloor. Your key's minimum tip still applies.",
        "requestBody": {
          "required": true,
          "description": "One JSON object using the [shared request conventions](https://supanode.xyz/docs/solana/sender/reference/json-rpc#request). The method takes no params.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "jsonrpc",
                  "method"
                ],
                "properties": {
                  "jsonrpc": {
                    "$ref": "#/x-ext/b08d7c8/components/schemas/JsonRpcVersion"
                  },
                  "id": {
                    "$ref": "#/x-ext/b08d7c8/components/schemas/JsonRpcId"
                  },
                  "method": {
                    "type": "string",
                    "enum": [
                      "getTipFloor"
                    ]
                  },
                  "params": {
                    "description": "Ignored when present."
                  }
                }
              },
              "examples": {
                "Request": {
                  "value": {
                    "jsonrpc": "2.0",
                    "id": 1,
                    "method": "getTipFloor"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Returns an array of zero or one observed tip-floor snapshots in `result`; an empty array means no recent landing data.\n\nRefusals with HTTP 200, by `error.data.reason`:\n\n- [`invalid_request`](https://supanode.xyz/docs/solana/sender/reference/errors#invalid_request): invalid JSON-RPC body.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "required": [
                        "jsonrpc",
                        "result",
                        "id"
                      ],
                      "properties": {
                        "jsonrpc": {
                          "$ref": "#/x-ext/b08d7c8/components/schemas/JsonRpcVersion"
                        },
                        "result": {
                          "$ref": "#/x-ext/b08d7c8/components/schemas/TipFloor"
                        },
                        "id": {
                          "$ref": "#/x-ext/b08d7c8/components/schemas/JsonRpcId"
                        }
                      },
                      "additionalProperties": false
                    },
                    {
                      "$ref": "#/x-ext/b08d7c8/components/schemas/JsonRpcErrorEnvelope"
                    }
                  ]
                },
                "examples": {
                  "Success": {
                    "summary": "Success",
                    "value": {
                      "jsonrpc": "2.0",
                      "result": [],
                      "id": 1
                    }
                  },
                  "ParseError": {
                    "$ref": "#/x-ext/b08d7c8/components/examples/ParseError"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/x-ext/b08d7c8/components/responses/Unauthorized"
          },
          "421": {
            "$ref": "#/x-ext/b08d7c8/components/responses/MisdirectedRequest"
          }
        },
        "x-codeSamples": [
          {
            "lang": "rust",
            "id": "rust",
            "label": "Rust",
            "source": "// Builds on the example project (https://supanode.xyz/docs/solana/sender/reference/json-rpc#example-project).\nuse serde::Deserialize;\nuse swqos_examples::swqos::{Result, call};\n\n#[derive(Deserialize)]\nstruct TipFloor {\n    time: String,\n    landed_tips_50th_percentile: u64,\n}\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let floors: Vec<TipFloor> = call(\"getTipFloor\", None).await?;\n    if let Some(floor) = floors.first() {\n        println!(\n            \"{}: median landed tip {} lamports\",\n            floor.time, floor.landed_tips_50th_percentile\n        );\n    } else {\n        println!(\"no recent landing data\");\n    }\n    Ok(())\n}"
          },
          {
            "lang": "go",
            "id": "go",
            "label": "Go",
            "source": "// Builds on the example project (https://supanode.xyz/docs/solana/sender/reference/json-rpc#example-project).\npackage swqos\n\nimport (\n\t\"context\"\n\t\"fmt\"\n)\n\ntype TipFloor struct {\n\tTime         string `json:\"time\"`\n\tPercentile25 uint64 `json:\"landed_tips_25th_percentile\"`\n\tPercentile50 uint64 `json:\"landed_tips_50th_percentile\"`\n\tPercentile75 uint64 `json:\"landed_tips_75th_percentile\"`\n\tPercentile95 uint64 `json:\"landed_tips_95th_percentile\"`\n\tPercentile99 uint64 `json:\"landed_tips_99th_percentile\"`\n}\n\nfunc PrintTipFloor(ctx context.Context) error {\n\tfloors, err := Call[[]TipFloor](ctx, \"getTipFloor\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(floors) > 0 {\n\t\tfloor := floors[0]\n\t\tfmt.Printf(\"%s: median landed tip %d lamports\\n\", floor.Time, floor.Percentile50)\n\t} else {\n\t\tfmt.Println(\"no recent landing data\")\n\t}\n\treturn nil\n}"
          },
          {
            "lang": "ts",
            "id": "ts",
            "label": "TypeScript",
            "source": "// Builds on the example project (https://supanode.xyz/docs/solana/sender/reference/json-rpc#example-project).\nimport { call } from './swqos.ts'\n\ntype TipFloor = {\n  time: string\n  landed_tips_25th_percentile: number\n  landed_tips_50th_percentile: number\n  landed_tips_75th_percentile: number\n  landed_tips_95th_percentile: number\n  landed_tips_99th_percentile: number\n}\n\nconst [floor] = await call<TipFloor[]>('getTipFloor')\nif (floor) console.log(`${floor.time}: median landed tip ${floor.landed_tips_50th_percentile} lamports`)\nelse console.log('no recent landing data')"
          }
        ]
      }
    },
    "/tip_floor": {
      "get": {
        "operationId": "getTipFloorRoute",
        "summary": "Get the tip floor",
        "description": "Read an edge's observed landed-tip percentiles as a JSON array, without a JSON-RPC envelope.",
        "responses": {
          "200": {
            "description": "Returns an array of zero or one observed tip-floor snapshots as an `application/json` array, without a JSON-RPC envelope. An empty array means no recent landing data is available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/x-ext/b08d7c8/components/schemas/TipFloor"
                },
                "examples": {
                  "NoRecentData": {
                    "value": []
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/x-ext/b08d7c8/components/responses/RawUnauthorized"
          },
          "421": {
            "$ref": "#/x-ext/b08d7c8/components/responses/MisdirectedRequest"
          }
        },
        "x-codeSamples": [
          {
            "lang": "rust",
            "id": "rust",
            "label": "Rust",
            "source": "// src/bin/http_tip_floor.rs\n// Builds on the example project (https://supanode.xyz/docs/solana/sender/reference/json-rpc#example-project).\nuse serde::Deserialize;\nuse swqos_examples::swqos::{Result, required, url};\n\n#[derive(Deserialize)]\nstruct TipFloor {\n    time: String,\n    landed_tips_50th_percentile: u64,\n}\n\n#[tokio::main]\nasync fn main() -> Result<()> {\n    let mut endpoint = reqwest::Url::parse(&url())?;\n    endpoint.set_path(\"/tip_floor\");\n    endpoint.set_query(None);\n    let response = reqwest::Client::new().get(endpoint)\n        .header(\"x-api-key\", required(\"SWQOS_API_KEY\")?)\n        .send().await?;\n    let status = response.status();\n    let body = response.text().await?;\n    if !status.is_success() {\n        return Err(format!(\"HTTP {status}: {body}\").into());\n    }\n    let floors: Vec<TipFloor> = serde_json::from_str(&body)?;\n    if let Some(floor) = floors.first() {\n        println!(\"{}: median landed tip {} lamports\", floor.time, floor.landed_tips_50th_percentile);\n    } else {\n        println!(\"no recent landing data\");\n    }\n    Ok(())\n}"
          },
          {
            "lang": "go",
            "id": "go",
            "label": "Go",
            "source": "// http_tip_floor/main.go\npackage main\n\nimport (\n    \"encoding/json\"\n    \"fmt\"\n    \"io\"\n    \"net/http\"\n    \"net/url\"\n    \"os\"\n\n    swqos \"swqos-examples\"\n)\n\ntype TipFloor struct {\n    Time string `json:\"time\"`\n    Percentile50 uint64 `json:\"landed_tips_50th_percentile\"`\n}\n\nfunc run() error {\n    apiKey, err := swqos.Required(\"SWQOS_API_KEY\")\n    if err != nil {\n        return err\n    }\n    endpoint, err := url.Parse(swqos.URL())\n    if err != nil {\n        return err\n    }\n    endpoint.Path = \"/tip_floor\"\n    endpoint.RawQuery = \"\"\n    request, err := http.NewRequest(http.MethodGet, endpoint.String(), nil)\n    if err != nil {\n        return err\n    }\n    request.Header.Set(\"x-api-key\", apiKey)\n    response, err := http.DefaultClient.Do(request)\n    if err != nil {\n        return err\n    }\n    defer response.Body.Close()\n    body, err := io.ReadAll(response.Body)\n    if err != nil {\n        return err\n    }\n    if response.StatusCode < 200 || response.StatusCode >= 300 {\n        return fmt.Errorf(\"HTTP %d: %s\", response.StatusCode, body)\n    }\n    var floors []TipFloor\n    if err := json.Unmarshal(body, &floors); err != nil {\n        return err\n    }\n    if len(floors) == 0 {\n        fmt.Println(\"no recent landing data\")\n    } else {\n        fmt.Printf(\"%s: median landed tip %d lamports\\n\", floors[0].Time, floors[0].Percentile50)\n    }\n    return nil\n}\n\nfunc main() {\n    if err := run(); err != nil {\n        fmt.Fprintln(os.Stderr, err)\n        os.Exit(1)\n    }\n}"
          },
          {
            "lang": "ts",
            "id": "ts",
            "label": "TypeScript",
            "source": "// http-tip-floor.ts\nimport { required, url } from './swqos.ts'\n\ntype TipFloor = { time: string; landed_tips_50th_percentile: number }\n\nconst endpoint = new URL('/tip_floor', url)\nconst response = await fetch(endpoint, { headers: { 'x-api-key': required('SWQOS_API_KEY') } })\nconst body = await response.text()\nif (!response.ok) throw new Error(`HTTP ${response.status}: ${body}`)\nconst [floor] = JSON.parse(body) as TipFloor[]\nif (floor) console.log(`${floor.time}: median landed tip ${floor.landed_tips_50th_percentile} lamports`)\nelse console.log('no recent landing data')"
          }
        ]
      }
    }
  },
  "x-ext": {
    "b08d7c8": {
      "components": {
        "schemas": {
          "Rejection": {
            "type": "object",
            "required": [
              "reason",
              "message",
              "retryable"
            ],
            "properties": {
              "reason": {
                "type": "string",
                "description": "Stable snake_case reason. Match on this; `message` wording can change, and the numeric codes are shared with Solana's RPC.",
                "examples": [
                  "missing_tip"
                ]
              },
              "message": {
                "type": "string",
                "description": "What happened and what to change. Wording can change.",
                "examples": [
                  "tip too small: the tip transfers add up to 123 lamports, the minimum is 1,000,000; raise the transfer to one of the tip accounts to at least 1,000,000 lamports"
                ]
              },
              "retryable": {
                "type": "boolean",
                "description": "Whether the unchanged request can succeed later. Wait before retrying, and check that the transaction has not expired.",
                "examples": [
                  false
                ]
              },
              "docs": {
                "type": "string",
                "format": "uri",
                "description": "Optional error documentation URL followed by the reason anchor. Supanode endpoints omit this field.",
                "examples": [
                  "https://supanode.xyz/docs/solana/sender/reference/errors#missing_tip"
                ]
              }
            },
            "additionalProperties": true,
            "description": "Reason-specific fields are included alongside these members, such as minimum, found, declared, available, unpaid_lamports, index, per_second and retry_after_ms. Failed preflight also includes Solana simulation fields such as err, logs and unitsConsumed.",
            "examples": [
              {
                "reason": "missing_tip",
                "minimum": 1000000,
                "found": 123,
                "message": "tip too small: the tip transfers add up to 123 lamports, the minimum is 1,000,000; raise the transfer to one of the tip accounts to at least 1,000,000 lamports",
                "retryable": false,
                "docs": "https://supanode.xyz/docs/solana/sender/reference/errors#missing_tip"
              }
            ]
          },
          "JsonRpcVersion": {
            "type": "string",
            "enum": [
              "2.0"
            ],
            "examples": [
              "2.0"
            ]
          },
          "JsonRpcError": {
            "type": "object",
            "required": [
              "code",
              "message",
              "data"
            ],
            "properties": {
              "code": {
                "type": "integer",
                "enum": [
                  -32700,
                  -32600,
                  -32601,
                  -32602,
                  -32603,
                  -32000,
                  -32001,
                  -32002,
                  -32003
                ],
                "description": "[Status codes](https://supanode.xyz/docs/solana/sender/reference/json-rpc#status-codes) maps reasons and problems to codes. Match on `data.reason`.",
                "examples": [
                  -32602
                ]
              },
              "message": {
                "type": "string",
                "description": "The same sentence as data.message."
              },
              "data": {
                "$ref": "#/x-ext/b08d7c8/components/schemas/Rejection"
              }
            },
            "additionalProperties": false
          },
          "JsonRpcId": {
            "type": [
              "string",
              "number",
              "null"
            ],
            "description": "Optional request id, echoed exactly in the response. Null when absent or refused before the id could be read.",
            "examples": [
              1,
              "request-1",
              null
            ]
          },
          "JsonRpcErrorEnvelope": {
            "type": "object",
            "required": [
              "jsonrpc",
              "error",
              "id"
            ],
            "properties": {
              "jsonrpc": {
                "$ref": "#/x-ext/b08d7c8/components/schemas/JsonRpcVersion"
              },
              "error": {
                "$ref": "#/x-ext/b08d7c8/components/schemas/JsonRpcError"
              },
              "id": {
                "$ref": "#/x-ext/b08d7c8/components/schemas/JsonRpcId"
              }
            },
            "additionalProperties": false
          },
          "TipFloor": {
            "type": "array",
            "maxItems": 1,
            "items": {
              "type": "object",
              "required": [
                "time",
                "landed_tips_25th_percentile",
                "landed_tips_50th_percentile",
                "landed_tips_75th_percentile",
                "landed_tips_95th_percentile",
                "landed_tips_99th_percentile"
              ],
              "properties": {
                "time": {
                  "type": "string",
                  "format": "date-time",
                  "description": "When the snapshot was computed, RFC 3339 in UTC, to the second."
                },
                "landed_tips_25th_percentile": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "The edge's 25th landed-tip percentile, in lamports."
                },
                "landed_tips_50th_percentile": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "The edge's 50th landed-tip percentile, in lamports."
                },
                "landed_tips_75th_percentile": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "The edge's 75th landed-tip percentile, in lamports."
                },
                "landed_tips_95th_percentile": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "The edge's 95th landed-tip percentile, in lamports."
                },
                "landed_tips_99th_percentile": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "The edge's 99th landed-tip percentile, in lamports."
                }
              }
            },
            "description": "Zero or one tip floor snapshot; an empty array means no recent landing data is available. The snapshot describes tips that already landed and does not predict landing; your key's [minimum tip](https://supanode.xyz/docs/solana/sender/tips#minimum-tip) still applies. Each metro reports its own values; use a named [metro hostname](https://supanode.xyz/docs/solana/sender/endpoints#regions) to compare them.",
            "examples": [
              []
            ]
          }
        },
        "securitySchemes": {
          "apiKeyHeader": {
            "type": "apiKey",
            "in": "header",
            "name": "x-api-key",
            "description": "Send the SWQoS API key in this header. See the [authentication reference](https://supanode.xyz/docs/solana/sender/reference/json-rpc#authentication) for compatibility forms and precedence."
          },
          "apiKeyQuery": {
            "type": "apiKey",
            "in": "query",
            "name": "api-key",
            "description": "Compatibility authentication. See the [authentication reference](https://supanode.xyz/docs/solana/sender/reference/json-rpc#authentication) for precedence and the URL logging warning. Prefer x-api-key."
          },
          "bearer": {
            "type": "http",
            "scheme": "bearer",
            "description": "SWQoS API key sent as Authorization: Bearer YOUR_KEY. The prefix `Bearer ` is case-sensitive. Prefer x-api-key. See the [authentication reference](https://supanode.xyz/docs/solana/sender/reference/json-rpc#authentication) for precedence."
          }
        },
        "examples": {
          "ParseError": {
            "summary": "Invalid JSON",
            "value": {
              "jsonrpc": "2.0",
              "error": {
                "code": -32700,
                "message": "the body is not valid JSON",
                "data": {
                  "reason": "invalid_request",
                  "problem": "parse_error",
                  "message": "the body is not valid JSON",
                  "retryable": false,
                  "docs": "https://supanode.xyz/docs/solana/sender/reference/errors#invalid_request"
                }
              },
              "id": null
            }
          }
        },
        "responses": {
          "Unauthorized": {
            "description": "[`unauthorized`](https://supanode.xyz/docs/solana/sender/reference/errors#unauthorized): missing, unknown or revoked API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/x-ext/b08d7c8/components/schemas/JsonRpcErrorEnvelope"
                },
                "examples": {
                  "unauthorized": {
                    "value": {
                      "jsonrpc": "2.0",
                      "error": {
                        "code": -32000,
                        "message": "API key missing or not recognized; pass it as the api-key query parameter, an x-api-key header or Authorization: Bearer",
                        "data": {
                          "reason": "unauthorized",
                          "message": "API key missing or not recognized; pass it as the api-key query parameter, an x-api-key header or Authorization: Bearer",
                          "retryable": false,
                          "docs": "https://supanode.xyz/docs/solana/sender/reference/errors#unauthorized"
                        }
                      },
                      "id": null
                    }
                  }
                }
              }
            }
          },
          "MisdirectedRequest": {
            "description": "Unknown or removed TLS SNI or HTTP Host/:authority. Returns plain text without a JSON-RPC envelope or rejection object. The current hostname policy also applies to existing connections and resumed TLS sessions.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                },
                "examples": {
                  "UnknownHost": {
                    "value": "This hostname is not served here. Check the endpoint address"
                  }
                }
              }
            }
          },
          "RawUnauthorized": {
            "description": "[`unauthorized`](https://supanode.xyz/docs/solana/sender/reference/errors#unauthorized): missing, unknown or revoked API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/x-ext/b08d7c8/components/schemas/Rejection"
                },
                "examples": {
                  "unauthorized": {
                    "value": {
                      "reason": "unauthorized",
                      "message": "API key missing or not recognized; pass it as the api-key query parameter, an x-api-key header or Authorization: Bearer",
                      "retryable": false,
                      "docs": "https://supanode.xyz/docs/solana/sender/reference/errors#unauthorized"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
