---
title: "Get generic entity grid with configurable associations"
method: GET
path: "/v3/api/entity-grid/{context_id}"
tags: ["entity-grid"]
---

# Get generic entity grid with configurable associations

`GET /v3/api/entity-grid/{context_id}`

Returns a generic entity × entity grid with configurable association categories.

    This endpoint allows you to specify:
    - **column_association_category**: One or more association categories for the
      context → column hop (e.g., causal gene-disease, correlated gene-disease)
    - **row_association_category**: The association category for the column → row hop
    - **row_grouping**: How to group rows (histopheno for body systems, or none)
    - **group_columns_by_category**: Whether to sort columns by their source association

    Example: To get a grid of diseases (causal + correlated) and their phenotypes for a gene:
    ```
    GET /entity-grid/HGNC:4851?column_association_category=biolink:CausalGeneToDiseaseAssociation
        &column_association_category=biolink:CorrelatedGeneToDiseaseAssociation
        &row_association_category=biolink:DiseaseToPhenotypicFeatureAssociation
        &group_columns_by_category=true
    ```

    The response includes source_association_category on each column entity,
    allowing the frontend to display different column groups.

## Path parameters

- `context_id` string, required — Context entity ID (gene, disease, etc.)

## Query parameters

- `column_association_category` AssociationCategory[], required — Association category/categories for context → column
- `row_association_category` AssociationCategory[], required — Association category/categories for column → row
- `row_grouping` 'histopheno' | 'none' — Row grouping options.
- `group_columns_by_category` boolean — Sort columns by association category
- `direct` boolean — Only include direct associations (not via closure)
- `limit` integer — Maximum number of column entities

## Response `200`

Successful Response

- EntityGridResponse — Generic entity x entity grid response
  - `context_id` string, required — The identifier of the context entity (e.g., disease, gene)
  - `context_name` string, nullable — The name of the context entity
  - `context_category` string, required — The biolink category of the context entity
  - `total_columns` integer, required — Total number of column entities in the grid
  - `total_rows` integer, required — Total number of row entities in the grid
  - `columns` GridColumnEntity[], required — List of column entities in the grid
    - `id` string, required
    - `label` string, nullable
    - `category` string, required
    - `is_direct` boolean, nullable — Whether the case is directly associated with the disease or via a descendant
    - `source_id` string, nullable — For indirect associations, the ID of the direct entity
    - `source_label` string, nullable — For indirect associations, the label of the direct entity
    - `taxon` string, nullable — The taxon ID of the entity
    - `taxon_label` string, nullable — The taxon label of the entity
    - `source_association_category` string, nullable — The biolink category of the source association
    - `source_association_predicate` string, nullable — The predicate of the source association
    - `source_association_publications` string[], nullable — Publication CURIEs supporting the source association
    - `source_association_evidence_count` integer, nullable — Number of evidence items supporting the source association
    - `source_association_primary_knowledge_source` string, nullable — Primary knowledge source for the source association
  - `rows` GridRowEntity[], required — List of row entities in the grid
    - `id` string, required
    - `label` string, nullable
    - `category` string, required
    - `bin_id` string, required — The identifier for the histopheno bin a phenotype belongs to
  - `bins` GridBin[], required — List of bins for grouping row entities
    - `id` string, required
    - `label` string, required
    - `count` integer, required — count of documents
  - `cells` object, required — Map of column_id:row_id to cell data

## Other responses

- `400` — Column count exceeds limit, or ID category mismatch
- `404` — Entity not found
- `422` — Invalid entity ID format

---

[API](https://skmtc.dev/monarchinitiative/apis/fastapi.md) · [All operations](https://skmtc.dev/monarchinitiative/apis/fastapi/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/monarchinitiative/fastapi/revisions/2ceb106a8c03/schema)
