RiceVarMap v3 REST API

The RiceVarMap v3 REST API provides programmatic access to reference metadata, cultivar catalogs, variants, gene metadata, gene-region variants, coordinate conversion cache, primer design, and genotype queries. Responses use a stable JSON object with ok, data, meta, and error.

Overview

Base URL

https://ricevarmap.ncpgr.cn/v3/api

Request Conventions

  • GET endpoints accept query-string parameters.
  • POST endpoints accept a JSON object with Content-Type: application/json.
  • All successful and failed responses use the same envelope: ok, data, meta, and error.
  • Response samples are shortened when arrays are long, but field names and nesting match the live API.
  • Coordinates are 1-based and chromosome names use chr01 through chr12.

Endpoint Index

Method Path Purpose
GET/healthService health check.
GET/referencesSupported references: NIP, ZS97, and MH63.
GET/populationsPopulation code and label whitelist.
GET/cultivarsCultivar metadata with optional search and filters.
POST/cultivars/batchBatch cultivar metadata lookup.
GET/variants/<var_id>Variant detail and frequency data.
POST/variants/batchBatch variant detail and frequency query.
GET/variants/by-regionRegion-based variant search.
GET/genes/<gene_id>Gene metadata.
POST/genes/batchBatch gene metadata lookup.
GET/genes/searchGene search by ID, transcript ID, or annotation text.
GET/genes/<gene_id>/variantsVariants in a gene-centered interval.
GET/coordinates/convertCache-only coordinate conversion by variation ID.
POST/coordinates/convert/batchBatch cache-only coordinate conversion.
POST/primers/by-idPrimer design for a variation ID.
POST/genotypes/queryGenotypes for selected variants and cultivars.

Endpoints by Method

GET Endpoints

GET endpoints use query-string parameters and are intended for read-only metadata, search, variant lookup, and cache lookup operations.

GET /health

ParameterRequiredTypeDescription
No parameters.
Request Example
curl -s 'https://ricevarmap.ncpgr.cn/v3/api/health'
Response Sample
{
  "ok": true,
  "data": {
    "service": "ricevarmap3",
    "status": "ok"
  },
  "meta": {"api_version": "v3"},
  "error": null
}

GET /references

ParameterRequiredTypeDescription
No parameters.
Request Example
curl -s 'https://ricevarmap.ncpgr.cn/v3/api/references'
Response Sample
{
  "ok": true,
  "data": {
    "references": [
      {"id": "NIP", "label": "Nipponbare / IRGSP-1.0", "variant_prefix": "vg", "supports_str": true},
      {"id": "ZS97", "label": "ZS97RS3", "variant_prefix": "vz", "supports_str": false},
      {"id": "MH63", "label": "MH63RS3", "variant_prefix": "vm", "supports_str": false}
    ]
  },
  "meta": {"api_version": "v3"},
  "error": null
}

GET /populations

ParameterRequiredTypeDescription
No parameters.
Request Example
curl -s 'https://ricevarmap.ncpgr.cn/v3/api/populations'
Response Sample
{
  "ok": true,
  "data": {
    "populations": [
      {"code": "All", "label": "All"},
      {"code": "Ind_All", "label": "All Indica"},
      {"code": "Jap_All", "label": "All Japonica"},
      {"code": "TeJ", "label": "Temperate Japonica"},
      {"code": "TrJ", "label": "Tropical Japonica"}
    ]
  },
  "meta": {"api_version": "v3"},
  "error": null
}

GET /cultivars

ParameterRequiredTypeDescription
qNostringSearch by cultivar ID, name, subpopulation, or location. Maximum length: 100 characters.
subpopulationNostringExact subpopulation code filter, such as TeJ, IndI, or Aus. Use All or omit it for all cultivars.
locationNostringLocation text filter, such as China. Maximum length: 100 characters.
limitNointegerNumber of rows to return. Default: 100. Maximum: 1000.
offsetNointegerZero-based pagination offset. Default: 0.
Request Example
curl -s 'https://ricevarmap.ncpgr.cn/v3/api/cultivars?q=Heibiao&subpopulation=TeJ&location=China&limit=1'
Response Sample
{
  "ok": true,
  "data": {
    "cultivars": [
      {
        "id_name": "B001",
        "name": "Heibiao",
        "subpopulation": "TeJ",
        "location": "China",
        "longitude": null,
        "latitude": null
      }
    ],
    "count": 4726,
    "limit": 1,
    "offset": 0
  },
  "meta": {"api_version": "v3"},
  "error": null
}

