---
title: "Sample a representative subgraph"
method: POST
path: "/api/sample"
---

# Sample a representative subgraph

`POST /api/sample`

Returns a label-stratified, size-capped subgraph intended for visualization. One call replaces the `1 + <edge types>` sequential queries a client would otherwise issue to draw an overview, and the default of 200 nodes is the point past which a node-link diagram stops being legible.

## Request body

- object
  - `max_nodes` integer — Upper bound on returned nodes. Capped server-side at 1000.
  - `labels` string[] — Restrict sampling to these labels. Empty means all labels.
  - `graph` string — Tenant/graph name.

## Response `200`

A sampled subgraph

- object

## Changes

- **2026-08-18** `9b1635d24ee5` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/samyama-ai/apis/samyama-graph-database-api/changes/api/sample/post.md)

---

[API](https://skmtc.dev/samyama-ai/apis/samyama-graph-database-api.md) · [All operations](https://skmtc.dev/samyama-ai/apis/samyama-graph-database-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/samyama-ai/samyama-graph-database-api/revisions/7f3d37bbc2cd/schema)
