---
title: "Topic Graph"
method: GET
path: "/api/topics-graph/{topic_slug}"
tags: ["Topic"]
---

# Topic Graph

`GET /api/topics-graph/{topic_slug}`

Endpoint to retrieve topics and their links between other topics. As opposed to topic links to refs, this endpoint retrieve connections between one topic to another topic.

## Response `200`

A list of topics connected to the `topic_slug` as well as a list of links.

- TopicGraphJSON
  - `topics` TopicJSON[] — Array of topics
    - `slug` string, required — The unique slug for a given topic.
    - `titles` TitlesJSON[], required — An array of JSON objects, each representing an alternative title for the object, in various languages.
      - `text` string — The text of the title
      - `lang` string — The language of the title, either `en` or `he`.
      - `Primary` boolean — A field depicting whether or not the title is the primary title. Note: For any given topics, one should expect two titles with this field present and set to `true`, an English and a Hebrew primary title. The English value with `primary` set to `true` will match the string value of the `primaryTitle` field on topic.
    - `alt_ids` object — This is a dictionary containing the keys of naming schemes, and ids of this topic represented in that naming scheme. It’s used both for canonical names in other naming schemes and temporary storage of names when renaming slugs. All of the data here is for internal use, with the exception of the values `bfo` and `wikidata`. `bfo` refers to [basic formal ontology](https://developers.sefaria.org/docs/topic-ontology), and `wikidata` to the wikidata ontology of topics.
      - `_temp_id` string
    - `properties` TopicPropertyJson — The JSON object containing information about a topic's properties
      - `heNliLink` NLILinkJSON — JSON for storing NLI links related to data in the Sefaria database.
        - `value` string — A link to a corresponding NLI page to learn more.
        - `dataSource` string — The source of the topic data, whether user-created or Sefaria-created.
      - `enNliLink` NLILinkJSON — JSON for storing NLI links related to data in the Sefaria database.
        - `value` string — A link to a corresponding NLI page to learn more.
        - `dataSource` string — The source of the topic data, whether user-created or Sefaria-created.
    - `description` BillingualJSON — A JSON object containing billingual text, both `he` and `en` parallel texts.
      - `en` union — The English field for a JSON object representing billingual text.
        - string
        - boolean
      - `he` union — The Hebrew field for a JSON object representing billingual text.
        - string
        - boolean
    - `categoryDescription` union — A description of the category of this topic
      - string
      - object
    - `displayOrder` integer — The order in which topics are displayed on the Sefaria website, relative to other topics within their same category.
    - `numSources` integer — The number of text sources associated with a topic.
    - `description_published` boolean — A boolean representing whether or not the description was published.
    - `data_source` string — How the topic was generated, whether by Sefaria, a user on a source sheet, or some other source.
    - `image` TopicImgJSON — A JSON object containing the image metadata for topics with images.
      - `image_uri` string — The URL pointing to the image as hosted by Sefaria.
      - `image_caption` BillingualJSON — A JSON object containing billingual text, both `he` and `en` parallel texts.
        - `en` union — The English field for a JSON object representing billingual text.
          - string
          - boolean
        - `he` union — The Hebrew field for a JSON object representing billingual text.
          - string
          - boolean
    - `primaryTitle` BillingualJSON — A JSON object containing billingual text, both `he` and `en` parallel texts.
      - `en` union — The English field for a JSON object representing billingual text.
        - string
        - boolean
      - `he` union — The Hebrew field for a JSON object representing billingual text.
        - string
        - boolean
    - `primaryTitleIsTransliteration` BillingualJSON — A JSON object containing billingual text, both `he` and `en` parallel texts.
      - `en` union — The English field for a JSON object representing billingual text.
        - string
        - boolean
      - `he` union — The Hebrew field for a JSON object representing billingual text.
        - string
        - boolean
  - `links` TopicGraphLinkJSON[]
    - `toTopic` string — Slug of the `toTopic` (i.e. the topic to which the link connects to, usually the slug passed as `topic_slug` to the `api/topic-graph` 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' — Class of the link `intraTopic` (a link from topic-to-topic) or `refTopic` (a link from a topic-to-ref).
    - `dataSource` string — Source where the topic link originated from.
    - `fromTopic` string — Slug of the `fromTopic` (i.e. the topic from which the link originates).
    - `order` OrderJSON
      - `linksInCommon` integer
      - `toTfidf` number, float
      - `fromTfidf` number, float

---

[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)
