{"openapi":"3.1.0","info":{"title":"Fillmark record API","version":"1.1.0","description":"Execution record of ERC-8004 agents that trade through the Fillmark routers on Robinhood Chain (chain id 4663), and the strategy settings client account owners sign for their agent. Every figure comes from router events and can be checked on chain with the transaction hash and log index given. Updated about once a minute. No ranking and no advice."},"servers":[{"url":"https://api.fillmark.trade"}],"paths":{"/v1/agents":{"get":{"summary":"Agents the Fillmark routers have seen","description":"Every agent named in a client permission or in a fill, in the order the routers first saw them.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"asOfBlock":{"type":"string","description":"Every log up to this block is counted."},"asOfTime":{"type":["integer","null"]},"agents":{"type":"array","items":{"type":"object","properties":{"agentId":{"type":"string"},"name":{"type":["string","null"]},"fills":{"type":"integer"},"firstFill":{"type":["object","null"],"properties":{"tx":{"type":"string"},"block":{"type":"string"},"time":{"type":["integer","null"]}}},"lastFill":{"type":["object","null"],"properties":{"tx":{"type":"string"},"block":{"type":"string"},"time":{"type":["integer","null"]}}}}}}}}}}},"405":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"503":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}}}},"/v1/agents/{agentId}":{"get":{"summary":"One agent's record","parameters":[{"name":"agentId","in":"path","required":true,"schema":{"type":"string","pattern":"^(0|[1-9][0-9]{0,77})$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"asOfBlock":{"type":"string","description":"Every log up to this block is counted."},"asOfTime":{"type":["integer","null"]},"agent":{"type":"object","properties":{"agentId":{"type":"string"},"name":{"type":["string","null"]},"summary":{"type":["string","null"]},"owner":{"type":["string","null"]},"wallet":{"type":["string","null"]}}},"totals":{"type":"object","properties":{"fills":{"type":"integer"},"buys":{"type":"integer"},"sells":{"type":"integer"},"usdgTraded":{"type":"string","description":"USDG with all 6 decimals, for example \"11.000000\"."},"costUsdg":{"type":"string","description":"Sum of every fill's cost against the market price, in USDG with 6 decimals. Negative is better for clients."},"costPer100Usdg":{"type":["string","null"],"description":"costUsdg per 100 USDG traded, 6 decimals."},"worstFill":{"type":["object","null"],"description":"The fill furthest on the client's bad side, fill price against the market price.","properties":{"bps":{"type":"number"},"tx":{"type":"string"},"logIndex":{"type":"integer"},"block":{"type":"string"}}}}},"assets":{"type":"array","items":{"allOf":[{"type":"object","properties":{"token":{"type":"string"},"ticker":{"type":["string","null"]}}},{"type":"object","properties":{"fills":{"type":"integer"},"buys":{"type":"integer"},"sells":{"type":"integer"},"usdgTraded":{"type":"string","description":"USDG with all 6 decimals, for example \"11.000000\"."},"costUsdg":{"type":"string","description":"Sum of every fill's cost against the market price, in USDG with 6 decimals. Negative is better for clients."},"costPer100Usdg":{"type":["string","null"],"description":"costUsdg per 100 USDG traded, 6 decimals."},"worstFill":{"type":["object","null"],"description":"The fill furthest on the client's bad side, fill price against the market price.","properties":{"bps":{"type":"number"},"tx":{"type":"string"},"logIndex":{"type":"integer"},"block":{"type":"string"}}}}}]}},"routers":{"type":"object","properties":{"v1":{"type":"integer"},"v2":{"type":"integer"},"v3":{"type":"integer"}}},"clients":{"type":"object","description":"Client accounts that ever named this agent or traded with it. team: owned by the Fillmark team. linkedToAgent: owned by the agent's owner or agent wallet. unknown: owner not read yet or not readable. independent: everything else (ownership through other wallets cannot be seen on chain). active: permission for this agent in force now.","properties":{"total":{"type":"integer"},"independent":{"type":"integer"},"linkedToAgent":{"type":"integer"},"team":{"type":"integer"},"unknown":{"type":"integer"},"active":{"type":"integer"}}},"firstFill":{"type":["object","null"],"properties":{"tx":{"type":"string"},"block":{"type":"string"},"time":{"type":["integer","null"]}}},"lastFill":{"type":["object","null"],"properties":{"tx":{"type":"string"},"block":{"type":"string"},"time":{"type":["integer","null"]}}}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"405":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"503":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}}}},"/v1/agents/{agentId}/fills":{"get":{"summary":"One agent's fills, in pages of 100","description":"Pages are counted from the agent's first fill, so a full page always holds the same fills; only the last page grows. Without page, the last page. Fills are newest first within a page.","parameters":[{"name":"agentId","in":"path","required":true,"schema":{"type":"string","pattern":"^(0|[1-9][0-9]{0,77})$"}},{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"maximum":999999999}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"asOfBlock":{"type":"string","description":"Every log up to this block is counted."},"asOfTime":{"type":["integer","null"]},"agentId":{"type":"string"},"page":{"type":"integer"},"pages":{"type":"integer"},"perPage":{"type":"integer"},"fills":{"type":"array","items":{"allOf":[{"type":"object","properties":{"router":{"type":"string","description":"The Fillmark router contract the fill went through."},"routerVersion":{"type":"integer","enum":[1,2,3]},"tx":{"type":"string"},"logIndex":{"type":"integer","description":"Index of the router's Filled event in the transaction."},"block":{"type":"string"},"time":{"type":["integer","null"],"description":"Block time, unix seconds."},"fillId":{"type":"string","description":"The fill id the router emits; the ERC-8004 entries carry it as feedbackHash."},"agentId":{"type":"string"},"account":{"type":"string","description":"The client account the agent traded for."},"asset":{"type":"object","properties":{"token":{"type":"string"},"ticker":{"type":["string","null"]}}},"side":{"type":"string","enum":["buy","sell"]},"usdg":{"type":"string","description":"USDG with all 6 decimals, for example \"11.000000\"."},"amount":{"type":"string","description":"Token amount with all of the token's decimals."},"fillPrice":{"type":"string","description":"USDG per whole token, 8 decimals."},"marketPrice":{"type":"string","description":"The router's reference price at the fill, USDG per whole token, 8 decimals."},"bps":{"type":"number","description":"Fill price against the market price, in basis points; positive is worse for the client."},"costUsdg":{"type":"string","description":"USDG with all 6 decimals; negative is better for the client than the market price."},"fillFeeUsdg":{"type":"string","description":"Fill fee sent to the burner, outside usdg and costUsdg; 0 on router v1."},"session":{"type":"string","enum":["regular","extended","closed"]},"clientLimitBps":{"type":["integer","null"],"description":"The client's price limit in force at the fill."}}},{"type":"object","properties":{"feedback":{"type":"array","description":"The ERC-8004 entries the router wrote for this fill: in the fill's transaction, from the client account, feedbackHash = fill id, fillmark-cost = cost and fillmark-notional = usdg (with -ext in the extended session). Other entries for the agent are left out.","items":{"type":"object","properties":{"tag1":{"type":"string"},"tag2":{"type":"string"},"value":{"type":"string"},"valueDecimals":{"type":"integer"},"client":{"type":"string"},"logIndex":{"type":"integer"}}}},"feedbackFailed":{"type":"array","description":"Entries the registry refused during the fill (router v3 keeps the fill).","items":{"type":"string"}}}}]}}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"405":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"503":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}}}},"/v1/agents/{agentId}/strategies":{"get":{"summary":"The strategy each of an agent's fills ran under","description":"A fill's strategy is proven from its fillId: fillId = keccak256(abi.encode(4663, router, account, nonce)), and the reference agent's nonces carry the top 128 bits of the setting's EIP-712 hash (none for its own dca). Fills no nonce of the reference agent matches have strategy null. An account's group is one strategy when every fill of it is proven under that strategy, mixed when its fills ran under more than one strategy or some are not proven, unattributed when none are.","parameters":[{"name":"agentId","in":"path","required":true,"schema":{"type":"string","pattern":"^(0|[1-9][0-9]{0,77})$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"asOfBlock":{"type":"string","description":"Every log up to this block is counted."},"asOfTime":{"type":["integer","null"]},"agentId":{"type":"string"},"groups":{"type":"object","description":"dca, rebalance, mixed, unattributed: accounts and fills in each.","additionalProperties":{"type":"object","properties":{"accounts":{"type":"integer"},"fills":{"type":"integer"}}}},"accounts":{"type":"array","items":{"type":"object","properties":{"account":{"type":"string"},"group":{"type":"string","enum":["dca","rebalance","mixed","unattributed"]},"fills":{"type":"integer"},"attributed":{"type":"integer"}}}},"fills":{"type":"array","description":"Newest first.","items":{"type":"object","properties":{"fillId":{"type":"string"},"tx":{"type":"string"},"logIndex":{"type":"integer"},"account":{"type":"string"},"strategy":{"type":["string","null"],"enum":["dca","rebalance",null]},"setting":{"type":["string","null"],"description":"EIP-712 hash of the setting, null for the agent's own dca."}}}}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"405":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"503":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}}}},"/v1/settings":{"get":{"summary":"Strategy settings stored for an agent","description":"Every setting client account owners signed for this agent, by account and seq. Agents read this list; it is never cached.","parameters":[{"name":"agent","in":"query","required":true,"schema":{"type":"string","pattern":"^(0|[1-9][0-9]{0,77})$"}},{"name":"account","in":"query","schema":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"agentId":{"type":"string"},"settings":{"type":"array","items":{"type":"object","properties":{"setting":{"type":"object","description":"EIP-712 typed data Setting, domain {name: \"Fillmark\", version: \"1\", chainId: 4663, verifyingContract: router v3}. Numbers that may exceed 2^53 are decimal strings.","properties":{"account":{"type":"string"},"agentId":{"type":"string"},"strategy":{"type":"string","enum":["dca","rebalance"]},"takeProfitBps":{"type":"integer","description":"dca: sell a lot this far above its average cost, 100 to 100000. 0 for rebalance."},"targets":{"type":"array","description":"rebalance: 1 to 8 assets the account allows, each with its ticker and weight in bps. Empty for dca.","items":{"type":"object","properties":{"asset":{"type":"string"},"ticker":{"type":"string"},"weightBps":{"type":"integer"}}}},"cashBps":{"type":"integer","description":"rebalance: the weight kept in USDG; weights and cash add up to 10000."},"driftBps":{"type":"integer","description":"rebalance: trade when an asset's weight is this far off its target, 0 or 100 to 5000."},"everyDays":{"type":"integer","enum":[0,7,30],"description":"rebalance: trade back to target this often (0: never on a schedule)."},"validFrom":{"type":"string","description":"Unix seconds; the setting takes effect at the first 00:00 UTC after it."},"seq":{"type":"string","description":"1 for an account's first setting with an agent, then each one 1 higher."}}},"signature":{"type":"string"},"digest":{"type":"string"},"received":{"type":"integer"}}}}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"405":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"503":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}}},"post":{"summary":"Store a signed strategy setting","description":"At most 4096 bytes. Stored only when the signer is the account's owner in the ECDSA validator, that validator is the account's root validator, the account has installed the agent on router v3, every target asset is allowed for the account, seq is the next one, validFrom is at most an hour ago and 90 days ahead, and the account stored fewer than 10 settings today (UTC). Settings are public.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["setting","signature"],"properties":{"setting":{"type":"object","description":"EIP-712 typed data Setting, domain {name: \"Fillmark\", version: \"1\", chainId: 4663, verifyingContract: router v3}. Numbers that may exceed 2^53 are decimal strings.","properties":{"account":{"type":"string"},"agentId":{"type":"string"},"strategy":{"type":"string","enum":["dca","rebalance"]},"takeProfitBps":{"type":"integer","description":"dca: sell a lot this far above its average cost, 100 to 100000. 0 for rebalance."},"targets":{"type":"array","description":"rebalance: 1 to 8 assets the account allows, each with its ticker and weight in bps. Empty for dca.","items":{"type":"object","properties":{"asset":{"type":"string"},"ticker":{"type":"string"},"weightBps":{"type":"integer"}}}},"cashBps":{"type":"integer","description":"rebalance: the weight kept in USDG; weights and cash add up to 10000."},"driftBps":{"type":"integer","description":"rebalance: trade when an asset's weight is this far off its target, 0 or 100 to 5000."},"everyDays":{"type":"integer","enum":[0,7,30],"description":"rebalance: trade back to target this often (0: never on a schedule)."},"validFrom":{"type":"string","description":"Unix seconds; the setting takes effect at the first 00:00 UTC after it."},"seq":{"type":"string","description":"1 for an account's first setting with an agent, then each one 1 higher."}}},"signature":{"type":"string","pattern":"^0x[0-9a-fA-F]{130}$"}}}}}},"responses":{"201":{"description":"Stored","content":{"application/json":{"schema":{"type":"object","properties":{"digest":{"type":"string"},"agentId":{"type":"string"},"account":{"type":"string"},"seq":{"type":"string"},"signer":{"type":"string"},"startsAt":{"type":"integer","description":"Unix seconds of the earliest 00:00 UTC the agent can follow it: after validFrom, and not before the day after it is stored."}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"405":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"413":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"429":{"description":"More than 60 requests a minute, 10 settings stored for the account today, or 50 accounts checked on chain from this network today.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"503":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}}}},"/v1/fills/{tx}":{"get":{"summary":"Whether a transaction holds Fillmark fills","description":"Each fill with the two ERC-8004 entries (fillmark-cost, fillmark-notional) the client account wrote in the same transaction, and any entry the registry refused.","parameters":[{"name":"tx","in":"path","required":true,"schema":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"asOfBlock":{"type":"string","description":"Every log up to this block is counted."},"asOfTime":{"type":["integer","null"]},"tx":{"type":"string"},"fillmark":{"type":"boolean","description":"False means no Fillmark fill in this transaction up to asOfBlock."},"fills":{"type":"array","items":{"allOf":[{"type":"object","properties":{"router":{"type":"string","description":"The Fillmark router contract the fill went through."},"routerVersion":{"type":"integer","enum":[1,2,3]},"tx":{"type":"string"},"logIndex":{"type":"integer","description":"Index of the router's Filled event in the transaction."},"block":{"type":"string"},"time":{"type":["integer","null"],"description":"Block time, unix seconds."},"fillId":{"type":"string","description":"The fill id the router emits; the ERC-8004 entries carry it as feedbackHash."},"agentId":{"type":"string"},"account":{"type":"string","description":"The client account the agent traded for."},"asset":{"type":"object","properties":{"token":{"type":"string"},"ticker":{"type":["string","null"]}}},"side":{"type":"string","enum":["buy","sell"]},"usdg":{"type":"string","description":"USDG with all 6 decimals, for example \"11.000000\"."},"amount":{"type":"string","description":"Token amount with all of the token's decimals."},"fillPrice":{"type":"string","description":"USDG per whole token, 8 decimals."},"marketPrice":{"type":"string","description":"The router's reference price at the fill, USDG per whole token, 8 decimals."},"bps":{"type":"number","description":"Fill price against the market price, in basis points; positive is worse for the client."},"costUsdg":{"type":"string","description":"USDG with all 6 decimals; negative is better for the client than the market price."},"fillFeeUsdg":{"type":"string","description":"Fill fee sent to the burner, outside usdg and costUsdg; 0 on router v1."},"session":{"type":"string","enum":["regular","extended","closed"]},"clientLimitBps":{"type":["integer","null"],"description":"The client's price limit in force at the fill."}}},{"type":"object","properties":{"feedback":{"type":"array","description":"The ERC-8004 entries the router wrote for this fill: in the fill's transaction, from the client account, feedbackHash = fill id, fillmark-cost = cost and fillmark-notional = usdg (with -ext in the extended session). Other entries for the agent are left out.","items":{"type":"object","properties":{"tag1":{"type":"string"},"tag2":{"type":"string"},"value":{"type":"string"},"valueDecimals":{"type":"integer"},"client":{"type":"string"},"logIndex":{"type":"integer"}}}},"feedbackFailed":{"type":"array","description":"Entries the registry refused during the fill (router v3 keeps the fill).","items":{"type":"string"}}}}]}}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"405":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"503":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}}}}}}