# payapp.check

Reconcile an AIA G702/G703 (1992) pay application from one workbook or a JSON summary with up to 500 JSON, CSV, or XLSX line items per period. PDF is unsupported.

- REST: `POST https://api.kanagu.dev/v1/payapp/check`
- MCP tool: `payapp.check` at https://api.kanagu.dev/mcp
- Price: $0.50 USD per application, on successful calls only. Trial: 10 calls per IP per UTC day without a key, shared by REST and MCP.
- Auth: `Authorization: Bearer <key>` for billed calls. Retries: reuse `Idempotency-Key`.

## Request body

- `current` (object, required)
- `previous` (object): Prior certified application. Its G703 supplies the approved SOV and its G702 line 6 supplies the current line 7. For variable retainage, carry forward the prior holdback, including when stored materials move into completed work. Infer the rates on newly billed work and materials from column I or the remaining G702 line 5 amount. An amount covering both work and stored materials implies a blended rate.
- `retainageChange` (object): New retainage rates for an agreed change or release, in percentage points. Use 0 for each released category. Fixed rates must match these values. For variable retainage these rates set the minimum amount on each item.
- `retainageChange.completedWorkRate` (number (0 to 100), required): Percentage points, e.g. 10 for 10%.
- `retainageChange.storedMaterialsRate` (number (0 to 100), required): Percentage points, e.g. 10 for 10%.
- `changeOrders` (array of object): All approved changes through the current period. Omitting this list carries forward the prior approved SOV and net change when available.

## Response

- `edition` (1992, required)
- `sources` (object, required)
- `sources.G702` (string, required)
- `sources.G703` (string, required)
- `sources.G702Instructions` (string, required)
- `needs_review` (boolean, required)
- `findings` (array of object, required)
- `findings[].rule` ("unmapped_header" | "missing_header" | "calculation_mismatch" | "scheduled_value_mismatch" | "overbilling" | "undefined_percent" | … (20 values), required)
- `findings[].severity` ("mismatch" | "needs_review", required)
- `findings[].form` ("G702" | "G703", required)
- `findings[].column` (string, required): G702 line, G703 column, or one-based position of an unrecognized header.
- `findings[].application` ("current" | "previous")
- `findings[].skippedChecks` (array of string): Checks blocked by a missing G703 header.
- `findings[].row` (integer (-9007199254740991 to 9007199254740991)): Current JSON line number or spreadsheet row/CSV record, one-based.
- `findings[].item` (string)
- `findings[].changeOrderId` (string)
- `findings[].expected` (number | string | null, required)
- `findings[].actual` (number | string | null, required)
- `lines` (array of object, required)
- `lines[].row` (integer (-9007199254740991 to 9007199254740991), required)
- `lines[].item` (string, required)
- `lines[].description` (string, required)
- `lines[].scheduledValue` (number, required)
- `lines[].previousWork` (number, required)
- `lines[].currentWork` (number, required)
- `lines[].storedMaterials` (number, required)
- `lines[].totalCompletedAndStored` (number, required)
- `lines[].percentComplete` (number | null, required)
- `lines[].balanceToFinish` (number, required)
- `lines[].retainage` (number | null, required)
- `summary` (object, required)
- `summary.originalContractSum` (number, required)
- `summary.netChangeOrders` (number | null, required)
- `summary.contractSumToDate` (number | null, required)
- `summary.totalCompletedAndStored` (number | null, required)
- `summary.retainage` (object, required)
- `summary.retainage.completedWork` (number | null, required)
- `summary.retainage.storedMaterials` (number | null, required)
- `summary.retainage.total` (number | null, required)
- `summary.earnedLessRetainage` (number | null, required)
- `summary.previousCertificates` (number, required)
- `summary.currentPaymentDue` (number | null, required)
- `summary.balanceToFinish` (number | null, required)

## Example

