'How can get all non us-gaap concepts from some api or file?

Companies are allowed to create their own concepts. The conccept AccruedAndOtherCurrentLiabilities is generated by tesla. Get all us-gaap concepts from ssec's RESTful api with python code:

import requests
import json
cik='1318605'  #tesla's cik
url = 'https://data.sec.gov/api/xbrl/companyfacts/CIK{:>010s}.json'.format(cik)
headers = {
    "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36"
}
res = requests.get(url=url,headers=headers)
result = json.loads(res.text)
us_gaap_concepts = list(result['facts']['us-gaap'].keys())

Revenues is a us-gaap concept,verify it with code.

'Revenues' in us_gaap_concepts
True 

Verify that AccruedAndOtherCurrentLiabilities is not in us_gaap_concepts.

'AccruedAndOtherCurrentLiabilities' in us_gaap_concepts
False

How can get all company customized concepts from sec's data api or some file then?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source