Getting Started with the NIAGADS-OA API

This guide explains how to construct and execute API requests and interpret responses.

The NIAGADS-OA API establishes a simple framework for sharing and integration of NIAGADS datasets and annotated gene and variant records into analysis pipelines. Use of the API requires either a (command line) tool or requests library that supports the HTTP protocol to transfer data, permitting large-scale programmatic access independent of any specific platform or programming language.

Contribute:

Interested in helping us improve? Check out our GitHub repository to get started! From feature suggestions to code-wrappers to bug reports, all contributions are welcome.

Quick start

Check out the OpenAPI documentation to browse the full, technical specification of API operations.

The NIAGADS OA-API is under development:

Endpoints are subject to change and there may be intermittent outages. Stable release of the full API is expected for September, 2025.

Tools and Libraries

Third-party tools can be used for communicating with the API and for exploring JSON responses. These include:

ToolType
curlcommand line
HTTPiecommand line // desktop (Windows) // web app
Google Chromeweb browser
Mozilla Firefoxweb browser
Safariweb browser (Mac)

As well as any programming language package that supports the HTTP protocol, such as:

PackageLanguage
requestsPython
aiohttp*Python
requestR
httr2*R
Faradayruby
net/httpgo
java.net.httpJava
Fetch APIJavascript
HTTP::TinyPerl
LWP::UserAgentPerl

*recommended

API Endpoints

Communicating with the NIAGADS Open Access API involves making calls to API endpoints. Each endpoint represents both the resource being queried and specific API functionality.

Request URL

The HTTP URL that corresponds to the latest version of an API endpoint is:
https://api.niagads.org/<resource>/<operation>

In the request URL, <resource> is the name of the NIAGADS knowledge base and <operation> is the type of request being made to the API.

Other Versions:

The HTTP URL of an endpoint corresponding to a specific major version of the API is https://api.niagads.org/v<version>/<resource>/<operation>, whre <version> is the NIAGADS-OA API major version.

Resources

Allowable values for <resource> are summarized below:

ResourceStatusKnoweldge Base
genomicsunder developmentGenomicsDB
filerin productionFILER
advpplannedADVP
allplannedsearch across all Open Access Resources

Operations

Operations define particular functions or services provided by the API.
Allowable values for <operation> are as follows:

OperationTypeDescription
statusStatusGet API description and versioning information
recordEntity LookupRetrieve entity nomenclature, metadata, or annotations by ID
searchSearchFind entities matching search criteria
dataSearch and Data RetrievalRetrieve data or annotations matching search criteria
serviceData RetrievalRetrieve data formatted for input to NIAGADS visualization tools or services
dictionarySearch and Data RetrievalSearch or retrieve controlled vocabularies and ontologies

Entities

record operations are further qualified by the entity type being queried.

All entities are assigned a unique stable identifier (ID). These are consistent across all NIAGADS Open Access resources and are stored in a record's id property.

The HTTP URL for retrieving the record for a specific entity is:
https://api.niagads.org/<resource>/record/<entity>/<id>

The NIAGADS Open Access API supports queries for the following entities:

EntityRecord ContentsDescriptionIdentifierResource
geneannotations, genetic associationsEnsembl genesEnsembl IDgenomics, advp
variantannotations, genetic associationsSNVs, short INDELS, SVschr:pos:ref:alt, structural variant IDgenomics, advp
regionoverlapping genomic features, data summariesarbitrary genomic regionschr:pos:start-endgenomics
trackmetadatadata tracksNG[unique alpha-numeric code]genomics, filer
collectionmetadatasets of related entitieshuman-readable stringgenomics, filer

Alternative Identifiers:

The NIAGADS-OA API will also accept industry standard alternative identifiers, such as refSNP ID for variants, and official symbols, and Entrez (NCBI Gene) IDs for genes. However, these alternatives may not map unambiguously to NIAGADS-OA entities.

Rate Limits

Coming soon:

More information about rate limits on API queries coming soon.

API Responses

The NIAGADS Open Access API uses JSON as its standard response format, although some endpoints can also return plain text results (formatted as tab-delimited TEXT, YAML, BED, VCF) by setting a format parameter.

Want XML?:

Make a feature request on GitHub!

JSON Response Format

The following fields are included in all successful, non-service API responses. Responses to service routes will vary depending on their purpose.

FieldTypeDescription
dataarrayquery result
requestRequestDataModeldetails about the originating request
paginationPaginationDataModel (optional)pagination status, if the result is paged
messagearray (optional)warning or info message(s) qualifying the response

Data

Query results are found in the data field in the API response. It will always be an array; even for single record lookups. However the schema for individual elements in the dataarray will vary depending on the entity or data type being queried.

More information about types of data responses coming soon:

Full JSON schemas are availble in the Open API documentation.

Request

The request field in the response lists the details of the user request.

FieldTypeDescription
request_idstringunique request identifier
endpointstringqueried endpoint
parametersobjectrequest path and query parameters, includes unspecified defaults

Pagination

Many NIAGADS-OA API queries can return large quantities of structured data, all results are paged, with a maximum of 5000 data points returned per page. The pagination field returns the details of the result size and current page.

FieldTypeDescription
pageintegerif result is paged, indicates the current page of the result; defaults to 1
total_num_pagesintegerif the result is paged, reports total number of pages in the full result set (response); defaults to 1
paged_num_recordsinteger (optional)number of records in the current paged result set (response)
total_num_recordsinteger (optional)total number of records in the full result set (response)

Status Codes

API responses include a HTTP status code indicating whether the request was successfully completed.

Status CodeTypeDescription
200 OKSuccesssuccessful response
404 Not FoundClient Errorrecord not found
422 Unprocessable ContentClient Errorparameter validation error
429 Too Many RequestsClient Errortoo many requests in a given amount of time, exceeding rate limits
500 Internal Server ErrorServer Errorruntime error generating a request response
503 Service UnavailableServer Errorsystem or database error