An official website of the United States government

LDlink API Access

LDlink modules are also accessible via command line from a terminal. This programmatic access facilitates researchers who are interested in performing batch queries. The syntax is similar to the web address link created for queries on the webpage. Generally text output is returned that is the same as the file a user would download from the online site. Please register below for an access token required for your API call. Once registered, your access token will be emailed to you.

Interested in accessing LDlink's API using R?
Check out the new LDlinkR package now available on CRAN.


Examples of command line arguments are listed below for each module. Replace the example token in token=faketoken123 with your own registered token.

LDexpress

curl -k -X GET 'https://ldlink.nih.gov/LDlinkRest/ldexpressget?snps=rs3%0Ars4&pop=YRI&tissues=Adipose_Subcutaneous%2BAdipose_Visceral_Omentum&r2_d=r2&r2_d_threshold=0.1&p_threshold=0.1&window=500000&genome_build=grch37&token=faketoken123'
curl -k -H "Content-Type: application/json" -X POST -d '{"snps": "rs3\nrs4", "pop": "YRI+CEU", "tissues": "Adipose_Subcutaneous+Adipose_Visceral_Omentum", "r2_d": "r2", "r2_d_threshold": "0.1", "p_threshold": "0.1", "window": "500000", "genome_build": "grch37"}' 'https://ldlink.nih.gov/LDlinkRest/ldexpress?token=faketoken123'

LDhap

curl -k -X GET 'https://ldlink.nih.gov/LDlinkRest/ldhap?snps=rs3%0Ars4&pop=ALL&genome_build=grch38&token=faketoken123'

LDmatrix

curl -k -X GET 'https://ldlink.nih.gov/LDlinkRest/ldmatrix?snps=rs3%0Ars4%0Ars148890987&pop=CEU&r2_d=d&genome_build=grch38_high_coverage&token=faketoken123'

Note: GET requests can support up to 300 SNPs.

curl -k -H "Content-Type: application/json" -X POST -d '{"snps": "rs3\nrs4", "pop": "CEU","r2_d": "d", "genome_build": "grch37"}' 'https://ldlink.nih.gov/LDlinkRest/ldmatrix?token=faketoken123'

Note: POST requests can support up to 2,500 SNPs.

LDpair

curl -k -X GET 'https://ldlink.nih.gov/LDlinkRest/ldpair?var1=rs3&var2=rs4&pop=CEU%2BYRI%2BCHB&genome_build=grch37&json_out=false&token=faketoken123'

Note: GET requests only support 1 SNP pair.

curl -k -H "Content-Type: application/json" -X POST -d '{"snp_pairs": [["rs3", "rs4"], ["rs7837688", "rs4242384"]], "pop": "CEU+YRI+CHB","genome_build": "grch37", "json_out": true}' 'https://ldlink.nih.gov/LDlinkRest/ldpair?token=faketoken123'

Note: POST requests can support up to 10 SNP pairs. If more than 1 SNP pair is provided, a JSON response will always be returned.

LDpop

curl -k -X GET 'https://ldlink.nih.gov/LDlinkRest/ldpop?var1=rs3&var2=rs4&pop=CEU%2BYRI%2BCHB&r2_d=r2&genome_build=grch37&token=faketoken123'

LDproxy

curl -k -X GET 'https://ldlink.nih.gov/LDlinkRest/ldproxy?var=rs3&pop=MXL&r2_d=r2&window=500000&genome_build=grch37&token=faketoken123'

LDtrait

curl -k -X GET 'https://ldlink.nih.gov/LDlinkRest/ldtraitget?snps=rs3&pop=YRI&r2_d=r2&r2_d_threshold=0.1&window=500000&genome_build=grch37&token=faketoken123'
curl -k -H "Content-Type: application/json" -X POST -d '{"snps": "rs3\nrs4", "pop": "YRI", "r2_d": "r2", "r2_d_threshold": "0.1", "window": "500000", "genome_build": "grch37"}' 'https://ldlink.nih.gov/LDlinkRest/ldtrait?token=faketoken123'

SNPchip

curl -k -H "Content-Type: application/json" -X POST -d '{"snps": "rs3\nrs4\nrs17795812", "platforms":"A_10X+A_250N+A_250S+A_50H+A_50X+A_AFR+A_ASI+A_CHB2+A_DMETplus+A_EAS+A_EUR+A_Exome1A+A_Exome319+A_Hu+A_Hu-CHB+A_LAT+A_Onco+A_OncoCNV+A_SNP5.0+A_SNP6.0+I_100+I_1M+I_1M-D+I_240S+I_300+I_300-D+I_550v1+I_550v3+I_610-Q+I_650Y+I_660W-Q+I_CNV-12+I_CNV370-D+I_CNV370-Q+I_CVD+I_CardioMetab+I_Core-12+I_CoreE-12v1+I_CoreE-12v1.1+I_CoreE-24v1+I_CoreE-24v1.1+I_Cyto-12v2+I_Cyto-12v2.1+I_Cyto-12v2.1f+I_Cyto850+I_Exome-12+I_Exon510S+I_Immuno-24v1+I_Immuno-24v2+I_Linkage-12+I_Linkage-24+I_ME-Global-8+I_NS-12+I_O1-Q+I_O1S-8+I_O2.5-4+I_O2.5-8+I_O2.5E-8v1+I_O2.5E-8v1.1+I_O2.5E-8v1.2+I_O2.5S-8+I_O5-4+I_O5E-4+I_OE-12+I_OE-12f+I_OE-24+I_OEE-8v1+I_OEE-8v1.1+I_OEE-8v1.2+I_OEE-8v1.3+I_OZH-8v1+I_OZH-8v1.1+I_OZH-8v1.2+I_OncoArray+I_Psyc-24v1+I_Psyc-24v1.1+I_GDA-C+I_GSA-v3C", "genome_build": "grch37"}' 'https://ldlink.nih.gov/LDlinkRest/snpchip?token=faketoken123'

SNPclip

curl -k -H "Content-Type: application/json" -X POST -d '{"snps": "rs3\nrs4", "pop": "YRI", "r2_threshold": "0.1", "maf_threshold": "0.01", "genome_build": "grch37"}' 'https://ldlink.nih.gov/LDlinkRest/snpclip?token=faketoken123'

Note: LDassoc is not currently accessible via programmatic access.