{
  "openapi": "3.0.3",
  "info": {
    "title": "Umbrae Public Market Data",
    "version": "1.0.0",
    "description": "Read-only market data on Base (chain ID 8453). Select a venue server. Provider aliases expose the same data. This specification does not describe wallet signing, swaps or LP transaction building. Amounts are decimalized token-unit strings. Authored by GPT-6 via Codex, 2026-09-08."
  },
  "externalDocs": {
    "url": "https://www.umbrae.io/docs/integration.md"
  },
  "servers": [
    {
      "url": "https://www.umbrae.io/api/public/geckoterminal/damm",
      "description": "DAMM \u2014 swaps, joins and exits"
    },
    {
      "url": "https://www.umbrae.io/api/public/geckoterminal/dlmm",
      "description": "DLMM \u2014 curated pools, swaps only"
    },
    {
      "url": "https://www.umbrae.io/api/public/dexscreener/base/damm",
      "description": "DAMM \u2014 DEX Screener alias"
    },
    {
      "url": "https://www.umbrae.io/api/public/dexscreener/base/dlmm",
      "description": "DLMM \u2014 DEX Screener alias"
    }
  ],
  "security": [],
  "paths": {
    "/latest-block": {
      "get": {
        "operationId": "getLatestIndexedBlock",
        "summary": "Read the last indexed block",
        "responses": {
          "200": {
            "description": "Successful indexed data response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BlockResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamUnavailable"
          }
        }
      }
    },
    "/asset": {
      "get": {
        "operationId": "getAsset",
        "summary": "Read token metadata",
        "responses": {
          "200": {
            "description": "Successful indexed data response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssetResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "description": "ERC-20 token address.",
            "schema": {
              "$ref": "#/components/schemas/Address"
            }
          }
        ]
      }
    },
    "/pair": {
      "get": {
        "operationId": "getPair",
        "summary": "Read pool metadata",
        "responses": {
          "200": {
            "description": "Successful indexed data response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PairResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamUnavailable"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "description": "Pool address.",
            "schema": {
              "$ref": "#/components/schemas/Address"
            }
          }
        ]
      }
    },
    "/events": {
      "get": {
        "operationId": "getEvents",
        "summary": "Read indexed events in an inclusive block range",
        "responses": {
          "200": {
            "description": "Successful indexed data response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventsResponse"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamUnavailable"
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          }
        },
        "description": "DLMM returns swaps only for curated pools. DAMM returns swaps, joins and exits. toBlock must be >= fromBlock. Pagination is handled upstream; choose bounded backfill windows. Deduplicate by txnId and eventIndex. No finality guarantee.",
        "parameters": [
          {
            "name": "fromBlock",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "toBlock",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "Address": {
        "type": "string",
        "pattern": "^0x[0-9a-fA-F]{40}$"
      },
      "Block": {
        "type": "object",
        "required": [
          "blockNumber",
          "blockTimestamp"
        ],
        "properties": {
          "blockNumber": {
            "type": "integer",
            "minimum": 0
          },
          "blockTimestamp": {
            "type": "integer",
            "minimum": 0,
            "description": "Unix seconds."
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          }
        }
      },
      "Asset": {
        "type": "object",
        "required": [
          "id",
          "name",
          "symbol",
          "decimals"
        ],
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Address"
          },
          "name": {
            "type": "string"
          },
          "symbol": {
            "type": "string"
          },
          "decimals": {
            "type": "integer",
            "minimum": 0,
            "maximum": 255
          },
          "totalSupply": {
            "type": "string",
            "description": "Decimalized token units; preserve precision. Scientific notation can occur."
          }
        }
      },
      "Pair": {
        "type": "object",
        "required": [
          "id",
          "dexKey",
          "asset0Id",
          "asset1Id"
        ],
        "properties": {
          "id": {
            "$ref": "#/components/schemas/Address"
          },
          "dexKey": {
            "type": "string",
            "enum": [
              "umbrae-damm",
              "umbrae-dlmm"
            ]
          },
          "asset0Id": {
            "$ref": "#/components/schemas/Address"
          },
          "asset1Id": {
            "$ref": "#/components/schemas/Address"
          },
          "createdAtBlockNumber": {
            "type": "integer",
            "minimum": 0
          },
          "createdAtBlockTimestamp": {
            "type": "integer",
            "minimum": 0
          },
          "createdAtTxnId": {
            "type": "string"
          },
          "feeBps": {
            "type": "number",
            "minimum": 0,
            "description": "DLMM base fee or DAMM dynamic fee; not an executable quote."
          },
          "metadata": {
            "type": "object",
            "required": [
              "binStep"
            ],
            "properties": {
              "binStep": {
                "type": "string",
                "description": "DLMM bin spacing in basis points; not the swap fee."
              }
            }
          }
        }
      },
      "EventBase": {
        "type": "object",
        "required": [
          "block",
          "txnId",
          "txnIndex",
          "eventIndex",
          "maker",
          "pairId",
          "reserves"
        ],
        "properties": {
          "block": {
            "$ref": "#/components/schemas/Block"
          },
          "txnId": {
            "type": "string"
          },
          "txnIndex": {
            "type": "integer",
            "enum": [
              0
            ],
            "description": "Placeholder. Use eventIndex for ordering."
          },
          "eventIndex": {
            "type": "integer",
            "minimum": 0
          },
          "maker": {
            "$ref": "#/components/schemas/Address"
          },
          "pairId": {
            "$ref": "#/components/schemas/Address"
          },
          "reserves": {
            "type": "object",
            "required": [
              "asset0",
              "asset1"
            ],
            "properties": {
              "asset0": {
                "type": "string",
                "description": "Decimalized token units; preserve precision. Scientific notation can occur."
              },
              "asset1": {
                "type": "string",
                "description": "Decimalized token units; preserve precision. Scientific notation can occur."
              }
            },
            "description": "Pair state supplied by the indexer when queried; not verified historical post-event reserves."
          }
        }
      },
      "SwapEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/EventBase"
          },
          {
            "type": "object",
            "required": [
              "eventType",
              "priceNative"
            ],
            "properties": {
              "eventType": {
                "type": "string",
                "enum": [
                  "swap"
                ]
              },
              "asset0In": {
                "type": "string",
                "description": "Decimalized token units; preserve precision. Scientific notation can occur."
              },
              "asset1In": {
                "type": "string",
                "description": "Decimalized token units; preserve precision. Scientific notation can occur."
              },
              "asset0Out": {
                "type": "string",
                "description": "Decimalized token units; preserve precision. Scientific notation can occur."
              },
              "asset1Out": {
                "type": "string",
                "description": "Decimalized token units; preserve precision. Scientific notation can occur."
              },
              "priceNative": {
                "type": "string",
                "description": "Trade token-1 amount / token-0 amount, not USD or a live quote."
              }
            }
          }
        ]
      },
      "LiquidityEvent": {
        "description": "DAMM only. DLMM adapters expose swap events only.",
        "allOf": [
          {
            "$ref": "#/components/schemas/EventBase"
          },
          {
            "type": "object",
            "required": [
              "eventType",
              "amount0",
              "amount1"
            ],
            "properties": {
              "eventType": {
                "type": "string",
                "enum": [
                  "join",
                  "exit"
                ]
              },
              "amount0": {
                "type": "string",
                "description": "Decimalized token units; preserve precision. Scientific notation can occur."
              },
              "amount1": {
                "type": "string",
                "description": "Decimalized token units; preserve precision. Scientific notation can occur."
              }
            }
          }
        ]
      },
      "BlockResponse": {
        "type": "object",
        "required": [
          "block"
        ],
        "properties": {
          "block": {
            "$ref": "#/components/schemas/Block"
          }
        }
      },
      "AssetResponse": {
        "type": "object",
        "required": [
          "asset"
        ],
        "properties": {
          "asset": {
            "$ref": "#/components/schemas/Asset"
          }
        }
      },
      "PairResponse": {
        "type": "object",
        "required": [
          "pair"
        ],
        "properties": {
          "pair": {
            "$ref": "#/components/schemas/Pair"
          }
        }
      },
      "EventsResponse": {
        "type": "object",
        "required": [
          "events"
        ],
        "properties": {
          "events": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/SwapEvent"
                },
                {
                  "$ref": "#/components/schemas/LiquidityEvent"
                }
              ]
            },
            "description": "Ordered by block number and eventIndex; an empty array is valid."
          }
        }
      }
    },
    "responses": {
      "InvalidRequest": {
        "description": "Missing or invalid query parameter.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "Unknown or unlisted asset or pool.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "UpstreamUnavailable": {
        "description": "Upstream unavailable. Back off and retry; do not advance the indexing cursor.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Rate limit reached. Honor Retry-After before retrying.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "headers": {
          "Retry-After": {
            "description": "Seconds before retrying.",
            "schema": {
              "type": "string"
            }
          },
          "X-RateLimit-Limit": {
            "schema": {
              "type": "string"
            }
          },
          "X-RateLimit-Remaining": {
            "schema": {
              "type": "string"
            }
          },
          "X-RateLimit-Reset": {
            "description": "Reset time in Unix milliseconds.",
            "schema": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}
