NLM logo

We welcome your feedback on our customer service form. Please use "UMLS REST API feedback" in your subject line.

Check out the Postman sample collection to help you get started using the UMLS REST API.

API Terms of Service

Python Scripts

Try these python scripts:

Crosswalking Vocabularies Using CUIs

This script will crosswalk from a set of codes in one UMLS source vocabulary to a set of codes in another UMLS source vocabulary as long as the codes share a UMLS Concept.

Script: crosswalk.py

Usage: python crosswalk.py -k YOUR_API_KEY -s HPO -t SNOMEDCT_US -i hpo-codes.txt -o output.txt

Sample Input File: hpo-codes.txt

Documentation: Crosswalk API Endpoint


Get Codes for a List of Concepts

This script will take a list of CUIs and return the corresponding codes for a particular UMLS source vocabulary.

Script: get-codes-for-a-list-of-concepts.py

Usage: python get-codes-for-a-list-of-concepts.py -k YOUR_API_KEY -i cuis.txt -o output.txt -s SNOMEDCT_US

Documentation: Search API Endpoint


Get Concepts for a List of Codes

This script will take a list of codes and return the corresponding concepts for a particular UMLS source vocabulary.

Script: get-concepts-for-a-list-of-codes.py

Usage: python get-codes-for-a-list-of-concepts.py -k YOUR_API_KEY -i cuis.txt -o output.txt -s SNOMEDCT_US

Documentation: Search API Endpoint


Get Concepts for a List of Strings

This script will take a list of strings and return the corresponding concepts for one or more UMLS source vocabularies.

Script: get-concepts-for-a-list-of-strings.py

Usage: python get-concepts-for-a-list-of-strings.py -k YOUR_API_KEY -i strings.txt -o output.txt

Documentation: Search API Endpoint


Retrieve Atoms Using a CUI or Code

This script will return atoms from a single CUI or code. If using a code, a source vocabulary must be specified.

Script: retrieve-names-for-cui-or-code.py

Usage: python retrieve-names-for-cui-or-code.py -k YOUR_API_KEY -i C0018787

Documentation: Concept API Endpoint, Source-Asserted Information API Endpoint


Search for a Term

This script will return CUIs and associated information for a search term.

Script: search-terms.py

Usage: python search-terms.py -k YOUR_API_KEY -s diabetic-foot

Documentation: Search API Endpoint


Retrieve ancestors, descendants, parents, or children

This script returns ancestors, descendants, parents, or children for a source-asserted code.

Script: walk-hierarchy.py

Usage: python walk-hierarchy.py -k YOUR_API_KEY -i 9468002 -s SNOMEDCT_US -o ancestors / descendants / parents / children

Documentation: Source-Asserted Information API Endpoint


Get Semantic Types for a List of Strings

This script returns semantic types for concepts returned by string searches.

Script: get_semantic_types_for_a_list_of_strings.py

Usage: python get_semantic_types_for_a_list_of_strings.py -k YOUR_API_KEY -i strings.txt -o output.txt

Documentation: Searching the UMLS API Endpoint, Retrieving UMLS Concept Information API Endpoint