```sh
curl https://api.kanagu.dev/v1/payapp/check \
  -H "Authorization: Bearer $KANAGU_KEY" \
  -H "Content-Type: application/json" \
  -d '{"current":{"summary":{"originalContractSum":12000,"netChangeOrders":0,"contractSumToDate":12000,"totalCompletedAndStored":4500,"retainage":{"mode":"fixed","completedWorkRate":10,"storedMaterialsRate":5,"completedWork":350,"storedMaterials":50,"total":400},"earnedLessRetainage":4100,"previousCertificates":0,"currentPaymentDue":4100,"balanceToFinish":7900},"continuationSheet":{"format":"json","lines":[{"item":"03-100","description":"Concrete formwork","scheduledValue":12000,"previousWork":0,"currentWork":3500,"storedMaterials":1000,"totalCompletedAndStored":4500,"percentComplete":37.5,"balanceToFinish":7500}]}}}'
```

```ts
const res = await fetch("https://api.kanagu.dev/v1/payapp/check", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KANAGU_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "current": {
      "summary": {
        "originalContractSum": 12000,
        "netChangeOrders": 0,
        "contractSumToDate": 12000,
        "totalCompletedAndStored": 4500,
        "retainage": {
          "mode": "fixed",
          "completedWorkRate": 10,
          "storedMaterialsRate": 5,
          "completedWork": 350,
          "storedMaterials": 50,
          "total": 400
        },
        "earnedLessRetainage": 4100,
        "previousCertificates": 0,
        "currentPaymentDue": 4100,
        "balanceToFinish": 7900
      },
      "continuationSheet": {
        "format": "json",
        "lines": [
          {
            "item": "03-100",
            "description": "Concrete formwork",
            "scheduledValue": 12000,
            "previousWork": 0,
            "currentWork": 3500,
            "storedMaterials": 1000,
            "totalCompletedAndStored": 4500,
            "percentComplete": 37.5,
            "balanceToFinish": 7500
          }
        ]
      }
    }
  }),
});
if (!res.ok) throw new Error((await res.json()).error.message);
const result = await res.json();
```

## Errors

JSON `{"error":{"code","message"}}`.

- 400 `invalid_input`: The body does not match the request schema. The message names each field.
- 400 `invalid_json`: The body is missing or is not valid JSON.
- 400 `invalid_idempotency_key`: Idempotency-Key must be 1–128 visible ASCII characters.
- 401 `invalid_api_key`: The Bearer key is missing, malformed, invalid or inactive.
- 402 `free_allowance_exhausted`: This month's free usage is used up and the account has no subscription. Subscribe from the dashboard, or wait for the next UTC month; Retry-After gives the seconds left.
- 404 `not_found`: No operation at this path.
- 409 `idempotency_conflict`: The Idempotency-Key was already used with a different body.
- 413 `payload_too_large`: JSON bodies may be at most 64 KiB.
- 429 `trial_limit`: The anonymous trial allows 10 calls per IP per UTC day, shared by REST and MCP. Retry-After gives the seconds left.
- 500 `internal_error`: The call failed on our side. It is not billed; retry with the same Idempotency-Key.

## JSON Schema

