---
title: "Fetch sequence by accession"
method: POST
path: "/sequence_fetch"
tags: ["Files & formats"]
---

# Fetch sequence by accession

`POST /sequence_fetch`

## Request

- Base URL: `https://seqbench.com/api/v1`
- URL: `https://seqbench.com/api/v1/sequence_fetch`
- Auth: none required

Fetch a public DNA/protein record by accession from NCBI Nucleotide, NCBI Protein, UniProt, or Ensembl (e.g. NM_000546, NP_000537, P04637, ENSG00000141510) — the whole record, or with `start`/`end` just that region of it, which is how you take a few kb out of a chromosome instead of downloading the chromosome. Only the accession is sent upstream. Use sequence_search first if you only know a gene/organism name, not an accession, or genome_region if you know the gene's name but not its coordinates. For an Ensembl transcript ID this returns spliced cDNA; for a gene ID it returns the full genomic locus (introns included) — Ensembl's own default for each ID type.

## Request body

- object
  - `accession` string, required: GenBank/RefSeq accession (e.g. NM_000546), UniProtKB accession (e.g. P04637), or Ensembl stable ID (e.g. ENSG00000141510, ENST00000335137).
  - `db` 'auto' | 'nucleotide' | 'protein' | 'uniprot' | 'ensembl': Database to query; auto-detects from the accession format.
  - `format` 'fasta' | 'genbank': Output format (GenBank is only available for NCBI accessions — UniProt and Ensembl are FASTA-only).
  - `start` integer: First base of the region to fetch, counted from 1 and included. Requires `end`. NCBI accessions only.
  - `end` integer: Last base of the region, included. Always greater than or equal to `start` — use `strand` for the other orientation, not a swapped pair.
  - `strand` 1 | -1: 1 returns the region as written; -1 returns its reverse complement. Only meaningful with start/end.

## Response `200`

Tool ran successfully.

- SuccessResponse: Standard success envelope returned by every single-tool call.
  - `ok` unknown, required
  - `tool` string, required: The tool slug that ran.
  - `result` object, required: Tool-specific output object. Its shape depends on the tool — call `GET /{tool}` or see the docs for each tool's fields.
  - `gate` GateResult
    - `pass` boolean, required: True if and only if every hard check passed.
    - `checks` GateCheck[], required
      - `id` string, required
      - `label` string, required
      - `severity` 'hard' | 'soft', required
      - `pass` boolean, required
      - `message` string, required
      - `value` number
      - `threshold` string
    - `notChecked` string[], required: Honest list of what this gate does NOT verify.
  - `provenance` Provenance, required
    - `apiVersion` string, required
    - `tool` union, required: Tool slug, or an array of slugs (one per step) for a workflow.
      - string
      - string[]
    - `generatedAt` string, date-time, required: ISO 8601 timestamp of when the result was generated.

## Other responses

- `400`: Invalid argument or the tool could not run.
- `404`: Unknown tool.
- `429`: Rate limited (metered tools only). Body carries code `rate_limited` and retryable `true`; honor the Retry-After header.
- `503`: A metered tool is momentarily at capacity. The identical request should succeed after Retry-After; body carries code `upstream_unavailable`.

---

[API](https://skmtc.dev/seqbench/apis/seqbench-api.md) · [All operations](https://skmtc.dev/seqbench/apis/seqbench-api/llms.txt) · [OpenAPI document](https://skmtc.dev/seqbench/apis/seqbench-api/revisions/132575216865?raw)