GET /variants/<var_id>

ParameterRequiredTypeDescription
var_idYespath stringVariant ID such as vg0100001306, vz0100013877, vm0100005869, or STR0100000001.
includeNostringComma-separated sections. Allowed values: basic, frequency. Default: basic,frequency.
populationNostringReturn frequency for one population only. Allowed population codes include All, Ind_All, Jap_All, TeJ, and TrJ. Omit it to return all populations.
Request Example
curl -s 'https://ricevarmap.ncpgr.cn/v3/api/variants/vg0100001306?include=basic,frequency&population=All'
Response Sample
{
  "ok": true,
  "data": {
    "variant": {
      "var_id": "vg0100001306",
      "reference": "NIP",
      "chr": "chr01",
      "pos": 1306,
      "type": "SNP",
      "ref": "G",
      "alt": "A"
    },
    "frequency": [
      {
        "population": "All",
        "major_genotype": "G",
        "minor_genotype": "A",
        "major_rate": 0.984,
        "minor_rate": 0.015,
        "count": 4726
      }
    ]
  },
  "meta": {"api_version": "v3"},
  "error": null
}

GET /variants/by-region

ParameterRequiredTypeDescription
referenceNostringReference genome. Allowed values: NIP, ZS97, MH63. Default: NIP.
chrYesstringChromosome name from chr01 to chr12.
startYesintegerStart coordinate, minimum 1.
endYesintegerEnd coordinate, greater than start. Maximum interval length: 100000 bp.
typeNostringAllowed values: All, SNP, INDEL, STR. Default: All. STR is available only for NIP.
populationNostringFrequency population used for each returned variant. Default: All.
limitNointegerDefault: 100. Maximum: 1000.
offsetNointegerDefault: 0.
Request Example
curl -s 'https://ricevarmap.ncpgr.cn/v3/api/variants/by-region?reference=NIP&chr=chr01&start=10000&end=20000&population=All&limit=1'
Response Sample
{
  "ok": true,
  "data": {
    "variants": [
      {
        "var_id": "vg0100010532",
        "reference": "NIP",
        "chr": "chr01",
        "pos": 10532,
        "type": "SNP",
        "ref": "G",
        "alt": "T",
        "population": "All",
        "major_genotype": "G",
        "minor_genotype": "T",
        "major_rate": 0.995,
        "minor_rate": 0.005,
        "count": 4726
      }
    ],
    "count": 164,
    "limit": 1,
    "offset": 0,
    "reference": "NIP",
    "chr": "chr01",
    "start": 10000,
    "end": 20000,
    "type": "All",
    "population": "All"
  },
  "meta": {"api_version": "v3"},
  "error": null
}

GET /genes/<gene_id>

