Get Sutta Information and Legacy translations API

Do you need all the information regarding translations for a specific sutta on SuttaCentral? Or do you need to get the actual translation for one of the legacy suttas? Then the sutta API is what you need.

[ All API documentation | General discussion on SC APIs | autogenerated documentation]

The SuttaPlex cards provide the website user with a collection of all existing information about a particular sutta, including:

  • Link to root text
  • Links to all translations of that sutta
  • All paralels
  • The previous and next suttas where they exist.
  • Blurb (aka short description)
  • Difficulty level

This is what the card looks like on the website navigation:

The same information can be seen when viewing a sutta and clicking on parallels:

Requesting SuttaPlex information

There are several options. See the examples below

Basic request

https://suttacentral.net/api/suttas/mn1

Returns an OBJECT with the following key value pairs:

root_text

null

translation

null

segmented (BOOLEAN)

Not sure why this is false.

suttaplex {

Returns an object with the following key/value pairs:

key value
acronym (STRING) This is a citation with the abbreviation properly capitalized,
e.g. "Iti 1", MN 1
volpages(STRING) A string with comma separated PTS pages where the sutta can be found.
E.g. " PTS 1.1, PTS 1.2, PTS 1.3, PTS 1.4, PTS 1.5, PTS 1.6"
alt_volpages
uid (STRING) Unique identifier for the sutta. All lowercase, no spaces
E.g. “iti1”, "mn1"
blurb (STRING) A description of the sutta. By default the description is in English (see other options below)
difficulty (INT) Number from 1 to 3
original_title (STRING) Title in the root language. Capitalized.
root_lang (STRING) Language id. E.g "pli"
root_lang_name (STRING) Full name of the language.
E.g. "Pāli"
type "leaf" what is this?
from what is this?
translated_title (STRING) Default English title of sutta
translations (ARRAY) A list of objects with translations for this sutta.
See description below.
parallel_count (INT) Number of parallels this sutta has
biblio what is this?
priority_author_uid what is this?

Objects in translations array (see above)

Key value
lang_name (STRING) Full language name.
E.g. "English"
is_root (BOOLEAN) This is a little counter intuitive because this array of translations also includes the root text. So, this value will be true if it is a root text.
author (STRING) Full author name. E.g. "Bhikkhu Sujato"
author_short (STRING) Unique author code. E.g. "sujato"Is this ever a different value from author_uid?
author_uid (STRING) Unique author code. E.g."sujato"
publication_date Is this going to be used?
id (STRING) where is this used?
E.g. "mn1_translation-en-sujato"
segmented (BOOLEAN) "true" if it was created using the Bilara software and can be presented line by line with the Pāli.
title (STRING) The specific sutta title within this translation
volpage Is this the volume and page number if the translation was previously published?

bilara_root_text {

This is an object with the following key/value pairs:
needs to be completed
}

needs to be completed

Request including translator

https://suttacentral.net/api/suttas/mn1/sujato
needs to be completed

Parameters

lang=en

needs to be completed

siteLanguage=en

needs to be completed



Note: This is post is a wiki. Please feel free to click the edit button below to make changes. Feel free to reply to the post if you have questions

5 Likes

@HongDa , when you have time, could you provide answers to my questions above? This is a fairly complex (for me at least!) API so it will take me a while to work through the whole thing.

I realize that this api can also indicate the author as well as languages. I thought to start with the most basic request and then add on from there. Don’t know if that is the best method.

3 Likes

Hi @Snowbird
Generally, this API is used to get suttaplex information,
for example:
https://suttacentral.net/api/suttaplex/mn1

2 Likes

https://suttacentral.net/api/suttas/mn1

This API generally must pass in the author id,
e.g. https://suttacentral.net/api/suttas/mn1/sujato

segmented If true, it means that the translated text is segmented text (json format),
if false, it is legacy text (this kind of text contains html)

2 Likes

Ooooh. I got confused. Is this api( https://suttacentral.net/api/suttas/mn1) even something we should be using? If it is still used, what do you call it?

1 Like

type has two values: branch and leaf
branch represents the existence of sub-item
leaf means that there is no sub-item

2 Likes

This API( https://suttacentral.net/api/suttas/mn1/[authorUid]) is mainly used to obtain the main information of sutta. For example, the segmented field is used to decide whether to use the segmented page to load or the legacy page to load.

Usually when calling this api, the authorUid must be passed in.

3 Likes

Ah, I think I got confused because it does return a key called suttaplex, and it doesn’t return the content of the translation (the bilara segments). Also, it returns a list of other translations. So it felt very suttaplexy, if that’s a word. :grin:

Side question, is there an api that can fetch the actual translations of the legacy texts?

I appreciate you answering these questions. I know you are busy with the essential work of building the actual thing!

1 Like

This field records an authorUid, and the translated version of the author will be displayed at the top of the suttaplex list.

2 Likes

e.g.

https://suttacentral.net/api/suttas/mn1/bodhi

Bhante Bodhi’s version is legacy text, so this api will return legacy text content

1 Like

Since the sc text page needs some information about the suttaplex, this API also returns the suttaplex.

There is a separate API for getting bilara segmented text
https://suttacentral.net/api/bilarasuttas/sn1.1/sujato?lang=en

Sorry, my English is not very good, please let me know if there is something unclear

2 Likes

Ahh. So if it’s a Bilara text, it does not return the actual translation. However, if it is a legacy text the it does. Interesting!

Thanks so much.

Your English is perfect. It’s my brain that needs clearing. :rofl:

1 Like

Hi @Snowbird. I’m curious if you know of a way to show all suttas with available translations for a given author? Ex: all suttas that have translations by Bhikkhu Bodhi?

Welcome to the forum @Abv !

I don’t think there is with this API. However it is possible to get this through a special search, so there may be (or may someday be?)

To get it on the front end of the site, simply enter something like this as a search: author:suddhaso

Careful, though! some authors (translators, really) have a long list. For the author, you will have to use their ID. You can find this in the url of any one of their suttas. E.g.: https://suttacentral.net/an3.136/en/suddhaso

Perhaps @HongDa can say if there is a search API yet or will be in the future.

@Snowbird Thank you! That’s helpful. I should just be able to take the list from the frontend and programmatically fetch the suttas I need for a given author.

There are currently no plans to provide a search API :pray:

1 Like