Apportion exact integer units
Allocate a declared integer total among exact nonnegative decimal weights using floors and largest remainders. Conserves units with exact quota evidence and ID tie breaks; no minima, caps, fairness certification, payments or monotonicity guarantee.
data-assurance · Operation ID: integer-apportion
Choose this operation when
- Divide a fixed total of indivisible units among weighted categories
- Produce integer weighted allocations whose sum equals the declared total
Outside this profile
- Fairness certification, eligibility decisions about people, payments, or resource reservations
- Monotonic allocation as total changes, recipient minimums or maximums
- Live execution, network lookups, payments, reservation, or inferring factual correctness of supplied data
Exact release references
Static JSON contract · Markdown reference · Fixed example response
Complete input schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"totalUnits": {
"type": "string",
"maxLength": 24,
"pattern": "^(?:0|[1-9]\\d{0,23})$",
"description": "Canonical nonnegative integer string, at most 24 digits"
},
"recipients": {
"minItems": 1,
"maxItems": 128,
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"weight": {
"type": "string",
"maxLength": 43,
"pattern": "^(?:0|[1-9]\\d{0,23})(?:\\.\\d{1,18})?$",
"description": "Nonnegative exact decimal string; 24 integer and 18 fraction digits; at least one weight positive"
}
},
"required": [
"id",
"weight"
],
"additionalProperties": false
}
}
},
"required": [
"totalUnits",
"recipients"
],
"additionalProperties": false
}
Complete output-envelope schema
{
"type": "object",
"required": [
"operation",
"version",
"result",
"provenance"
],
"properties": {
"operation": {
"const": "integer-apportion",
"type": "string"
},
"version": {
"const": "0.29.0",
"type": "string"
},
"result": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"profile": {
"type": "string",
"const": "largest-remainder-v1"
},
"advisoryOnly": {
"type": "boolean",
"const": true
},
"externalRequests": {
"type": "number",
"const": 0
},
"totalUnits": {
"type": "string",
"maxLength": 100,
"pattern": "^(?:0|[1-9]\\d*)$"
},
"allocatedTotal": {
"type": "string",
"maxLength": 100,
"pattern": "^(?:0|[1-9]\\d*)$"
},
"remainderUnits": {
"type": "string",
"const": "0"
},
"allocations": {
"maxItems": 128,
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"units": {
"type": "string",
"maxLength": 100,
"pattern": "^(?:0|[1-9]\\d*)$"
},
"floor": {
"type": "string",
"maxLength": 100,
"pattern": "^(?:0|[1-9]\\d*)$"
},
"extraUnit": {
"type": "boolean"
},
"quota": {
"type": "object",
"properties": {
"numerator": {
"type": "string",
"maxLength": 100,
"pattern": "^(?:0|[1-9]\\d*)$"
},
"denominator": {
"type": "string",
"maxLength": 100,
"pattern": "^[1-9]\\d*$"
}
},
"required": [
"numerator",
"denominator"
],
"additionalProperties": false
},
"remainder": {
"type": "object",
"properties": {
"numerator": {
"type": "string",
"maxLength": 100,
"pattern": "^(?:0|[1-9]\\d*)$"
},
"denominator": {
"type": "string",
"maxLength": 100,
"pattern": "^[1-9]\\d*$"
}
},
"required": [
"numerator",
"denominator"
],
"additionalProperties": false
}
},
"required": [
"id",
"units",
"floor",
"extraUnit",
"quota",
"remainder"
],
"additionalProperties": false
}
}
},
"required": [
"profile",
"advisoryOnly",
"externalRequests",
"totalUnits",
"allocatedTotal",
"remainderUnits",
"allocations"
],
"additionalProperties": false
},
"provenance": {
"type": "object",
"required": [
"inputSha256",
"outputSha256",
"deterministic",
"externalRequests"
],
"properties": {
"inputSha256": {
"type": "string",
"pattern": "^[a-f0-9]{64}$"
},
"outputSha256": {
"type": "string",
"pattern": "^[a-f0-9]{64}$"
},
"deterministic": {
"const": true
},
"externalRequests": {
"const": 0
}
}
}
},
"additionalProperties": false
}
Fixed example
One accepted fixed example, not a custom-input trial. No operation runs when this static page is requested.
Example input
{
"totalUnits": "7",
"recipients": [
{
"id": "a",
"weight": "5"
},
{
"id": "b",
"weight": "3"
},
{
"id": "c",
"weight": "2"
}
]
}
Example response
{
"operation": "integer-apportion",
"version": "0.29.0",
"result": {
"profile": "largest-remainder-v1",
"advisoryOnly": true,
"externalRequests": 0,
"totalUnits": "7",
"allocatedTotal": "7",
"remainderUnits": "0",
"allocations": [
{
"id": "a",
"units": "4",
"floor": "3",
"extraUnit": true,
"quota": {
"numerator": "7",
"denominator": "2"
},
"remainder": {
"numerator": "1",
"denominator": "2"
}
},
{
"id": "b",
"units": "2",
"floor": "2",
"extraUnit": false,
"quota": {
"numerator": "21",
"denominator": "10"
},
"remainder": {
"numerator": "1",
"denominator": "10"
}
},
{
"id": "c",
"units": "1",
"floor": "1",
"extraUnit": false,
"quota": {
"numerator": "7",
"denominator": "5"
},
"remainder": {
"numerator": "2",
"denominator": "5"
}
}
]
},
"provenance": {
"inputSha256": "9ddf2d69428662c833132d77986f8ca47250684ac4bca2b93c84eddcabf5afc5",
"outputSha256": "e58555a1109461b1bc3bfc820c78fbcb5225f855ca34d39e5d9c465cce4f1aaa",
"deterministic": true,
"externalRequests": 0
}
}
Bounds and precision
JavaScript IEEE-754 numbers; use strings for large integer IDs/exact decimals where the schema accepts strings. No lossless numeric parsing.
{
"global": {
"requestBytes": 131072,
"responseBytes": 524288,
"jsonDepth": 32,
"jsonNodes": 20000,
"requestsPerMinute": 60,
"paidAttemptsPerMinute": 20,
"idempotencyHours": 24
},
"operation": {
"inputBytes": 100000,
"outputBytes": 400000,
"jsonNodes": 12000,
"depth": 20,
"findings": 200,
"recipients": 128,
"totalIntegerDigits": 24,
"weightIntegerDigits": 24,
"weightFractionDigits": 18
}
}
Complete schemas, descriptions and cross-field validation may impose additional limits.
Proposed price and protocol definitions
{
"unit": "one successful operation call",
"proposedNominalUsd": "0.003",
"sixDecimalTokenBaseUnits": "3000",
"subscription": false,
"includesPayerWalletOrNetworkFees": false,
"liveQuoteVerified": false,
"condition": "Actual SDK challenge is authoritative only within the caller's explicit authorization; configured six-decimal token peg is an operator assertion, not a conversion guarantee."
}
Protocol definitions: x402, mpp. MPP uses Tempo charge. Paid MCP execution is unsupported. All runtime readiness is not evaluated in this build.
API path templates, not endpoints on this documentation host
{
"x402": "/v1/x402/integer-apportion",
"mpp": "/v1/mpp/integer-apportion"
}
Required headers
{
"Content-Type": "application/json",
"Idempotency-Key": "random 16–128 character operation identifier"
}
Actual SDK challenge amount, asset, network, recipient and wallet costs must pass independent authorization. Preserve identical key, body, protocol and credential on retries; on PAYMENT_UNCERTAIN stop and reconcile.
Execution profile and provider conditions
{
"deterministic": true,
"externalRequests": 0,
"maxExternalRequests": 0,
"resultSnapshotPersisted": false,
"fixedExampleIsIllustrativeSnapshot": false,
"requiresPayment": true,
"supportsMcpExecution": false
}
Deterministic supplied-input operation with no external requests or stored request/result bodies. Payment infrastructure retains payment metadata and hashes.
Failure handling
- HTTP 400: Malformed JSON, missing/invalid idempotency key, or payment identifier mismatch Correct the request before payment
- HTTP 402: Payment challenge or rejected payment Use official protocol SDK; inspect payment outcome before another payment
- HTTP 409: Idempotency conflict, duplicate proof, or PAYMENT_UNCERTAIN Keep original key, body, and proof; reconcile uncertainty with operator; never blindly repay
- HTTP 413: Input or generated output too large Reduce input; no payment attempted for validation failure
- HTTP 415: Unsupported media type or compression Send uncompressed application/json
- HTTP 422: Schema or service-specific semantic validation failure Correct input using returned error code; no payment attempted
- HTTP 429: Request/payment-attempt rate exceeded Wait for rate limit window; preserve existing payment identity
- HTTP 503: Payment configuration/provider/state unavailable, or live DNS preparation failed before settlement Check readiness; DNS preparation failures may retry the identical key/body/credential only; uncertainty requires reconciliation
Declared requirements
Before any paid call, refresh the live operation contract and POST the complete bounded budgeted plan to the separate API's /preflight. Unknown requirements block selection; compatible preflight is not permission to spend.