ParameterRequiredTypeDescription
gene_idYespath stringGene ID. NIP examples use LOC_Os; ZS97 IDs start with OsZS; MH63 IDs start with OsMH.
Request Example
curl -s 'https://ricevarmap.ncpgr.cn/v3/api/genes/LOC_Os05g32860'
Response Sample
{
  "ok": true,
  "data": {
    "gene": {
      "gene_id": "LOC_Os05g32860",
      "transcript_id": "LOC_Os05g32860.1",
      "reference": "NIP",
      "chr": "chr05",
      "start": 19240767,
      "end": 19241433,
      "strand": "+",
      "note": "expressed protein"
    }
  },
  "meta": {"api_version": "v3"},
  "error": null
}
ParameterRequiredTypeDescription
qYesstringSearch text for gene ID, transcript ID, or annotation. Maximum length: 100 characters.
referenceNostringReference genome. Allowed values: NIP, ZS97, MH63. Default: NIP.
limitNointegerDefault: 100. Maximum: 1000.
offsetNointegerDefault: 0.
Request Example
curl -s 'https://ricevarmap.ncpgr.cn/v3/api/genes/search?reference=NIP&q=LOC_Os05g32860&limit=5'
Response Sample
{
  "ok": true,
  "data": {
    "genes": [
      {
        "gene_id": "LOC_Os05g32860",
        "transcript_id": "LOC_Os05g32860.1",
        "reference": "NIP",
        "chr": "chr05",
        "start": 19240767,
        "end": 19241433,
        "strand": "+",
        "note": "expressed protein"
      }
    ],
    "count": 1,
    "limit": 5,
    "offset": 0,
    "reference": "NIP",
    "q": "LOC_Os05g32860"
  },
  "meta": {"api_version": "v3"},
  "error": null
}

GET /genes/<gene_id>/variants

ParameterRequiredTypeDescription
gene_idYespath stringGene ID. NIP examples use LOC_Os; ZS97 IDs start with OsZS; MH63 IDs start with OsMH.
upNointegerUpstream flank length. Default: 2000. Range: 0-10000.
downNointegerDownstream flank length. Default: 1000. Range: 0-10000.
populationNostringFrequency population used for each returned variant. Default: All.
limitNointegerDefault: 100. Maximum: 1000.
offsetNointegerDefault: 0.
Request Example
curl -s 'https://ricevarmap.ncpgr.cn/v3/api/genes/LOC_Os05g32860/variants?up=2000&down=1000&population=All&limit=1'
Response Sample
{
  "ok": true,
  "data": {
    "gene": {
      "gene_id": "LOC_Os05g32860",
      "transcript_id": "LOC_Os05g32860.1",
      "reference": "NIP",
      "chr": "chr05",
      "start": 19240767,
      "end": 19241433,
      "strand": "+",
      "note": "expressed protein"
    },
    "population": "All",
    "query_interval": {
      "chr": "chr05",
      "start": 19238767,
      "end": 19242433,
      "up": 2000,
      "down": 1000
    },
    "variants": [],
    "count": 71,
    "limit": 1,
    "offset": 0
  },
  "meta": {"api_version": "v3"},
  "error": null
}

GET /coordinates/convert

ParameterRequiredTypeDescription
var_idYesstringVariant ID to convert through the coordinate-conversion cache.
cache_onlyNobooleanOnly true is currently supported. Default: true.
Request Example
curl -s 'https://ricevarmap.ncpgr.cn/v3/api/coordinates/convert?var_id=vg0100001306&cache_only=true'
Response Sample
{
  "ok": true,
  "data": {
    "var_id": "vg0100001306",
    "reference": "NIP",
    "source_genome": "nip",
    "rows": [
      {
        "window_label": "Up 100bp",
        "nip_id": "vg0100001306",
        "zs_id": "vm0100005869",
        "mh_id": "NA"
      }
    ]
  },
  "meta": {"api_version": "v3"},
  "error": null
}

POST Endpoints

POST endpoints accept a JSON object in the request body. They are used for batch operations, primer design, and genotype queries.

POST /cultivars/batch

JSON fieldRequiredTypeDescription
cultivarsYesarrayCultivar IDs such as B001 or C145. Maximum: 500 IDs.
Request Example
curl -s -X POST 'https://ricevarmap.ncpgr.cn/v3/api/cultivars/batch' \
  -H 'Content-Type: application/json' \
  -d '{"cultivars":["B001","C145"]}'
Response Sample
{
  "ok": true,
  "data": {
    "results": [
      {
        "id_name": "B001",
        "name": "Heibiao",
        "subpopulation": "TeJ",
        "location": "China",
        "longitude": null,
        "latitude": null
      }
    ],
    "count": 1,
    "used_cultivars": ["B001"],
    "not_found": []
  },
  "meta": {"api_version": "v3"},
  "error": null
}

POST /variants/batch

