<div class="section-label"><span class="num">01</span> Grid</div>
<div class="section-title">The primary hosted <em>analysis</em> path.</div>
`POST /grid` evaluates attribute combinations across thresholds, then returns a fit-weighted composite. Prefer a [[API/Clients/Introduction|language client]] unless you are writing HTTP yourself. What Grid means: [[Functions/Grid Prediction|Grid Prediction]].
**Call:** `POST /grid`
**Auth:** `x-api-key` header + `access_id` in the body
**Returns:** a receipt, then poll [[API/Endpoints/Results|Results]]
## Signature
```http
POST https://api.csanalytics.io/v3/rbp-engine/grid
```
Required JSON body:
```text
{
access_id, # your user access id
y, # outcomes, N numbers
X # attributes, N rows of K numbers
}
```
Optional: `theta` (one circumstance, or several rows) and `options` ([[Settings/Options#GridOptions|GridOptions]]). If you omit `theta`, the engine uses the last row of `X`. Array layouts: [[API/Limits/Arrays|Arrays]].
## Example
```python
import os, time, requests
base = "https://api.csanalytics.io/v3/rbp-engine"
headers = {
"x-api-key": os.environ["CSA_API_KEY"],
"Content-Type": "application/json",
}
payload = {
"access_id": os.environ["CSA_ACCESS_ID"],
"y": [0.1, 0.2, 0.3],
"X": [[1.0, 0.0], [0.0, 1.0], [1.0, 1.0]],
}
receipt = requests.post(f"{base}/grid", headers=headers, json=payload).json()
job_id, job_code = receipt["job_id"], receipt["job_code"]
while True:
r = requests.get(f"{base}/results/{job_id}/{job_code}", headers=headers)
if r.status_code == 202:
time.sleep(2)
continue
r.raise_for_status()
print(r.json()["results"]["yhat"])
break
```
A successful POST returns a receipt, not the forecast:
```json
{ "job_id": 1074, "job_code": "66cfc21f7effa501" }
```
Client that wraps this loop: [[API/Clients/Python|Python]]. Example: [post_grid.py](https://github.com/CambridgeSportsAnalytics/rbp-engine-api-client/blob/main/python/examples/post_grid.py).
## Options
Put settings on `options`, not at the top level. Omit `options` to use defaults. Names match [[Settings/Options#GridOptions|GridOptions]]. For logistic outcomes, set `prediction_scale` to `logistic`.
## Results
When the job finishes, [[API/Endpoints/Results|Results]] include the composite forecast, fit, and **Impact on Fit** / **Impact on Prediction**. [[Results/Grid Insights|Grid Insights]]
Full HTTP contract: [rbp-engine-api.json](https://github.com/CambridgeSportsAnalytics/rbp-engine-api-client/blob/main/openapi/rbp-engine-api.json).
## Related
- [[API/Introduction|API]] · [[API/Clients/Introduction|Clients]]
- [[API/Endpoints/MaxFit|MaxFit]] · [[API/Endpoints/PSR|PSR]] · [[API/Endpoints/Results|Results]]
- [[Functions/Grid Prediction|Grid Prediction]]
<div class="btn-row center">
<a class="btn-primary" href="/API/Clients/Python">Python client</a>
<a class="btn-ghost" href="/API/Endpoints/Results">Retrieve results</a>
</div>