---
title: "Ref-Topic-Links"
method: GET
path: "/api/ref-topic-links/{tref}"
tags: ["Related"]
---

# Ref-Topic-Links

`GET /api/ref-topic-links/{tref}`

An API endpoint where, given a `Ref`, all of the topics linked to that `Ref` are retrieved along with the respective metadata.

## Response `200`

Successful response

- RefTopicLinksJSON — Response from the ref-topic-links endpoint
  - `linkType` string — The type of the link, based on the relationship within our ontology. Many links has an `is-a` relationship (such as `Genesis` `is-a` `Book`), but other topic-to-topic links have a variety of other types documented [here](https://developers.sefaria.org/docs/topic-ontology#overview-of-sefaria-link-types). Some examples include `child-of`, `parent-of`, `sibling-of` etc.
  - `class` 'refTopic' | 'intraTopic' — A classification of the link as either `refTopic` (i.e. a ref to a topic) or `intraTopic` (topic-to-topic). In this case, it would be expected that all returned topic links would be of type `refTopic`.
  - `dataSource` DataSourceJSON — JSON containing the information as to the source of the data for a given ref-to-topic link.
    - `en` string — English title of the data source.
    - `he` string — Hebrew title of the data source.
    - `slug` string — Unique slug describing the data source.
  - `is_sheet` boolean — Is this ref-to-topic link one that was generated by a user-created source sheet?
  - `order` OrderTopicLinkJSON — This JSON includes the various metrics that are relevant for ordering the link on a topics page. We use these metrics at [Sefaria.org](sefaria.org) to change the order on the topics page.
    - `tfidf` number, double — Results of the [tfidf algorithm](https://en.wikipedia.org/wiki/Tf%E2%80%93idf) run on the `Ref`s within a given topic, as another metric for evaluating the relevance of a given source on a topic page.
    - `numDatasource` integer — The number of datasources which connect this `Ref` to the topic. A value of `2` will occur when two sources (i.e. `aspaklaria` and `sefaria sheets` both have connections between this `Ref` and this topic.)
    - `availableLangs` string[] — This topic is available in a list of languages represented as strings with their language code.
    - `comp_date` integer — The date when the book referenced in the `Ref` was composed. Negative numbers indicate the work was composed BCE, whereas positive numbers indicate the book was composed CE.
    - `order_id` string — Unique ID for the `order` JSON.
    - `pr` number, double — `PageRank`. Sefaria calculates `PageRank` for the sources on a given topic page using the internal Sefaria links to create a link graph and then running the [PageRank algorithm](https://en.wikipedia.org/wiki/PageRank) on that. Sources with higher `PageRank` are considered to be more centrally linked and more relevant.
    - `curatedPrimacy` object — This field is used for manually ordering a source on a topics page. It has a separate order value for each language.
      - `en` integer
      - `he` integer
  - `descriptions` object — JSON containing descriptions for a given topic in various languages. Each language contains a `title` for the topic description, as well as a `prompt` which previews the source and asks questions to help the user engage with the text.
    - `en` object
      - `title` string
      - `prompt` string
  - `topic` string — The title of the topic.
  - `anchorRef` string — The `Ref` the topic is connected to, which should overlap with the requested `Ref` passed through the endpoint. For example, if someone queries for `Bamidbar 28:21`, one of the topics returned is `passover` which has an `anchorRef` of `Numbers 28:16-24` - a range overlapping with our desired `Ref`.
  - `anchorRefExpanded` string[] — If the `anchorRef` is a ranged `Ref` (i.e. containing more than a single segment), then this is a list of strings, with each string being one of single segment level `Ref`s that together comprise the range. So for example, the `anchorRefExpanded` of `Exodus 1:1-2` would be `["Exodus 1:1", "Exodus 1:2"]`.

---

[API](https://skmtc.net/sefaria/apis/sefaria-api.md) · [All operations](https://skmtc.net/sefaria/apis/sefaria-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/sefaria/sefaria-api/revisions/d29296717011/schema)