JSON fieldRequiredTypeDescription
var_idsYesarrayVariant IDs. Maximum: 500 IDs for basic-only requests, or 200 IDs when frequency is included.
includeNostring or arrayAllowed values: basic, frequency. Default: basic,frequency.
populationNostringReturn frequency for one population only. Omit it to return all populations.
Request Example
curl -s -X POST 'https://ricevarmap.ncpgr.cn/v3/api/variants/batch' \
  -H 'Content-Type: application/json' \
  -d '{"var_ids":["vg0100001306","vg0701959554"],"include":["basic","frequency"],"population":"All"}'
Response Sample
{
  "ok": true,
  "data": {
    "results": [
      {
        "var_id": "vg0100001306",
        "reference": "NIP",
        "variant": {
          "var_id": "vg0100001306",
          "reference": "NIP",
          "chr": "chr01",
          "pos": 1306,
          "type": "SNP",
          "ref": "G",
          "alt": "A"
        },
        "frequency": [
          {"population": "All", "major_genotype": "G", "minor_genotype": "A", "major_rate": 0.984}
        ]
      }
    ],
    "count": 1,
    "used_variants": ["vg0100001306"],
    "not_found": [],
    "include": ["basic", "frequency"],
    "population": "All"
  },
  "meta": {"api_version": "v3"},
  "error": null
}

POST /genes/batch

JSON fieldRequiredTypeDescription
gene_idsYesarrayGene IDs. Maximum: 200 IDs. NIP examples use LOC_Os; ZS97 IDs start with OsZS; MH63 IDs start with OsMH.
Request Example
curl -s -X POST 'https://ricevarmap.ncpgr.cn/v3/api/genes/batch' \
  -H 'Content-Type: application/json' \
  -d '{"gene_ids":["LOC_Os05g32860","LOC_Os01g01010"]}'
Response Sample
{
  "ok": true,
  "data": {
    "results": [
      {
        "gene_id": "LOC_Os05g32860",
        "transcript_id": "LOC_Os05g32860.1",
        "reference": "NIP",
        "chr": "chr05",
        "start": 19240767,
        "end": 19241433,
        "strand": "+",
        "note": "expressed protein"
      }
    ],
    "count": 1,
    "used_genes": ["LOC_Os05g32860"],
    "not_found": []
  },
  "meta": {"api_version": "v3"},
  "error": null
}

POST /coordinates/convert/batch

JSON fieldRequiredTypeDescription
var_idsYesarrayVariant IDs to convert through the coordinate-conversion cache. Maximum: 500 IDs.
cache_onlyNobooleanOnly true is currently supported. Default: true.
Request Example
curl -s -X POST 'https://ricevarmap.ncpgr.cn/v3/api/coordinates/convert/batch' \
  -H 'Content-Type: application/json' \
  -d '{"var_ids":["vg0100001306","vg0701959554"],"cache_only":true}'
Response Sample
{
  "ok": true,
  "data": {
    "results": [
      {
        "var_id": "vg0100001306",
        "reference": "NIP",
        "source_genome": "nip",
        "rows": [
          {"window_label": "Up 100bp", "nip_id": "vg0100001306", "zs_id": "vm0100005869", "mh_id": "NA"}
        ]
      }
    ],
    "count": 1,
    "used_variants": ["vg0100001306"],
    "not_found": [],
    "cache_only": true
  },
  "meta": {"api_version": "v3"},
  "error": null
}

POST /primers/by-id

JSON fieldRequiredTypeDescription
var_idYesstringVariant ID for primer design.
upNointegerUpstream window size. Default: 100. Range: 0-10000.
downNointegerDownstream window size. Default: 100. Range: 0-10000. up + down must be <= 20000.
product_size_rangeNostringComma-separated ranges such as 100-300,300-600,600-1000. Default: 100-300,300-600,600-1000.
Request Example
curl -s -X POST 'https://ricevarmap.ncpgr.cn/v3/api/primers/by-id' \
  -H 'Content-Type: application/json' \
  -d '{"var_id":"vg0701959554","up":100,"down":100,"product_size_range":"100-300,300-600,600-1000"}'
