{"openapi":"3.1.0","info":{"title":"Floorwalker agent API","version":"1.0.0","description":"Floorwalker sits between AI agents and a business's PayPal account: every refund or payout is checked against PayPal's records and your rules, and it learns from your decisions when it no longer needs to ask you. PayPal sandbox only."},"servers":[{"url":"https://floorwalker.yingzhilu.cn/v1"}],"security":[{"agentKey":[]}],"paths":{"/messages":{"post":{"summary":"Add a customer message (idempotent on external_id); optionally run the Support agent","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"from_email":{"type":"string","maxLength":254,"format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"from_name":{"type":"string","maxLength":200},"subject":{"type":"string","minLength":1,"maxLength":1000},"body":{"type":"string","minLength":1,"maxLength":200000},"received_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"external_id":{"type":"string","minLength":1,"maxLength":255},"run":{"type":"boolean"}},"required":["from_email","subject","body"]}}}},"responses":{"200":{"description":"Stored ticket and duplicate flag"},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (120 calls a minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/agent":{"get":{"summary":"The agent this key belongs to, with its permissions and limits","responses":{"200":{"description":"The agent, including freeze_explanation (check, evidence, next_step) when frozen"},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (120 calls a minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/refunds":{"post":{"summary":"Refund a PayPal capture","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":255},"description":"Retrying with the same key returns the first result and never moves money twice"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"capture_id":{"type":"string","minLength":1,"maxLength":64},"amount":{"type":"number","exclusiveMinimum":0,"maximum":100000},"note":{"type":"string","maxLength":255},"reason":{"type":"string","minLength":1,"maxLength":2000},"requester_email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$","description":"Who asked for this refund; Floorwalker checks it against the buyer on the PayPal order"},"source_message":{"description":"Their message, verbatim","type":"string","maxLength":20000}},"required":["capture_id","reason","requester_email"]}}}},"responses":{"200":{"description":"The action, executed, held or blocked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Action"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (120 calls a minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/payouts":{"post":{"summary":"Pay someone with PayPal Payouts","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"currency":{"description":"PayPal currency; defaults to the workspace currency","type":"string","enum":["AUD","BRL","CAD","CHF","CNY","CZK","DKK","EUR","GBP","HKD","HUF","ILS","JPY","MYR","MXN","NOK","NZD","PHP","PLN","SEK","SGD","THB","TWD","USD"]},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"amount":{"type":"number","exclusiveMinimum":0,"maximum":100000},"note":{"type":"string","maxLength":255},"reason":{"type":"string","minLength":1,"maxLength":2000},"requester_email":{"description":"Who asked for this money move","type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"source_message":{"description":"Their message, verbatim","type":"string","maxLength":20000}},"required":["email","amount","reason"]}}}},"responses":{"200":{"description":"The action, executed, held or blocked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Action"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited (120 calls a minute per key)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/actions/{id}":{"get":{"summary":"One of this agent's actions","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The action","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Action"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/actions":{"get":{"summary":"This agent's recent actions","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Up to 100 actions, newest first"}}}},"/mcp":{"post":{"summary":"MCP over Streamable HTTP (stateless) with the same tools and checks","responses":{"200":{"description":"MCP response"}}}}},"components":{"securitySchemes":{"agentKey":{"type":"http","scheme":"bearer","description":"An agent key (fw_…; existing alw_… keys also work) from Developers in Floorwalker"}},"schemas":{"Action":{"type":"object","properties":{"id":{"type":"string","example":"act_42"},"object":{"const":"action"},"type":{"enum":["refund","payout"]},"status":{"enum":["executed","awaiting_approval","approved","declined","blocked","failed","executing"],"description":"Where the request stands. awaiting_approval: poll GET /v1/actions/{id} or subscribe to webhooks."},"decision":{"enum":["allow","hold","block"]},"amount":{"type":"number"},"approved_amount":{"type":["number","null"],"description":"Set when the owner approved a smaller amount"},"currency":{"type":"string","example":"USD","description":"Recorded action currency; refunds use the PayPal capture currency"},"counterparty":{"type":["string","null"]},"agent_id":{"type":"string"},"reason":{"type":"string"},"checks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"outcome":{"enum":["pass","hold","block"]},"detail":{"type":"string"}}}},"review":{"type":["object","null"],"properties":{"verdict":{"enum":["approve","escalate","reject"]},"summary":{"type":"string"},"cited_rule":{"type":"string"},"injection_detected":{"type":"boolean"}}},"paypal_ref":{"type":["string","null"],"description":"PayPal refund id or payout batch id once money moved"},"decline_reason":{"type":["string","null"]},"block_explanations":{"type":"array","description":"Blocking checks, evidence and owner recovery steps","items":{"type":"object","properties":{"check":{"type":"string"},"rule":{"type":"string"},"evidence":{"type":"string"},"facts":{"type":["object","null"]},"freeze":{"type":["object","null"]},"next_step":{"type":"string"}}}},"created_at":{"type":"string","format":"date-time"},"decided_at":{"type":["string","null"],"format":"date-time"},"expires_at":{"type":["string","null"],"format":"date-time","description":"A held request not answered by then is declined"},"message":{"type":"string","description":"What the agent should do next, in words (only on create)"}}},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}}