---
title: "Semantically-close context candidates (pgvector cosine + tag Jaccard overlap)"
method: GET
path: "/api/contexts/{id}/related"
tags: ["Contexts"]
---

# Semantically-close context candidates (pgvector cosine + tag Jaccard overlap)

`GET /api/contexts/{id}/related`

## Request

- Base URL: `http://localhost:38200`
- URL: `http://localhost:38200/api/contexts/{id}/related`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `token`

Degrades gracefully to tag-overlap-only ranking when the focal context has no embedding; returns an empty list when it has neither embedding nor tags.

## Path parameters

- `id` integer, required

## Query parameters

- `limit` integer
- `minScore` number

## Response `200`

Ranked candidates (empty array when there is no signal to rank on).

- object[]
  - `id` integer
  - `name` string
  - `type` string
  - `description` string
  - `lifecycle` string
  - `score` number
  - `vector_score` number, nullable
  - `tag_overlap` number
  - `shared_tags` string[]

## Other responses

- `400`: Invalid id.
- `401`: Missing or invalid credentials.
- `404`: Resource not found (or not visible to the caller).

---

[API](https://skmtc.dev/contextq/apis/contextq-api.md) · [All operations](https://skmtc.dev/contextq/apis/contextq-api/llms.txt) · [OpenAPI document](https://skmtc.dev/contextq/apis/contextq-api/revisions/7afc44056a22?raw)