Response Sample
{
  "ok": true,
  "data": {
    "var_id": "vg0701959554",
    "reference": "NIP",
    "chr": "chr07",
    "start": 1959454,
    "end": 1959654,
    "target": "100,1",
    "excluded_count": 4,
    "variant": {
      "var_id": "vg0701959554",
      "reference": "NIP",
      "chr": "chr07",
      "pos": 1959554,
      "type": "SNP",
      "ref": "T",
      "alt": "G"
    },
    "primers": [
      {
        "index": 0,
        "left": {"sequence": "CCACAGTTTGGGTTGGATGG", "start": 1959499, "length": 20, "tm": "59.032"},
        "right": {"sequence": "GCCCAAACTCATCGACTGAC", "start": 1959639, "length": 20, "tm": "58.920"},
        "product_size": "141"
      }
    ]
  },
  "meta": {"api_version": "v3"},
  "error": null
}

POST /genotypes/query

JSON fieldRequiredTypeDescription
var_idsYesarrayNIP vg variant IDs. Maximum: 200 IDs. STR, ZS97, and MH63 genotype queries are not supported yet.
cultivarsYesarrayCultivar IDs such as B001 or C145. Maximum: 200 IDs. The request matrix var_ids * cultivars must be <= 20000.
Request Example
curl -s -X POST 'https://ricevarmap.ncpgr.cn/v3/api/genotypes/query' \
  -H 'Content-Type: application/json' \
  -d '{"var_ids":["vg0100001306"],"cultivars":["B001","C145"]}'
Response Sample
{
  "ok": true,
  "data": {
    "results": [
      {
        "variant": {
          "var_id": "vg0100001306",
          "reference": "NIP",
          "chr": "chr01",
          "pos": 1306,
          "type": "SNP",
          "ref": "G",
          "alt": "A",
          "major_genotype": "G",
          "minor_genotype": "A"
        },
        "genotypes": {
          "B001": {"imputed": "G", "raw": "G"},
          "C145": {"imputed": "G", "raw": "G"}
        }
      }
    ],
    "count": 1,
    "used_variants": ["vg0100001306"],
    "not_found": []
  },
  "meta": {"api_version": "v3"},
  "error": null
}

API Reference

Response Format

{
  "ok": true,
  "data": {},
  "meta": {
    "api_version": "v3"
  },
  "error": null
}
{
  "ok": false,
  "data": null,
  "meta": {
    "api_version": "v3"
  },
  "error": {
    "code": "INVALID_PARAMETER",
    "message": "Invalid parameter."
  }
}

Error Codes

CodeHTTPMeaning
METHOD_NOT_ALLOWED405The endpoint was called with the wrong HTTP method.
MISSING_PARAMETER400A required path, query, or JSON field is missing.
INVALID_PARAMETER400A parameter has the wrong type, range, or format.
INVALID_CHROM400Chromosome must be chr01 through chr12.
INVALID_REFERENCE400Reference must be NIP, ZS97, or MH63.
INVALID_POPULATION400Population must be one of the supported RiceVarMap population codes.
INVALID_VARIANT_ID400Variant ID does not match a supported RiceVarMap v3 ID format.
INVALID_GENE_ID400Gene ID contains unsupported characters.
UNSUPPORTED_INCLUDE400include contains a section that is not supported.
LIMIT_TOO_LARGE400limit is greater than 1000.
REGION_TOO_LARGE400The requested interval is larger than 100000 bp.
REQUEST_TOO_LARGE413POST body is larger than 1 MB.
UNSUPPORTED_VARIANT_TYPE400The requested variant type or genotype mode is not currently supported.
NOT_FOUND404The requested variant, gene, sequence interval, or genotype record was not found.
CACHE_MISS404No coordinate-conversion cache record is available for the variant.
INTERNAL_ERROR500An unexpected server-side error occurred.

Request Limits

These limits are enforced to keep interactive queries responsive and to protect shared server resources. Split larger jobs into multiple requests or use project-specific offline workflows for heavy analyses.

