{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://protocol.frida.chat/ext/frida-protocol/v1/schema.json","title":"frida-protocol/1 message","description":"One frida-protocol/1 (1.0.1) message, carried as an A2A data part with mediaType application/vnd.frida-protocol.v1+json. Receivers ignore members they do not know, except the budget-like members a request must not carry.","oneOf":[{"$ref":"#/$defs/Request"},{"$ref":"#/$defs/Offer"},{"$ref":"#/$defs/Counter"},{"$ref":"#/$defs/Hold"},{"$ref":"#/$defs/Accept"},{"$ref":"#/$defs/Withdraw"},{"$ref":"#/$defs/Order"},{"$ref":"#/$defs/Decline"}],"$defs":{"Id":{"type":"string","minLength":1,"maxLength":100},"DateOrDateTime":{"type":"string","maxLength":40,"pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+(Z|[+-]\\d{2}:\\d{2})?)?$"},"Currency":{"type":"string","pattern":"^[A-Z]{3}$"},"Money":{"type":"object","description":"An amount in minor units (cents for USD) with its ISO 4217 currency.","required":["amount","currency"],"properties":{"amount":{"type":"integer","minimum":0,"maximum":10000000000},"currency":{"$ref":"#/$defs/Currency"}}},"Attributes":{"type":"object","maxProperties":12,"propertyNames":{"maxLength":40},"additionalProperties":{"type":"string","minLength":1,"maxLength":60}},"RequestItem":{"type":"object","required":["query","quantity"],"properties":{"query":{"allOf":[{"$ref":"#/$defs/PlainText"}],"maxLength":200},"sku":{"type":"string","minLength":1,"maxLength":100},"category":{"type":"string","minLength":1,"maxLength":60},"attributes":{"$ref":"#/$defs/Attributes"},"quantity":{"type":"integer","minimum":1,"maximum":1000},"gtin":{"type":"string","pattern":"^(\\d{8}|\\d{12}|\\d{13}|\\d{14})$","description":"GTIN-8, -12 (UPC), -13 (EAN) or -14. Matched exactly."},"taxonomy":{"type":"object","required":["system","id"],"properties":{"system":{"$ref":"#/$defs/Code"},"id":{"type":"string","minLength":1,"maxLength":40}},"description":"A category in a public taxonomy, e.g. google or unspsc."}}},"BuyerRef":{"type":"object","required":["id"],"properties":{"id":{"$ref":"#/$defs/Id","description":"Pairwise pseudonymous id: different at every merchant."},"passport":{"type":"string","minLength":1,"maxLength":4000,"description":"Compact JWS, typ frida-passport+jwt, role buyer."},"funds":{"type":"string","minLength":1,"maxLength":4000,"description":"Compact JWS, typ frida-funds+jwt."},"rate_token":{"type":"string","minLength":1,"maxLength":4000,"description":"Reserved: an anonymous rate-limiting token from a witness (Privacy Pass). Section 8.6."}}},"Request":{"type":"object","required":["type","request_id","items","buyer"],"properties":{"type":{"const":"request"},"request_id":{"$ref":"#/$defs/Id"},"items":{"type":"array","minItems":1,"maxItems":1,"items":{"$ref":"#/$defs/RequestItem"}},"need_by":{"$ref":"#/$defs/DateOrDateTime"},"ship_to":{"type":"object","required":["country"],"properties":{"country":{"type":"string","pattern":"^[A-Z]{2}$"},"postal_code":{"type":"string","minLength":1,"maxLength":12}}},"buyer":{"$ref":"#/$defs/BuyerRef"},"max_rounds":{"type":"integer","minimum":0,"maximum":10}},"not":{"description":"A request must not disclose the buyer's limit.","anyOf":[{"required":["budget"]},{"required":["max_price"]},{"required":["limit"]},{"required":["ceiling"]},{"required":["reservation_price"]}]}},"OfferLine":{"type":"object","required":["sku","title","quantity","unit_price","list_price"],"properties":{"sku":{"type":"string"},"title":{"allOf":[{"$ref":"#/$defs/PlainText"}],"maxLength":200},"attributes":{"$ref":"#/$defs/Attributes"},"quantity":{"type":"integer","minimum":1},"unit_price":{"$ref":"#/$defs/Money"},"list_price":{"$ref":"#/$defs/Money"},"gtin":{"type":"string","pattern":"^(\\d{8}|\\d{12}|\\d{13}|\\d{14})$"}}},"Perk":{"type":"object","required":["code","label","value"],"properties":{"code":{"$ref":"#/$defs/Code"},"label":{"allOf":[{"$ref":"#/$defs/PlainText"}],"maxLength":80},"value":{"$ref":"#/$defs/Money","description":"What it is worth to the buyer. Its cost to the merchant is never sent."}}},"Fulfillment":{"type":"object","required":["method","label","price"],"properties":{"method":{"enum":["ship","courier","pickup","onsite"]},"label":{"type":"string"},"price":{"$ref":"#/$defs/Money"},"arrives_by":{"type":"string","format":"date"},"starts_at":{"type":"string","format":"date-time"}}},"Totals":{"type":"array","items":{"type":"object","required":["type","amount"],"properties":{"type":{"enum":["subtotal","fulfillment","total"]},"amount":{"type":"integer","minimum":0}}}},"Merchant":{"type":"object","required":["id","name"],"properties":{"id":{"type":"string"},"name":{"type":"string"}}},"DetachedJws":{"type":"string","maxLength":1000,"pattern":"^[A-Za-z0-9_-]+\\.\\.[A-Za-z0-9_-]+$","description":"RFC 7515 Appendix F: base64url(header)..base64url(signature), ES256 over the RFC 8785 canonical form of the message without its signature member."},"Offer":{"type":"object","required":["type","offer_id","negotiation_id","request_id","buyer_id","merchant","round","max_rounds","final","agreed","lines","perks","fulfillment","totals","currency","reasons","counterparty","settlement","issued_at","expires_at","signature"],"properties":{"type":{"const":"offer"},"offer_id":{"$ref":"#/$defs/Id"},"negotiation_id":{"$ref":"#/$defs/Id"},"request_id":{"$ref":"#/$defs/Id"},"buyer_id":{"$ref":"#/$defs/Id"},"merchant":{"$ref":"#/$defs/Merchant"},"round":{"type":"integer","minimum":0,"maximum":10},"max_rounds":{"type":"integer","minimum":0,"maximum":10},"final":{"type":"boolean"},"agreed":{"type":"boolean"},"lines":{"type":"array","minItems":1,"items":{"$ref":"#/$defs/OfferLine"}},"perks":{"type":"array","items":{"$ref":"#/$defs/Perk"}},"fulfillment":{"$ref":"#/$defs/Fulfillment"},"totals":{"$ref":"#/$defs/Totals"},"currency":{"$ref":"#/$defs/Currency"},"reasons":{"type":"array","maxItems":20,"items":{"$ref":"#/$defs/Code"},"description":"Public codes for untrusted buyers; detailed codes only under the merchant's disclosure policy (section 5.10)."},"hold":{"type":"object","required":["until","quantity"],"properties":{"until":{"type":"string","format":"date-time"},"quantity":{"type":"integer","minimum":1}}},"need_by":{"$ref":"#/$defs/DateOrDateTime"},"counterparty":{"type":"object","required":["passport_verified"],"properties":{"passport_verified":{"type":"boolean"},"return_rate":{"type":"number","minimum":0,"maximum":1},"funds_verified":{"type":"boolean"},"orders":{"type":"integer","minimum":0}}},"settlement":{"type":"array","minItems":1,"items":{"type":"string"}},"passport":{"type":"string","description":"Compact JWS, typ frida-passport+jwt, role merchant."},"issued_at":{"type":"string","format":"date-time"},"expires_at":{"type":"string","format":"date-time"},"note":{"type":"string"},"signature":{"$ref":"#/$defs/DetachedJws"}}},"Counter":{"type":"object","required":["type","negotiation_id","in_reply_to","price"],"properties":{"type":{"const":"counter"},"negotiation_id":{"$ref":"#/$defs/Id"},"in_reply_to":{"$ref":"#/$defs/Offer"},"price":{"$ref":"#/$defs/Money","description":"Proposed unit price."},"note":{"type":"string","maxLength":280}}},"Hold":{"type":"object","required":["type","negotiation_id","in_reply_to","minutes"],"properties":{"type":{"const":"hold"},"negotiation_id":{"$ref":"#/$defs/Id"},"in_reply_to":{"$ref":"#/$defs/Offer"},"minutes":{"type":"integer","minimum":1,"maximum":120}}},"Accept":{"type":"object","required":["type","negotiation_id","in_reply_to"],"properties":{"type":{"const":"accept"},"negotiation_id":{"$ref":"#/$defs/Id"},"in_reply_to":{"$ref":"#/$defs/Offer"},"settlement":{"type":"string","minLength":1,"maxLength":60},"mandate":{"type":"string","minLength":1,"maxLength":8000,"description":"AP2 mandate (compact JWS or SD-JWT)."}}},"Withdraw":{"type":"object","required":["type","negotiation_id"],"properties":{"type":{"const":"withdraw"},"negotiation_id":{"$ref":"#/$defs/Id"},"reason":{"type":"string","maxLength":280}}},"Settlement":{"type":"object","required":["method"],"properties":{"method":{"type":"string","description":"continue_url, ucp_checkout, acp_checkout, ap2_direct, sandbox, or a vendor value."},"continue_url":{"type":"string","format":"uri"},"checkout":{"type":"object","required":["protocol","endpoint","session_id"],"properties":{"protocol":{"enum":["ucp","acp"]},"endpoint":{"type":"string","format":"uri"},"session_id":{"type":"string"}}},"reference":{"type":"string"}}},"Order":{"type":"object","required":["type","order_id","negotiation_id","offer_id","buyer_id","merchant","lines","perks","fulfillment","totals","currency","status","settlement","issued_at","signature"],"properties":{"type":{"const":"order"},"order_id":{"$ref":"#/$defs/Id"},"negotiation_id":{"$ref":"#/$defs/Id"},"offer_id":{"$ref":"#/$defs/Id"},"buyer_id":{"$ref":"#/$defs/Id"},"merchant":{"$ref":"#/$defs/Merchant"},"lines":{"type":"array","minItems":1,"items":{"$ref":"#/$defs/OfferLine"}},"perks":{"type":"array","items":{"$ref":"#/$defs/Perk"}},"fulfillment":{"$ref":"#/$defs/Fulfillment"},"totals":{"$ref":"#/$defs/Totals"},"currency":{"$ref":"#/$defs/Currency"},"status":{"enum":["confirmed","requires_payment"]},"settlement":{"$ref":"#/$defs/Settlement"},"issued_at":{"type":"string","format":"date-time"},"signature":{"$ref":"#/$defs/DetachedJws"}}},"Decline":{"type":"object","required":["type","code","message"],"properties":{"type":{"const":"decline"},"negotiation_id":{"$ref":"#/$defs/Id"},"request_id":{"$ref":"#/$defs/Id"},"code":{"enum":["no_match","out_of_stock","offer_expired","invalid_offer","final_offer","unsupported","funds_required","passport_required","mandate_invalid","withdrawn"]},"message":{"type":"string","minLength":1,"maxLength":500}}},"PlainText":{"type":"string","minLength":1,"maxLength":500,"pattern":"^[^<>\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f\\u007f\\u202a-\\u202e\\u2066-\\u2069]*$","description":"No control characters, bidirectional overrides or markup (section 8.7)."},"Code":{"type":"string","pattern":"^[a-z0-9][a-z0-9_.:-]{0,63}$","description":"A closed code, not prose."}}}