# sizeRunFill

query · in the family [Reading your records](/reference/reading-your-records/)

## What it does

Spread a total over a size run’s ratio — whole units, the remainder to the largest shares, ties to the earlier size.

THE FILL: spread a total over a SizeRun's ratio — whole units by the largest-remainder law (each entry floor(total × share ÷ Σ shares), the remainder one unit at a time to the largest fractional parts, ties to the EARLIER entry; Σ = total exactly; a 0-share entry never receives a unit), answered in the run's stored order. The run tenant-scoped (a foreign/missing run refuses NOT_FOUND); total an integer 0..1000000000 (else VALIDATION). A pure read — nothing changes. Requires authentication.

## What happens

A read — a calculation, nothing is written. The quantities always add up to the total exactly.

## Who may call it

Capability area: **Reading your records** — Looking up and listing the records of your organization.

- Owner
- System Administrator
- Manager
- Associate Manager
- Warehouse Associate
- Sales Associate
- An API key whose scope allows `api:sizeRunFill`

## Arguments

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `sizeRunId` | [ID](/types/#scalars) `ID!` | yes | No further notes. |
| `total` | [Int](/types/#scalars) `Int!` | yes | No further notes. |

## Returns

[SizeRunFillCell](/types/SizeRunFillCell/) `[SizeRunFillCell!]!` — One filled entry of a size run: the OptionValue, its share, and the whole units it receives.

## Example request

```graphql
query ExampleSizeRunFill($sizeRunId: ID!, $total: Int!) {
  sizeRunFill(sizeRunId: $sizeRunId, total: $total) {
    optionValueId
    share
    quantity
  }
}
```

Variables:

```json
{
  "sizeRunId": "01900000-0000-7000-8000-d314eddc0000",
  "total": 1
}
```

## Example response

```json
{
  "data": {
    "sizeRunFill": [
      {
        "optionValueId": "01900000-0000-7000-8000-87193ed80000",
        "share": 1,
        "quantity": 1
      }
    ]
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": null,
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}
```

## Errors this call can answer

- `VALIDATION/INVALID` — Something in the request is not valid. ([VALIDATION](/errors/VALIDATION/))
- `AUTHN/REQUIRED` — Sign in to do this. ([AUTHN](/errors/AUTHN/))
- `AUTHZ/FORBIDDEN` — Your role does not allow this action. ([AUTHZ](/errors/AUTHZ/))
- `RATE_LIMIT/THROTTLED` — Too many requests in a short time. ([RATE_LIMIT](/errors/RATE_LIMIT/))
- `NOT_FOUND/*` — That record could not be found. ([NOT_FOUND](/errors/NOT_FOUND/))
