{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/vestiarion-xyz/json-schema/vestiarion-xyz-get-invoice-receipt-response-schema.json",
  "title": "GetInvoiceReceiptResponse",
  "x-generated": "2026-11-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/vestiarion-xyz-openapi.json#/components/schemas/GetInvoiceReceiptResponse",
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "format": {
          "type": "string",
          "const": "vestiarion-receipt/1"
        },
        "exportedAt": {
          "type": "string"
        },
        "workspace": {
          "type": "object",
          "properties": {
            "slug": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "slug",
            "name"
          ],
          "description": "The workspace the document is of."
        },
        "network": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "enum": [
                "arc-testnet",
                "arc-mainnet"
              ]
            },
            "label": {
              "type": "string",
              "description": "The network's name, as the workspace's pages write it."
            }
          },
          "required": [
            "id",
            "label"
          ],
          "description": "The workspace's network."
        },
        "invoiceId": {
          "type": "string"
        },
        "ready": {
          "type": "boolean",
          "description": "Paid, confirmed, on chain, and a signed entry records its transaction: what Share receipt needs."
        },
        "notReady": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "enum": [
                    "not_payable",
                    "not_paid",
                    "simulated",
                    "not_minted",
                    "no_transaction",
                    "not_recorded"
                  ]
                },
                "reason": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "reason"
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "Why not, when not ready. `simulated` never changes; `not_paid` and `not_minted` pass."
        },
        "facts": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "amount": {
                  "type": "number"
                },
                "token": {
                  "type": "string",
                  "enum": [
                    "USDC",
                    "EURC"
                  ]
                },
                "paidAt": {
                  "type": "string",
                  "description": "When the payment was confirmed."
                },
                "payee": {
                  "type": "string",
                  "description": "The address paid."
                },
                "chain": {
                  "type": "string",
                  "description": "The chain the payee was paid on."
                },
                "txHash": {
                  "type": "string",
                  "description": "The transaction that paid the payee: the transfer on the workspace's network, or the mint on the payee's chain."
                },
                "route": {
                  "type": "string",
                  "enum": [
                    "direct",
                    "cctp",
                    "gateway"
                  ]
                },
                "sourceTxHash": {
                  "description": "CCTP only: the burn on the workspace's network.",
                  "type": "string"
                },
                "feeUsdc": {
                  "description": "CCTP and Gateway: the route's fee, in USDC.",
                  "type": "number"
                },
                "invoiceNumber": {
                  "description": "The invoice's own number, as the vendor wrote it.",
                  "type": "string"
                },
                "invoiceAmount": {
                  "description": "The invoice's amount, only when it was for more than was paid: an early-payment discount.",
                  "type": "number"
                },
                "feesPaidBy": {
                  "description": "Who paid the fees: the sender, on top of the amount, and never the payee.",
                  "type": "string",
                  "const": "sender"
                }
              },
              "required": [
                "amount",
                "token",
                "paidAt",
                "payee",
                "chain",
                "txHash",
                "route"
              ],
              "description": "What a receipt states for this payment, as Share receipt would state it now."
            },
            {
              "type": "null"
            }
          ]
        },
        "records": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "seq": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "hash": {
                  "type": "string"
                }
              },
              "required": [
                "seq",
                "hash"
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "The entry that recorded the transaction; null when not ready."
        },
        "invoiceEntry": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ],
          "description": "The entry the bill was added with, which its invoice number comes from, or null."
        },
        "shared": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "at": {
                  "type": "string",
                  "description": "When a member first shared it."
                },
                "entry": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "The `receipt_shared` entry that signed the statement the payee saw."
                },
                "linkOpen": {
                  "type": "boolean",
                  "description": "Whether its link opens now. The link itself is never in the answer."
                },
                "changes": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "enum": [
                          "receipt_link_renewed",
                          "receipt_revoked"
                        ]
                      },
                      "at": {
                        "type": "string"
                      },
                      "entry": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "action",
                      "at",
                      "entry"
                    ]
                  }
                }
              },
              "required": [
                "at",
                "entry",
                "linkOpen",
                "changes"
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "When a member shared the receipt; null when no one has."
        },
        "checks": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "recorded": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "ok": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "ok"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "ok": {
                          "type": "boolean",
                          "const": false
                        },
                        "reason": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "ok",
                        "reason"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "ok": {
                          "type": "null"
                        },
                        "reason": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "ok",
                        "reason"
                      ]
                    }
                  ],
                  "description": "The recording entry checked alone, and holding the transaction."
                },
                "onChain": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "state": {
                          "type": "string",
                          "const": "matches"
                        },
                        "block": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991,
                          "description": "The block the transaction is in."
                        },
                        "received": {
                          "description": "What the payee received, read from the chain's transfer.",
                          "type": "number"
                        }
                      },
                      "required": [
                        "state",
                        "block"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "state": {
                          "type": "string",
                          "const": "mismatch"
                        },
                        "reason": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "state",
                        "reason"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "state": {
                          "type": "string",
                          "const": "unreadable"
                        }
                      },
                      "required": [
                        "state"
                      ]
                    }
                  ],
                  "description": "The transaction as its chain records it: it matches the payment, it does not, or the chain could not be read just now."
                }
              },
              "required": [
                "recorded",
                "onChain"
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "The receipt's two checks; null when not ready."
        },
        "signedEntryProves": {
          "type": "string",
          "description": "What a signed entry proves, and what it does not."
        },
        "checkAnEntry": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "How to check one entry alone: its body hash, its signature and its chain hash."
        },
        "keys": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "The first 16 hex characters of the SHA-256 of the key's public SPKI: a key counts only under this id."
              },
              "status": {
                "type": "string",
                "enum": [
                  "active",
                  "retired"
                ]
              },
              "publicKeyPem": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "status",
              "publicKeyPem"
            ],
            "description": "One of the workspace's ledger signing keys, its public half only."
          },
          "description": "The workspace's public keys, active and retired, each under its id: what the entries were signed with."
        },
        "entries": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "seq": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "ts": {
                "type": "string"
              },
              "actor": {
                "type": "string"
              },
              "domain": {
                "type": "string"
              },
              "action": {
                "type": "string"
              },
              "summary": {
                "type": "string"
              },
              "detail": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              "body_hash": {
                "type": "string"
              },
              "signature": {
                "type": "string"
              },
              "prev_hash": {
                "type": "string"
              },
              "hash": {
                "type": "string"
              },
              "signing_key_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "check": {
                "anyOf": [
                  {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "ok": {
                            "type": "boolean",
                            "const": true
                          }
                        },
                        "required": [
                          "ok"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "ok": {
                            "type": "boolean",
                            "const": false
                          },
                          "reason": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "ok",
                          "reason"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "ok": {
                            "type": "null"
                          },
                          "reason": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "ok",
                          "reason"
                        ]
                      }
                    ],
                    "description": "One entry checked alone: `true` it verifies, `false` it does not, `null` it could not be checked here, for example by a key not known here."
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "The server's check of this entry alone. A checker re-checks it rather than trust this field."
              }
            },
            "required": [
              "seq",
              "id",
              "ts",
              "actor",
              "domain",
              "action",
              "summary",
              "detail",
              "body_hash",
              "signature",
              "prev_hash",
              "hash",
              "signing_key_id",
              "check"
            ],
            "description": "A ledger entry in full, as the audit export writes it (snake_case), with the server's check."
          },
          "description": "Every entry the document cites, oldest first, in full, each with the server's check."
        }
      },
      "required": [
        "format",
        "exportedAt",
        "workspace",
        "network",
        "invoiceId",
        "ready",
        "notReady",
        "facts",
        "records",
        "invoiceEntry",
        "shared",
        "checks",
        "signedEntryProves",
        "checkAnEntry",
        "keys",
        "entries"
      ],
      "description": "A payable's receipt, `vestiarion-receipt/1`: what it states, the entry that recorded it, its sharing and its checks."
    }
  },
  "required": [
    "data"
  ]
}