Request:
```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "current": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "summary": {
              "type": "object",
              "properties": {
                "originalContractSum": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1000000000,
                  "multipleOf": 0.01,
                  "description": "Signed USD to the cent."
                },
                "netChangeOrders": {
                  "type": "number",
                  "minimum": -1000000000,
                  "maximum": 1000000000,
                  "multipleOf": 0.01,
                  "description": "Signed USD to the cent."
                },
                "contractSumToDate": {
                  "type": "number",
                  "minimum": -1000000000,
                  "maximum": 1000000000,
                  "multipleOf": 0.01,
                  "description": "Signed USD to the cent."
                },
                "totalCompletedAndStored": {
                  "type": "number",
                  "minimum": -1000000000,
                  "maximum": 1000000000,
                  "multipleOf": 0.01,
                  "description": "Signed USD to the cent."
                },
                "retainage": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "completedWorkRate": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100,
                          "multipleOf": 0.0001,
                          "description": "Percentage points, e.g. 10 for 10%."
                        },
                        "storedMaterialsRate": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100,
                          "multipleOf": 0.0001,
                          "description": "Percentage points, e.g. 10 for 10%."
                        },
                        "mode": {
                          "type": "string",
                          "const": "fixed"
                        },
                        "completedWork": {
                          "description": "Reported G702 line 5a amount.",
                          "type": "number",
                          "minimum": -1000000000,
                          "maximum": 1000000000,
                          "multipleOf": 0.01
                        },
                        "storedMaterials": {
                          "description": "Reported G702 line 5b amount.",
                          "type": "number",
                          "minimum": -1000000000,
                          "maximum": 1000000000,
                          "multipleOf": 0.01
                        },
                        "total": {
                          "type": "number",
                          "minimum": -1000000000,
                          "maximum": 1000000000,
                          "multipleOf": 0.01,
                          "description": "G702 line 5 total."
                        }
                      },
                      "required": [
                        "mode",
                        "total"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "mode": {
                          "type": "string",
                          "const": "variable"
                        },
                        "total": {
                          "type": "number",
                          "minimum": -1000000000,
                          "maximum": 1000000000,
                          "multipleOf": 0.01,
                          "description": "G702 line 5 total, from G703 column I."
                        }
                      },
                      "required": [
                        "mode",
                        "total"
                      ],
                      "additionalProperties": false
                    }
                  ]
                },
                "earnedLessRetainage": {
                  "type": "number",
                  "minimum": -1000000000,
                  "maximum": 1000000000,
                  "multipleOf": 0.01,
                  "description": "Signed USD to the cent."
                },
                "previousCertificates": {
                  "type": "number",
                  "minimum": -1000000000,
                  "maximum": 1000000000,
                  "multipleOf": 0.01,
                  "description": "Signed USD to the cent."
                },
                "currentPaymentDue": {
                  "type": "number",
                  "minimum": -1000000000,
                  "maximum": 1000000000,
                  "multipleOf": 0.01,
                  "description": "Signed USD to the cent."
                },
                "balanceToFinish": {
                  "type": "number",
                  "minimum": -1000000000,
                  "maximum": 1000000000,
                  "multipleOf": 0.01,
                  "description": "G702 line 9, including retainage."
                }
              },
              "required": [
                "originalContractSum",
                "netChangeOrders",
                "contractSumToDate",
                "totalCompletedAndStored",
                "retainage",
                "earnedLessRetainage",
                "previousCertificates",
                "currentPaymentDue",
                "balanceToFinish"
              ],
              "additionalProperties": false
            },
            "continuationSheet": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "format": {
                      "type": "string",
                      "const": "json"
                    },
                    "lines": {
                      "minItems": 1,
                      "maxItems": 500,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "item": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100,
                            "description": "Stable G703 item identifier."
                          },
                          "description": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 500
                          },
                          "scheduledValue": {
                            "type": "number",
                            "minimum": -1000000000,
                            "maximum": 1000000000,
                            "multipleOf": 0.01,
                            "description": "Signed USD to the cent."
                          },
                          "previousWork": {
                            "type": "number",
                            "minimum": -1000000000,
                            "maximum": 1000000000,
                            "multipleOf": 0.01,
                            "description": "Signed USD to the cent."
                          },
                          "currentWork": {
                            "type": "number",
                            "minimum": -1000000000,
                            "maximum": 1000000000,
                            "multipleOf": 0.01,
                            "description": "Signed USD to the cent."
                          },
                          "storedMaterials": {
                            "type": "number",
                            "minimum": -1000000000,
                            "maximum": 1000000000,
                            "multipleOf": 0.01,
                            "description": "Signed USD to the cent."
                          },
                          "totalCompletedAndStored": {
                            "type": "number",
                            "minimum": -1000000000,
                            "maximum": 1000000000,
                            "multipleOf": 0.01,
                            "description": "Signed USD to the cent."
                          },
                          "percentComplete": {
                            "description": "Percentage points, e.g. 50 for 50%.",
                            "type": "number"
                          },
                          "balanceToFinish": {
                            "type": "number",
                            "minimum": -1000000000,
                            "maximum": 1000000000,
                            "multipleOf": 0.01,
                            "description": "Signed USD to the cent."
                          },
                          "retainage": {
                            "description": "G703 column I for variable retainage.",
                            "type": "number",
                            "minimum": -1000000000,
                            "maximum": 1000000000,
                            "multipleOf": 0.01
                          }
                        },
                        "required": [
                          "item",
                          "description",
                          "scheduledValue",
                          "previousWork",
                          "currentWork",
                          "storedMaterials"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "format",
                    "lines"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "format": {
                      "type": "string",
                      "const": "csv"
                    },
                    "text": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 524288,
                      "description": "CSV text with a header and up to 500 item rows."
                    }
                  },
                  "required": [
                    "format",
                    "text"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "format": {
                      "type": "string",
                      "const": "xlsx"
                    },
                    "base64": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 699052,
                      "format": "base64",
                      "contentEncoding": "base64",
                      "pattern": "^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$",
                      "description": "Base64 XLSX up to 512 KiB. Recalculate formulas before saving."
                    },
                    "sheet": {
                      "description": "Worksheet name. Defaults to the first worksheet.",
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 31
                    }
                  },
                  "required": [
                    "format",
                    "base64"
                  ],
                  "additionalProperties": false
                }
              ],
              "description": "For CSV and XLSX, start with a single header row using the JSON line field names or G703 labels. Include only SOV item rows. Include item, description, and G703 columns C–I including percent complete. Missing financial columns and unrecognized headers require review. Use 0 for empty amounts in columns D–F. Use percentage points in CSV and Excel percentage cells in XLSX."
            },
            "percentDecimals": {
              "description": "Displayed G703 percent precision. Defaults to 2. Use 0 for whole percentages.",
              "type": "integer",
              "minimum": 0,
              "maximum": 4
            }
          },
          "required": [
            "summary",
            "continuationSheet"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "format": {
              "type": "string",
              "const": "xlsx"
            },
            "base64": {
              "type": "string",
              "minLength": 1,
              "maxLength": 699052,
              "format": "base64",
              "contentEncoding": "base64",
              "pattern": "^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$",
              "description": "Base64 XLSX up to 512 KiB. Recalculate formulas before saving."
            },
            "percentDecimals": {
              "description": "Displayed G703 percent precision. Defaults to 2. Use 0 for whole percentages.",
              "type": "integer",
              "minimum": 0,
              "maximum": 4
            }
          },
          "required": [
            "format",
            "base64"
          ],
          "additionalProperties": false,
          "description": "Workbook with sheets named G702 and G703. In G702 use columns A–C for line number, amount, and optional Excel percentage rate. Include lines 1–9 and use 5 for total retainage. Include 5a and/or 5b for fixed retainage. Use the reported amounts on lines 5a and 5b or, when those amounts are blank, the total of G703 column I. A rate without either source requires review of the eligible base. In G703 use a single header row for columns A–I including percent complete, followed by SOV items. Missing financial columns and unrecognized headers require review."
        }
      ]
    },
    "previous": {
      "description": "Prior certified application. Its G703 supplies the approved SOV and its G702 line 6 supplies the current line 7. For variable retainage, carry forward the prior holdback, including when stored materials move into completed work. Infer the rates on newly billed work and materials from column I or the remaining G702 line 5 amount. An amount covering both work and stored materials implies a blended rate.",
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "summary": {
              "type": "object",
              "properties": {
                "originalContractSum": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1000000000,
                  "multipleOf": 0.01,
                  "description": "Signed USD to the cent."
                },
                "netChangeOrders": {
                  "type": "number",
                  "minimum": -1000000000,
                  "maximum": 1000000000,
                  "multipleOf": 0.01,
                  "description": "Signed USD to the cent."
                },
                "contractSumToDate": {
                  "type": "number",
                  "minimum": -1000000000,
                  "maximum": 1000000000,
                  "multipleOf": 0.01,
                  "description": "Signed USD to the cent."
                },
                "totalCompletedAndStored": {
                  "type": "number",
                  "minimum": -1000000000,
                  "maximum": 1000000000,
                  "multipleOf": 0.01,
                  "description": "Signed USD to the cent."
                },
                "retainage": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "completedWorkRate": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100,
                          "multipleOf": 0.0001,
                          "description": "Percentage points, e.g. 10 for 10%."
                        },
                        "storedMaterialsRate": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100,
                          "multipleOf": 0.0001,
                          "description": "Percentage points, e.g. 10 for 10%."
                        },
                        "mode": {
                          "type": "string",
                          "const": "fixed"
                        },
                        "completedWork": {
                          "description": "Reported G702 line 5a amount.",
                          "type": "number",
                          "minimum": -1000000000,
                          "maximum": 1000000000,
                          "multipleOf": 0.01
                        },
                        "storedMaterials": {
                          "description": "Reported G702 line 5b amount.",
                          "type": "number",
                          "minimum": -1000000000,
                          "maximum": 1000000000,
                          "multipleOf": 0.01
                        },
                        "total": {
                          "type": "number",
                          "minimum": -1000000000,
                          "maximum": 1000000000,
                          "multipleOf": 0.01,
                          "description": "G702 line 5 total."
                        }
                      },
                      "required": [
                        "mode",
                        "total"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "mode": {
                          "type": "string",
                          "const": "variable"
                        },
                        "total": {
                          "type": "number",
                          "minimum": -1000000000,
                          "maximum": 1000000000,
                          "multipleOf": 0.01,
                          "description": "G702 line 5 total, from G703 column I."
                        }
                      },
                      "required": [
                        "mode",
                        "total"
                      ],
                      "additionalProperties": false
                    }
                  ]
                },
                "earnedLessRetainage": {
                  "type": "number",
                  "minimum": -1000000000,
                  "maximum": 1000000000,
                  "multipleOf": 0.01,
                  "description": "Signed USD to the cent."
                },
                "previousCertificates": {
                  "type": "number",
                  "minimum": -1000000000,
                  "maximum": 1000000000,
                  "multipleOf": 0.01,
                  "description": "Signed USD to the cent."
                },
                "currentPaymentDue": {
                  "type": "number",
                  "minimum": -1000000000,
                  "maximum": 1000000000,
                  "multipleOf": 0.01,
                  "description": "Signed USD to the cent."
                },
                "balanceToFinish": {
                  "type": "number",
                  "minimum": -1000000000,
                  "maximum": 1000000000,
                  "multipleOf": 0.01,
                  "description": "G702 line 9, including retainage."
                }
              },
              "required": [
                "originalContractSum",
                "netChangeOrders",
                "contractSumToDate",
                "totalCompletedAndStored",
                "retainage",
                "earnedLessRetainage",
                "previousCertificates",
                "currentPaymentDue",
                "balanceToFinish"
              ],
              "additionalProperties": false
            },
            "continuationSheet": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "format": {
                      "type": "string",
                      "const": "json"
                    },
                    "lines": {
                      "minItems": 1,
                      "maxItems": 500,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "item": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100,
                            "description": "Stable G703 item identifier."
                          },
                          "description": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 500
                          },
                          "scheduledValue": {
                            "type": "number",
                            "minimum": -1000000000,
                            "maximum": 1000000000,
                            "multipleOf": 0.01,
                            "description": "Signed USD to the cent."
                          },
                          "previousWork": {
                            "type": "number",
                            "minimum": -1000000000,
                            "maximum": 1000000000,
                            "multipleOf": 0.01,
                            "description": "Signed USD to the cent."
                          },
                          "currentWork": {
                            "type": "number",
                            "minimum": -1000000000,
                            "maximum": 1000000000,
                            "multipleOf": 0.01,
                            "description": "Signed USD to the cent."
                          },
                          "storedMaterials": {
                            "type": "number",
                            "minimum": -1000000000,
                            "maximum": 1000000000,
                            "multipleOf": 0.01,
                            "description": "Signed USD to the cent."
                          },
                          "totalCompletedAndStored": {
                            "type": "number",
                            "minimum": -1000000000,
                            "maximum": 1000000000,
                            "multipleOf": 0.01,
                            "description": "Signed USD to the cent."
                          },
                          "percentComplete": {
                            "description": "Percentage points, e.g. 50 for 50%.",
                            "type": "number"
                          },
                          "balanceToFinish": {
                            "type": "number",
                            "minimum": -1000000000,
                            "maximum": 1000000000,
                            "multipleOf": 0.01,
                            "description": "Signed USD to the cent."
                          },
                          "retainage": {
                            "description": "G703 column I for variable retainage.",
                            "type": "number",
                            "minimum": -1000000000,
                            "maximum": 1000000000,
                            "multipleOf": 0.01
                          }
                        },
                        "required": [
                          "item",
                          "description",
                          "scheduledValue",
                          "previousWork",
                          "currentWork",
                          "storedMaterials"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "format",
                    "lines"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "format": {
                      "type": "string",
                      "const": "csv"
                    },
                    "text": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 524288,
                      "description": "CSV text with a header and up to 500 item rows."
                    }
                  },
                  "required": [
                    "format",
                    "text"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "format": {
                      "type": "string",
                      "const": "xlsx"
                    },
                    "base64": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 699052,
                      "format": "base64",
                      "contentEncoding": "base64",
                      "pattern": "^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$",
                      "description": "Base64 XLSX up to 512 KiB. Recalculate formulas before saving."
                    },
                    "sheet": {
                      "description": "Worksheet name. Defaults to the first worksheet.",
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 31
                    }
                  },
                  "required": [
                    "format",
                    "base64"
                  ],
                  "additionalProperties": false
                }
              ],
              "description": "For CSV and XLSX, start with a single header row using the JSON line field names or G703 labels. Include only SOV item rows. Include item, description, and G703 columns C–I including percent complete. Missing financial columns and unrecognized headers require review. Use 0 for empty amounts in columns D–F. Use percentage points in CSV and Excel percentage cells in XLSX."
            },
            "percentDecimals": {
              "description": "Displayed G703 percent precision. Defaults to 2. Use 0 for whole percentages.",
              "type": "integer",
              "minimum": 0,
              "maximum": 4
            }
          },
          "required": [
            "summary",
            "continuationSheet"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "format": {
              "type": "string",
              "const": "xlsx"
            },
            "base64": {
              "type": "string",
              "minLength": 1,
              "maxLength": 699052,
              "format": "base64",
              "contentEncoding": "base64",
              "pattern": "^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$",
              "description": "Base64 XLSX up to 512 KiB. Recalculate formulas before saving."
            },
            "percentDecimals": {
              "description": "Displayed G703 percent precision. Defaults to 2. Use 0 for whole percentages.",
              "type": "integer",
              "minimum": 0,
              "maximum": 4
            }
          },
          "required": [
            "format",
            "base64"
          ],
          "additionalProperties": false,
          "description": "Workbook with sheets named G702 and G703. In G702 use columns A–C for line number, amount, and optional Excel percentage rate. Include lines 1–9 and use 5 for total retainage. Include 5a and/or 5b for fixed retainage. Use the reported amounts on lines 5a and 5b or, when those amounts are blank, the total of G703 column I. A rate without either source requires review of the eligible base. In G703 use a single header row for columns A–I including percent complete, followed by SOV items. Missing financial columns and unrecognized headers require review."
        }
      ]
    },
    "retainageChange": {
      "description": "New retainage rates for an agreed change or release, in percentage points. Use 0 for each released category. Fixed rates must match these values. For variable retainage these rates set the minimum amount on each item.",
      "type": "object",
      "properties": {
        "completedWorkRate": {
          "type": "number",
          "minimum": 0,
          "maximum": 100,
          "multipleOf": 0.0001,
          "description": "Percentage points, e.g. 10 for 10%."
        },
        "storedMaterialsRate": {
          "type": "number",
          "minimum": 0,
          "maximum": 100,
          "multipleOf": 0.0001,
          "description": "Percentage points, e.g. 10 for 10%."
        }
      },
      "required": [
        "completedWorkRate",
        "storedMaterialsRate"
      ],
      "additionalProperties": false
    },
    "changeOrders": {
      "description": "All approved changes through the current period. Omitting this list carries forward the prior approved SOV and net change when available.",
      "maxItems": 500,
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "amount": {
                "type": "number",
                "minimum": -1000000000,
                "maximum": 1000000000,
                "multipleOf": 0.01,
                "description": "Total approved amount, including signed deductions."
              },
              "reflectedInPrevious": {
                "description": "With a prior application, set true for orders already included in its approved SOV and false for new orders. An unknown period requires review.",
                "type": "boolean"
              },
              "item": {
                "description": "G703 item receiving the full amount. Defaults to the order ID.",
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              }
            },
            "required": [
              "id",
              "amount"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "amount": {
                "type": "number",
                "minimum": -1000000000,
                "maximum": 1000000000,
                "multipleOf": 0.01,
                "description": "Total approved amount, including signed deductions."
              },
              "reflectedInPrevious": {
                "description": "With a prior application, set true for orders already included in its approved SOV and false for new orders. An unknown period requires review.",
                "type": "boolean"
              },
              "allocations": {
                "minItems": 1,
                "maxItems": 500,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "item": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "amount": {
                      "type": "number",
                      "minimum": -1000000000,
                      "maximum": 1000000000,
                      "multipleOf": 0.01,
                      "description": "Signed USD to the cent."
                    }
                  },
                  "required": [
                    "item",
                    "amount"
                  ],
                  "additionalProperties": false
                },
                "description": "Signed amounts by G703 item. The amounts must sum to the order total."
              }
            },
            "required": [
              "id",
              "amount",
              "allocations"
            ],
            "additionalProperties": false
          }
        ]
      }
    }
  },
  "required": [
    "current"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "current": {
        "summary": {
          "originalContractSum": 12000,
          "netChangeOrders": 0,
          "contractSumToDate": 12000,
          "totalCompletedAndStored": 4500,
          "retainage": {
            "mode": "fixed",
            "completedWorkRate": 10,
            "storedMaterialsRate": 5,
            "completedWork": 350,
            "storedMaterials": 50,
            "total": 400
          },
          "earnedLessRetainage": 4100,
          "previousCertificates": 0,
          "currentPaymentDue": 4100,
          "balanceToFinish": 7900
        },
        "continuationSheet": {
          "format": "json",
          "lines": [
            {
              "item": "03-100",
              "description": "Concrete formwork",
              "scheduledValue": 12000,
              "previousWork": 0,
              "currentWork": 3500,
              "storedMaterials": 1000,
              "totalCompletedAndStored": 4500,
              "percentComplete": 37.5,
              "balanceToFinish": 7500
            }
          ]
        }
      }
    }
  ]
}
```

