Url and docs for 3.0 API?

Hi there,

I am thinking of doing some development on top of the lingq API.

I understand the 2.0 API docs are here and I have the URL for that API too.

But is the 3.0 API available to be developed on?

I am an open source developer that was involved in writing core parts of Moodle. Now interested in focusing more on languages and building tools for helping with effective innovative tools to help language learners and am thinking how I can contribute interesting tools to augment lingq which is already a great tool I am using myself to learn Polish.

Dziękuję, :grinning:

Jamie

3 Likes
1 Like

AFAIK the two APIs (v2 & v3) exist side-by-side. Depending on what you want to do, you will have to call both APIs.
I have asked LingQ multiple times to provide documentation, but it has been deemed low priority and v3 was introduced 1.5 years ago; in short, don’t think this is going to happen.
To be fair most parts of the v2 API are undocumented as well. Things seem to work mostly for me, but I only use it for primitive tasks like up/downloading, getting statistics and updating my lessons. Not sure what your plans are.
Anyways, if you get stuck you can always ask in this forum, there is a good chance someone else has faced the same problem previously.

3 Likes

I understand there are no docs. Any tips for figuring out what APIs exist?

I can go to different web pages and see what they are calling via developer tools in Chrome. And I’m not too bad at figuring out how to call undocumented APIs. It’s mainly knowing which endpoints exist that is the challenge for me.

For example, I would love an API that returns all the words I’ve learned. It might exist, but none of the pages I browse to seem to exercise this kind of API.

Let nothing in what I’ve written sound like a complaint. Just seeing what’s possible.

-Erik

2 Likes

Hi, I don’t have any experience with the vocabulary feature. But here is an attempt:

Summary
import requests
import json

KEY = "1234"

url = 'https://www.lingq.com/api/v3/es/cards/'
params = {
    'page': 1,
    'page_size': 25,
    'search_criteria': 'startsWith',
    'sort': 'date',
    'status': [0, 1, 2, 3, 4]
}

headers = {
    'Authorization': 'Token ' + KEY,
    'accept': 'application/json'
}

response = requests.get(url, params=params, headers=headers)

if response.status_code == 200:
    data = response.json()
    if 'results' in data and len(data['results']) > 0:
        first_result = data['results'][0]
        formatted_json = json.dumps(first_result, indent=4)
        print(formatted_json)
    else:
        print("No results")
else:
    print(f"Request failed with status code: {response.status_code}")

Results look something like this for me:

Summary
"pk": 465545775,
"url": "https://www.lingq.com/api/v3/es/cards/465545775/",
"term": "embajada",
"fragment": "con la Embajada de Estados Unidos, que",
"importance": 1,
"status": 0,
"extended_status": null,
"last_reviewed_correct": null,
"srs_due_date": "2023-10-01T14:59:53.832370",
"notes": "",
"audio": null,
"words": [
    "embajada"
],
"tags": [],
"hints": [
    {
        "id": 98297,
        "locale": "en",
        "text": "embassy",
        "term": "embajada",
        "popularity": 1609,
        "is_google_translate": true,
        "flagged": false
    }
],
"transliteration": {},
"gTags": [
    "sustantivo"
],
"wordTags": [
    "sustantivo"
],
"readings": {},
"writings": [
    "embajada"
]

Technically some documentation exists, it’s just incomplete and about 8 years out of date.
https://www.lingq.com/apidocs/

but none of the pages I browse to seem to exercise this kind of API.

This one:
https://www.lingq.com/en/learn/es/web/library/vocabulary/all

3 Likes

@bamboozled, huge thanks!

Technically some documentation exists, it’s just incomplete and about 8 years out of date.

Bookmarked! Awesome.

This one:
Ah, I saw that page earlier. It will show all of the user’s LingQs, but not all of their learned vocabulary. I’m trying to get a list of all the words I know according to LingQ.

-Erik

2 Likes

Jumping in here - is there an API to get a list of all the known words? I’m looking into this as you can’t export the list from the UI

1 Like

Seems like the v2 API docs page is down. :sweat_smile:

1 Like

I found this list of endpoints, is it up to date?

Also here found this page that seems a good example of how to upload audio.

1 Like

Will comment on your thread here: Is it correct that "known" words are excluded from export? - #2 by zoran

1 Like

Hi there! I am the author of the api wrapper you showed and I can tell you, its definitely not up to date or never was haha
Do you still need one? I know I’m late but if anyone has interest in one, I could definitely build a complete one that has every endpoint I can find
I mostly just figured out the endpoints myself using the browser network inspection tool

2 Likes

Honestly you don’t even have to update the wrapper, I think if you could just document what you’ve found somewhere, a lot of people would be incredibly thankful, including myself. I’ve been googling around for this info for weeks now. Took a break and see you posted :pray: either way, I think we’d appreciate whatever you want to do.

1 Like