ItemLimit
Paginationlimit defaults to 100 and must be <= 1000. offset defaults to 0.
Cultivar batch queryMaximum 500 cultivars per /cultivars/batch request.
Variant batch queryMaximum 500 var_ids for basic-only /variants/batch requests; maximum 200 when frequency is included.
Gene batch queryMaximum 200 gene_ids per /genes/batch request.
Coordinate batch queryMaximum 500 var_ids per /coordinates/convert/batch request.
Region intervalend must be greater than start; interval length must be <= 100000 bp.
Chromosomeschr01 through chr12.
Gene flank sizesup and down are 0-10000.
Primer windowup and down are 0-10000, and up + down must be <= 20000.
Genotype query sizeMaximum 200 var_ids, 200 cultivars, and var_ids * cultivars <= 20000 per request.
POST bodyMaximum 1 MB.
Cultivar search and filtersq, subpopulation, and location must be 100 characters or fewer.
Gene searchq is required and must be 100 characters or fewer.
STR supportSTR region and detail queries are available for NIP only.
Genotype supportThe genotype endpoint currently supports NIP vg IDs only.

Python Example

import requests

BASE = "https://ricevarmap.ncpgr.cn/v3/api"

# GET example: search variants in a genomic region.
get_response = requests.get(
    f"{BASE}/variants/by-region",
    params={
        "reference": "NIP",
        "chr": "chr01",
        "start": 10000,
        "end": 20000,
        "limit": 10,
    },
    timeout=30,
)
get_response.raise_for_status()
print(get_response.json()["data"]["variants"])

# POST example: query multiple variants by ID.
post_response = requests.post(
    f"{BASE}/variants/batch",
    json={
        "var_ids": ["vg0100001306", "vg0701959554"],
        "include": ["basic", "frequency"],
        "population": "All",
    },
    timeout=30,
)
post_response.raise_for_status()
print(post_response.json()["data"]["results"])

R Example

library(httr)
library(jsonlite)

base <- "https://ricevarmap.ncpgr.cn/v3/api"

res <- GET(
  paste0(base, "/variants/by-region"),
  query = list(reference = "NIP", chr = "chr01", start = 10000, end = 20000, limit = 10)
)
stop_for_status(res)
data <- fromJSON(content(res, as = "text", encoding = "UTF-8"))
print(data$data$variants)

res <- GET(
  paste0(base, "/genes/search"),
  query = list(reference = "NIP", q = "LOC_Os05g32860", limit = 5)
)
stop_for_status(res)
data <- fromJSON(content(res, as = "text", encoding = "UTF-8"))
print(data$data$genes)

res <- POST(
  paste0(base, "/variants/batch"),
  body = list(
    var_ids = list("vg0100001306", "vg0701959554"),
    include = list("basic", "frequency"),
    population = "All"
  ),
  encode = "json"
)
stop_for_status(res)
data <- fromJSON(content(res, as = "text", encoding = "UTF-8"))
print(data$data$results)

res <- POST(
  paste0(base, "/genotypes/query"),
  body = list(var_ids = list("vg0100001306"), cultivars = list("B001", "C145")),
  encode = "json"
)
stop_for_status(res)
data <- fromJSON(content(res, as = "text", encoding = "UTF-8"))
print(data$data$results)

IDs and References

ReferenceLabelVariant prefixSTR
NIPNipponbare / IRGSP-1.0vgYes
ZS97ZS97RS3vzNo
MH63MH63RS3vmNo
  • Variant IDs follow vg|vz|vm + chromosome + 8-digit position, for example vg0100001306.
  • STR IDs use STR + chromosome + 8-digit position, for example STR0100000001.
  • Gene IDs starting with OsZS are treated as ZS97, IDs starting with OsMH are treated as MH63, and other gene IDs are treated as NIP.
  • Population codes include All, Ind_All, Jap_All, Aus, IndI, IndII, IndIII, TeJ, TrJ, VI, Admix, Ind_Admix, and Jap_Admix.
TOC

Navigation