GET /sequence/id/{id}

ensembl.org:ensembl-rest-api

Summary: Get sequence by ID
Operation ID: getSequenceById
Auth: none

Retrieve the actual DNA, RNA, or protein sequence for an Ensembl feature by its stable ID. Returns the raw sequence string along with metadata about the molecule type. Can retrieve genomic DNA, cDNA (spliced transcript), coding sequences (CDS), or protein sequences depending on the type parameter. This is the primary endpoint for fetching sequence data from Ensembl.

Original spec description

Request multiple types of sequence by stable identifier. Supports feature masking and expand options.

Usage Tips

- Default returns genomic DNA which can be huge for large genes (85KB+ for BRCA2) - Use `type=protein` for protein sequences (returns ~3,418 amino acids for typical protein) - Use `type=cdna` for spliced transcript sequences (introns removed) - Use `type=cds` for coding sequences only (UTRs removed) - The response includes a `molecule` field confirming what you received

Parameters (5)

expand_3prime (integer, query, optional)

Expand sequence downstream (3') by this many base pairs

expand_5prime (integer, query, optional)

Expand sequence upstream (5') by this many base pairs

id (string, path, required)

Ensembl stable ID

mask (string, query, optional)

Mask features (hard/soft) for genomic sequences

Constraints: {'enum': ['hard', 'soft']}

type (string, query, optional, default: genomic)

Sequence type to retrieve

Constraints: {'enum': ['genomic', 'cdna', 'cds', 'protein']}

Examples (3)

TitleTypeURLAction
Get genomic sequence for BRCA2 gene curl https://rest.ensembl.org/sequence/id/ENSG00000139618?type=genomic
Get protein sequence by protein ID curl https://rest.ensembl.org/sequence/id/ENSP00000369497?type=protein
Get cDNA sequence for transcript curl https://rest.ensembl.org/sequence/id/ENST00000380152?type=cdna

Probe History

Latency

Status Codes

TimeStatusLatencySize
2026-03-23 10:18:31.725431 200 170ms
2026-03-23 09:15:02.063390 200 189ms
2026-03-23 09:06:28.311030 200 183ms

Response Changes

WhenOldNew
2026-03-23 09:15:02.063390 eca5b30f4747 64811967bfdf
2026-03-23 10:18:31.725431 64811967bfdf 1af3ffca1106