{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/simpleeasytransactions-com/json-schema/simpleeasytransactions-com-escrow-schema.json",
  "title": "Escrow",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/simpleeasytransactions-com-openapi.json#/components/schemas/Escrow",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "esc_ and 32 hex characters."
    },
    "object": {
      "type": "string",
      "const": "escrow"
    },
    "livemode": {
      "type": "boolean"
    },
    "externalId": {
      "type": [
        "string",
        "null"
      ]
    },
    "invoice": {
      "type": [
        "string",
        "null"
      ]
    },
    "ledgerSide": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "buyer",
        "seller",
        null
      ],
      "description": "Which party your business is, for its journal entries and SET Close (POST /v1/escrows ledgerSide; seller when the escrow names one of your invoices). null: SET writes no journal entry for the escrow."
    },
    "state": {
      "type": "string",
      "enum": [
        "awaiting_acceptance",
        "accepted",
        "funded",
        "disputed",
        "completed",
        "cancelled"
      ]
    },
    "network": {
      "type": "string",
      "enum": [
        "base",
        "ethereum",
        "arbitrum",
        "optimism",
        "polygon",
        "avalanche"
      ]
    },
    "chainId": {
      "type": "integer"
    },
    "asset": {
      "type": "string"
    },
    "token": {
      "type": "string"
    },
    "scheme": {
      "type": "string",
      "enum": [
        "2_of_2",
        "2_of_3"
      ]
    },
    "threshold": {
      "type": "integer"
    },
    "parties": {
      "type": "object",
      "properties": {
        "buyer": {
          "type": "object",
          "properties": {
            "address": {
              "type": "string"
            },
            "acceptedAt": {
              "type": [
                "string",
                "null"
              ],
              "description": "When SET verified the party's signature over the terms; null until it accepts."
            }
          },
          "required": [
            "address",
            "acceptedAt"
          ]
        },
        "seller": {
          "type": "object",
          "properties": {
            "address": {
              "type": "string"
            },
            "acceptedAt": {
              "type": [
                "string",
                "null"
              ],
              "description": "When SET verified the party's signature over the terms; null until it accepts."
            }
          },
          "required": [
            "address",
            "acceptedAt"
          ]
        },
        "arbiter": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "address": {
              "type": "string"
            },
            "acceptedAt": {
              "type": [
                "string",
                "null"
              ],
              "description": "When SET verified the party's signature over the terms; null until it accepts."
            }
          },
          "required": [
            "address",
            "acceptedAt"
          ],
          "description": "null for 2-of-2."
        }
      },
      "required": [
        "buyer",
        "seller",
        "arbiter"
      ]
    },
    "safe": {
      "type": "object",
      "properties": {
        "address": {
          "type": "string",
          "description": "The Safe's counterfactual (CREATE2) address: pay the escrow here."
        },
        "version": {
          "type": "string"
        },
        "saltNonce": {
          "type": "string"
        },
        "owners": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "threshold": {
          "type": "integer"
        },
        "factory": {
          "type": "string"
        },
        "singleton": {
          "type": "string"
        },
        "fallbackHandler": {
          "type": "string"
        },
        "nextNonce": {
          "type": "integer"
        },
        "custody": {
          "type": "string"
        }
      },
      "required": [
        "address",
        "version",
        "saltNonce",
        "owners",
        "threshold",
        "factory",
        "singleton",
        "fallbackHandler",
        "nextNonce",
        "custody"
      ]
    },
    "termsHash": {
      "type": "string",
      "description": "0x and 64 hex characters.",
      "pattern": "^0x[0-9a-fA-F]{64}$"
    },
    "amount": {
      "type": "string",
      "description": "A decimal string in USDC, never a float."
    },
    "released": {
      "type": "string",
      "description": "A decimal string in USDC, never a float."
    },
    "refunded": {
      "type": "string",
      "description": "A decimal string in USDC, never a float."
    },
    "funded": {
      "type": [
        "object",
        "null"
      ],
      "description": "null until the Safe holds the escrow's amount.",
      "properties": {
        "amount": {
          "type": [
            "string",
            "null"
          ]
        },
        "at": {
          "type": "string"
        },
        "source": {
          "type": "string",
          "enum": [
            "chain",
            "simulator"
          ]
        }
      },
      "required": [
        "amount",
        "at",
        "source"
      ]
    },
    "screening": {
      "type": "string",
      "enum": [
        "clear",
        "not_screened"
      ]
    },
    "milestones": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/EscrowMilestone"
      }
    },
    "proposals": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/EscrowProposal"
      }
    },
    "createdAt": {
      "type": "string"
    },
    "updatedAt": {
      "type": "string"
    },
    "acceptance": {
      "type": "object",
      "properties": {
        "domain": {
          "type": "object",
          "additionalProperties": true
        },
        "types": {
          "type": "object",
          "additionalProperties": true
        },
        "primaryType": {
          "type": "string"
        },
        "message": {
          "type": "object",
          "additionalProperties": true
        }
      },
      "required": [
        "domain",
        "types",
        "primaryType",
        "message"
      ],
      "description": "POST /v1/escrows only: the typed data each party signs to accept the terms."
    },
    "chain": {
      "type": [
        "object",
        "null"
      ],
      "description": "GET /v1/escrows/{escrow} only: the Safe as the chain shows it (status read), or status unreadable; null for a completed or cancelled escrow.",
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "read",
            "unreadable"
          ]
        },
        "deployed": {
          "type": "boolean"
        },
        "balance": {
          "type": "string",
          "description": "A decimal string in USDC, never a float."
        },
        "nonce": {
          "type": [
            "integer",
            "null"
          ]
        }
      },
      "required": [
        "status"
      ]
    },
    "acceptedBy": {
      "type": "string",
      "enum": [
        "buyer",
        "seller",
        "arbiter"
      ],
      "description": "POST …/accept only: the party whose acceptance this request carried."
    },
    "message": {
      "type": "string",
      "description": "On a sandbox simulator's answer only: what was simulated."
    },
    "next": {
      "type": "string",
      "description": "What to do next, in words. On the answers that carry it."
    },
    "sandbox": {
      "type": "boolean",
      "description": "true on a test key."
    }
  },
  "required": [
    "id",
    "object",
    "livemode",
    "externalId",
    "invoice",
    "ledgerSide",
    "state",
    "network",
    "chainId",
    "asset",
    "token",
    "scheme",
    "threshold",
    "parties",
    "safe",
    "termsHash",
    "amount",
    "released",
    "refunded",
    "funded",
    "screening",
    "milestones",
    "proposals",
    "createdAt",
    "updatedAt"
  ],
  "$defs": {
    "EscrowMilestone": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "esm_ and 32 hex characters."
        },
        "object": {
          "type": "string",
          "const": "escrow_milestone"
        },
        "position": {
          "type": "integer"
        },
        "amount": {
          "type": "string",
          "description": "A decimal string in USDC, never a float."
        },
        "label": {
          "type": [
            "string",
            "null"
          ],
          "description": "Your own short code."
        },
        "state": {
          "type": "string",
          "enum": [
            "open",
            "submitted",
            "disputed",
            "released",
            "refunded"
          ]
        },
        "evidenceHash": {
          "type": [
            "string",
            "null"
          ],
          "description": "The hash the seller signed at submission; SET never receives the evidence."
        },
        "submissionReference": {
          "type": [
            "string",
            "null"
          ]
        },
        "submittedAt": {
          "type": [
            "string",
            "null"
          ]
        },
        "payout": {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "seller_wallet",
                "cash_out_address",
                "prefunding"
              ]
            },
            "address": {
              "type": "string"
            },
            "cashOutAddress": {
              "type": [
                "string",
                "null"
              ]
            },
            "advance": {
              "type": [
                "string",
                "null"
              ]
            },
            "locked": {
              "type": "boolean",
              "description": "Assigned to a prefunding provider's repayment address by the seller's signature."
            }
          },
          "required": [
            "kind",
            "address",
            "cashOutAddress",
            "advance",
            "locked"
          ]
        }
      },
      "required": [
        "id",
        "object",
        "position",
        "amount",
        "label",
        "state",
        "evidenceHash",
        "submissionReference",
        "submittedAt",
        "payout"
      ]
    },
    "EscrowProposal": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "esp_ and 32 hex characters."
        },
        "object": {
          "type": "string",
          "const": "escrow_proposal"
        },
        "kind": {
          "type": "string",
          "enum": [
            "release",
            "refund"
          ]
        },
        "milestone": {
          "type": [
            "string",
            "null"
          ]
        },
        "state": {
          "type": "string",
          "enum": [
            "awaiting_signatures",
            "ready",
            "executed",
            "failed",
            "cancelled"
          ]
        },
        "amount": {
          "type": "string",
          "description": "A decimal string in USDC, never a float."
        },
        "destination": {
          "type": "string"
        },
        "destinationKind": {
          "type": "string",
          "enum": [
            "seller_wallet",
            "cash_out_address",
            "prefunding",
            "buyer_wallet"
          ]
        },
        "safeNonce": {
          "type": "integer"
        },
        "safeTxHash": {
          "type": "string",
          "description": "0x and 64 hex characters.",
          "pattern": "^0x[0-9a-fA-F]{64}$"
        },
        "signatures": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "signer": {
                "type": "string"
              },
              "role": {
                "type": "string",
                "enum": [
                  "buyer",
                  "seller",
                  "arbiter"
                ]
              },
              "at": {
                "type": "string"
              }
            },
            "required": [
              "signer",
              "role",
              "at"
            ]
          }
        },
        "threshold": {
          "type": "integer"
        },
        "typedData": {
          "type": "object",
          "properties": {
            "domain": {
              "type": "object",
              "additionalProperties": true
            },
            "types": {
              "type": "object",
              "additionalProperties": true
            },
            "primaryType": {
              "type": "string"
            },
            "message": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "required": [
            "domain",
            "types",
            "primaryType",
            "message"
          ],
          "description": "The SafeTx an owner signs with eth_signTypedData_v4."
        },
        "executedAt": {
          "type": [
            "string",
            "null"
          ]
        },
        "executedSource": {
          "type": [
            "string",
            "null"
          ],
          "description": "chain, or simulator in the sandbox."
        },
        "createdAt": {
          "type": "string"
        },
        "safe": {
          "type": "object",
          "properties": {
            "safe": {
              "type": "string"
            },
            "chainId": {
              "type": "integer"
            },
            "to": {
              "type": "string"
            },
            "value": {
              "type": "string"
            },
            "data": {
              "type": "string"
            },
            "operation": {
              "type": "integer"
            },
            "safeTxGas": {
              "type": "string"
            },
            "baseGas": {
              "type": "string"
            },
            "gasPrice": {
              "type": "string"
            },
            "gasToken": {
              "type": "string"
            },
            "refundReceiver": {
              "type": "string"
            },
            "nonce": {
              "type": "string"
            },
            "contractTransactionHash": {
              "type": "string",
              "description": "0x and 64 hex characters.",
              "pattern": "^0x[0-9a-fA-F]{64}$"
            }
          },
          "required": [
            "safe",
            "chainId",
            "contractTransactionHash"
          ],
          "description": "POST …/propose_release?format=safe only: the Safe Transaction Service's proposal shape."
        },
        "execution": {
          "type": [
            "object",
            "null"
          ],
          "description": "POST …/signatures only: the execTransaction call any party may broadcast once two owners signed; null until then.",
          "properties": {
            "to": {
              "type": "string"
            },
            "value": {
              "type": "string"
            },
            "chainId": {
              "type": "integer"
            },
            "data": {
              "type": "string"
            },
            "note": {
              "type": "string"
            }
          },
          "required": [
            "to",
            "value",
            "chainId",
            "data"
          ]
        },
        "signedBy": {
          "type": "string",
          "enum": [
            "buyer",
            "seller",
            "arbiter"
          ],
          "description": "POST …/signatures only: the owner whose signature this request carried."
        },
        "milestones": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "POST …/propose_refund only: the milestones the refund returns."
        },
        "next": {
          "type": "string",
          "description": "What to do next, in words. On the answers that carry it."
        },
        "sandbox": {
          "type": "boolean",
          "description": "true on a test key."
        }
      },
      "required": [
        "id",
        "object",
        "kind",
        "milestone",
        "state",
        "amount",
        "destination",
        "destinationKind",
        "safeNonce",
        "safeTxHash",
        "signatures",
        "threshold",
        "typedData",
        "executedAt",
        "executedSource",
        "createdAt"
      ]
    }
  }
}