Response:
```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "edition": {
      "type": "number",
      "const": 1992
    },
    "sources": {
      "type": "object",
      "properties": {
        "G702": {
          "type": "string"
        },
        "G703": {
          "type": "string"
        },
        "G702Instructions": {
          "type": "string"
        }
      },
      "required": [
        "G702",
        "G703",
        "G702Instructions"
      ],
      "additionalProperties": false
    },
    "needs_review": {
      "type": "boolean"
    },
    "findings": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "rule": {
            "type": "string",
            "enum": [
              "unmapped_header",
              "missing_header",
              "calculation_mismatch",
              "scheduled_value_mismatch",
              "overbilling",
              "undefined_percent",
              "carry_forward_mismatch",
              "prior_item_missing",
              "stored_materials_reduction",
              "retainage_reduction",
              "retainage_rate_drift",
              "retainage_rate_ambiguous",
              "retainage_mode_changed",
              "retainage_missing",
              "amount_out_of_range",
              "change_order_missing",
              "change_order_unmapped",
              "change_order_period_unknown",
              "change_order_history_mismatch",
              "change_order_allocation_mismatch"
            ]
          },
          "severity": {
            "type": "string",
            "enum": [
              "mismatch",
              "needs_review"
            ]
          },
          "form": {
            "type": "string",
            "enum": [
              "G702",
              "G703"
            ]
          },
          "column": {
            "type": "string",
            "description": "G702 line, G703 column, or one-based position of an unrecognized header."
          },
          "application": {
            "type": "string",
            "enum": [
              "current",
              "previous"
            ]
          },
          "skippedChecks": {
            "description": "Checks blocked by a missing G703 header.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "row": {
            "description": "Current JSON line number or spreadsheet row/CSV record, one-based.",
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "item": {
            "type": "string"
          },
          "changeOrderId": {
            "type": "string"
          },
          "expected": {
            "type": [
              "number",
              "string",
              "null"
            ]
          },
          "actual": {
            "type": [
              "number",
              "string",
              "null"
            ]
          }
        },
        "required": [
          "rule",
          "severity",
          "form",
          "column",
          "expected",
          "actual"
        ],
        "additionalProperties": false
      }
    },
    "lines": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "row": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "item": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "scheduledValue": {
            "type": "number"
          },
          "previousWork": {
            "type": "number"
          },
          "currentWork": {
            "type": "number"
          },
          "storedMaterials": {
            "type": "number"
          },
          "totalCompletedAndStored": {
            "type": "number"
          },
          "percentComplete": {
            "type": [
              "number",
              "null"
            ]
          },
          "balanceToFinish": {
            "type": "number"
          },
          "retainage": {
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "row",
          "item",
          "description",
          "scheduledValue",
          "previousWork",
          "currentWork",
          "storedMaterials",
          "totalCompletedAndStored",
          "percentComplete",
          "balanceToFinish",
          "retainage"
        ],
        "additionalProperties": false
      }
    },
    "summary": {
      "type": "object",
      "properties": {
        "originalContractSum": {
          "type": "number"
        },
        "netChangeOrders": {
          "type": [
            "number",
            "null"
          ]
        },
        "contractSumToDate": {
          "type": [
            "number",
            "null"
          ]
        },
        "totalCompletedAndStored": {
          "type": [
            "number",
            "null"
          ]
        },
        "retainage": {
          "type": "object",
          "properties": {
            "completedWork": {
              "type": [
                "number",
                "null"
              ]
            },
            "storedMaterials": {
              "type": [
                "number",
                "null"
              ]
            },
            "total": {
              "type": [
                "number",
                "null"
              ]
            }
          },
          "required": [
            "completedWork",
            "storedMaterials",
            "total"
          ],
          "additionalProperties": false
        },
        "earnedLessRetainage": {
          "type": [
            "number",
            "null"
          ]
        },
        "previousCertificates": {
          "type": "number"
        },
        "currentPaymentDue": {
          "type": [
            "number",
            "null"
          ]
        },
        "balanceToFinish": {
          "type": [
            "number",
            "null"
          ]
        }
      },
      "required": [
        "originalContractSum",
        "netChangeOrders",
        "contractSumToDate",
        "totalCompletedAndStored",
        "retainage",
        "earnedLessRetainage",
        "previousCertificates",
        "currentPaymentDue",
        "balanceToFinish"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "edition",
    "sources",
    "needs_review",
    "findings",
    "lines",
    "summary"
  ],
  "additionalProperties": false
}
```
