General form

URL form

https://api.kegg.net/<operation>/<argument>[/<argument2[/<argument3> ...]] <operation> = info | list | find | get | conv | link | ddi | upload | idmap | map | data

Database name

<database> = KEGG databases (Tables 1 and 2), KEGG MEDICUS extension databases (Table 3) and Outside databases integrated in KEGG (Table 4) = pathway | brite | module | ko | genome | <org> | vg | ag | compound | glycan | reaction | rclass | enzyme | network | variant | disease | drug | dgroup | environ | genes | ligand | kegg | <medicus> | <outside> <org> = KEGG organism code <medicus> = disease_ja | drug_ja | dgroup_ja | environ_ja | compound_ja | brite_ja | atc | atc_ja | jtc_en | jtc | ndc | yj <outside> = pubmed | ncbi-geneid | ncbi-proteinid | uniprot | pubchem | chebi

Database entry identifier

<dbentry> = <kid> | <org>:<gene> | <database>:<entry> <kid> = KEGG identifier <gene> = Gene entry name or accession <entry> = Database entry name or accession <dbentries> = <dbentry>1[+<dbentry>2...]

Output

Output format

The output of all operations is in a text format:
  • tab-delimited text returned from list, find, conv and link
  • flat file database format returned from get
  • text message returned from info

Status code

The HTTP status code can be used to check if the operation was successful.

Code  Meaning
200Success
400Bad request (syntax error, wrong database name, etc.)
401Unauthorized (lacking valid authentication credentials)
404Not found (e.g., requesting amino acid sequence for RNA)


INFO

Name

info – display database release information and linked db information

URL form

https://api.kegg.net/info/<database> <database> = kegg | pathway | brite | module | ko | genome | genes | <org> | vg | ag | ligand | compound | glycan | reaction | rclass | enzyme | network | variant | disease | drug | dgroup | environ

Description

This operation displays the database release information with statistics for the databases shown in Table 1. Except for kegg, genes and ligand, this operation also displays the list of linked databases that can be used in the link operation.

Examples

/info/kegg    displays the current statistics of the KEGG database
/info/pathway    displays the number of pathway entries including both the reference and organism-specific pathways
/info/hsa    displays the number of gene entries for the KEGG organism Homo sapiens

See also

Current statistics in the KEGG website.


LIST

Name

list – obtain a list of entry identifiers and associated definition

URL form

https://api.kegg.net/list/<database>[/<option>] <database> = pathway | brite | module | ko | genome | <org> | vg | ag | compound | glycan | reaction | rclass | enzyme | network | variant | disease | drug | dgroup | environ | organism | <medicus> <option> = xl

https://api.kegg.net/list/<database>/<org> <database> = pathway | module

https://api.kegg.net/list/<dbentries> <dbentries> = Entries of the following <database> <database> = pathway | brite | module | ko | genome | <org> | vg | ag | compound | glycan | reaction | rclass | enzyme | network | variant | disease | drug | dgroup | environ | <medicus>

Description

This operation can be used to obtain a list of all entries in each database. The database names shown in Tables 1 and 2, excluding the composite database names of genes, ligand and kegg, may be given. The special database name "organism" is allowed only in this operation, which may be used to obtain a list of KEGG organisms with the three- or four-letter organism codes.

The option "xl" is applicable only to the brite database for listing binary relation files, which are used to expand brite hierarchies by the Join Brite tool in KEGG Mapper.

When the organism code is known, the second form can be used to obtain a list of organism-specific pathways or modules.

The third form may be used to obtain a list of definitions for a given set of database entry identifiers. The maximum number of identifiers that can be given is 100.

Examples

/list/pathway    returns the list of reference pathways
/list/pathway/hsa    returns the list of human pathways
/list/organism    returns the list of KEGG organisms with taxonomic classification
/list/hsa    returns the entire list of human genes
/list/T01001    same as above
/list/hsa:10458+ece:Z5100    returns the list of a human gene and an E.coli O157 gene
/list/cpd:C01290+gl:G00092    returns the list of a compound entry and a glycan entry
/list/C01290+G00092    same as above


FIND

Name

find – find entries with matching query keyword or other query data

URL form

https://api.kegg.net/find/<database>/<query> <database> = pathway | brite | module | ko | genome | genes | <org> | vg | ag | ligand | compound | glycan | reaction | rclass | enzyme | network | variant | disease | drug | dgroup | environ | <medicus>

https://api.kegg.net/find/<database>/<query>/<option> <database> = compound | drug <option> = formula | exact_mass | mol_weight

Description

This is a search operation. The first form searches entry identifier and associated fields shown below for matching keywords.

DatabaseText search fields (see flat file format)
pathwayENTRY and NAME
moduleENTRY and NAME
koENTRY, NAME and DEFINITION
genomeENTRY, NAME and DEFINITION
genes (<org>, vg, ag)ENTRY, ORTHOLOGY, NAME and DEFINITION
compoundENTRY and NAME
glycanENTRY, NAME and COMPOSITION
reactionENTRY, NAME and DEFINITION
rclassENTRY and DEFINITION
enzymeENTRY and NAME
networkENTRY and NAME
variant (hsa_var)ENTRY and NAME
diseaseENTRY and NAME
drugENTRY and NAME
dgroupENTRY and NAME
environENTRY and NAME
Keyword search against brite is not supported. Use /list/brite to retrieve a short list.

In the second form the chemical formula search is a partial match irrespective of the order of atoms given. The exact mass (or molecular weight) is checked by rounding off to the same decimal place as the query data. A range of values may also be specified with the minus(-) sign.

Examples

/find/genes/shiga+toxin    for keywords "shiga" and "toxin"
/find/genes/"shiga toxin"    for keywords "shiga toxin"
/find/compound/C7H10O5/formula    for chemical formula "C7H10O5"
/find/compound/O5C7/formula    for chemical formula containing "O5" and "C7"
/find/compound/174.05/exact_mass    for 174.045 =< exact mass < 174.055
/find/compound/300-310/mol_weight    for 300 =< molecular weight =< 310


GET

Name

get – retrieve given database entries

URL form

https://api.kegg.net/get/<dbentries>[/<option>] <dbentries> = KEGG database entries of the following <database> <database> = pathway | brite | module | ko | genome | <org> | vg | ag | compound | glycan | reaction | rclass | enzyme | network | variant | disease | drug | dgroup | environ | disease_ja | drug_ja | dgroup_ja | environ_ja | compound_ja <option> = aaseq | ntseq | mol | kcf | image | conf | kgml | json

Description

This operation retrieves given database entries in a flat file format or in other formats with options. Flat file formats are available for all KEGG databases except brite. The input is limited up to 100 entries.

Options allow retrieval of selected fields, including sequence data (aaseq, ntseq) from genes entries, chemical structure data (mol, kcf) or gif image files (image) from compound, glycan and drug entries, png image files (image) or kgml files from pathway entries, and json files from brite entries. The input is limited to one compound/glycan/drug entry with the image option, to one pathway entry with the image or kgml option, and to one brite entry with the json option.

Examples

/get/cpd:C01290+gl:G00092    retrieves a compound entry and a glycan entry
/get/C01290+G00092    same as above
/get/hsa:10458+ece:Z5100    retrieves a human gene entry and an E.coli O157 gene entry
/get/hsa:10458+ece:Z5100/aaseq    retrieves amino acid sequences of a human gene and an E.coli O157 gene
/get/C00002/image    retrieves the gif image file of a compound
/get/hsa05130/image    retrieves the png image file of a pathway map
/get/hsa05130/conf    retrieves the conf file of a pathway map
/get/hsa05130/kgml    retrieves the kgml file of a pathway map
/get/br:br08301    retrieves the htext file of a brite hierarchy
/get/br:br08301/json    retrieves the json file of a brite hierarchy


CONV

Name

conv – convert KEGG identifiers to/from outside identifiers

URL form

https://api.kegg.net/conv/<target_db>/<source_db> (<target_db> <source_db>) = (<kegg_db> <outside_db>) | (<outside_db> <kegg_db>) For gene identifiers: <kegg_db> = <org> <org> = KEGG organism code or T number <outside_db> = ncbi-geneid | ncbi-proteinid | uniprot For chemical substance identifiers: <kegg_db> = compound | glycan | drug <outside_db> = pubchem | chebi

https://api.kegg.net/conv/<target_db>/<dbentries> For gene identifiers: <dbentries> = database entries of the following <database> <database> = <org> | genes | ncbi-geneid | ncbi-proteinid | uniprot <org> = KEGG organism code or T number For chemical substance identifiers: <dbentries> = database entries of the following <database> <database> = compound | glycan | drug | pubchem | chebi

Description

This operation can be used to convert entry identifiers (accession numbers) of outside databases to KEGG identifiers, and vice versa. The first form allows database to database mapping, while the second form allows conversion of a selected number of entries. The database name "genes" may be used only in the second form.

Examples

/conv/eco/ncbi-geneid    conversion from NCBI GeneID to KEGG ID for E. coli genes
/conv/ncbi-geneid/eco    opposite direction
/conv/ncbi-proteinid/hsa:10458+ece:Z5100    conversion from KEGG ID to NCBI ProteinID
/conv/genes/ncbi-geneid:19831932    conversion from NCBI GeneID to KEGG ID when the organism code is not known

See also

idmap for conversion of user's data.


LINK

Name

link – find related entries by using database cross-references

URL form

https://api.kegg.net/link/<target_db>/<source_db> <target_db> = <database> <source_db> = <database> <database> = pathway | brite | module | ko | genome | <org> | vg | ag | compound | glycan | reaction | rclass | enzyme | network | variant | disease | drug | dgroup | environ | atc | jtc | ndc | yj | pubmed

https://api.kegg.net/link/<target_db>/<dbentries> <dbentries> = KEGG database entries of the following <database> <database> = pathway | brite | module | ko | genome | <org> | vg | ag | compound | glycan | reaction | rclass | enzyme | network | variant | disease | drug | dgroup | environ | genes | atc | jtc | ndc | yj | pubmed

Description

This operation allows retrieval of cross-references within all KEGG databases, as well as pubmed. It is useful for finding various relationships, such as relationships between genes and pathways. The first form allows retrieval of database to database cross-references, while the second form allows retrieval for a selected number of entries. The database name "genes" may be used only for "ko" entries in the second form.

Examples

/link/pathway/hsa    KEGG pathways linked from each of the human genes
/link/hsa/pathway    human genes linked from each of the KEGG pathways
/link/pathway/hsa:10458+ece:Z5100    KEGG pathways linked from a human gene and an E. coli O157 gene
/link/genes/K00500    List of genes with the KO assignment of K00500
/link/hsa/hsa00010    List of human genes in pathway hsa00010
/link/ko/map00010 or /link/ko/ko00010    List of KO entries in pathway map00010 or ko00010
/link/rn/map00010 or /link/rn/rn00010    List of reaction entries in pathway map00010 or rn00010
/link/ec/map00010 or /link/ec/ec00010    List of EC number entries in pathway map00010 or ec00010
/link/cpd/map00010    List of compound entries in pathway map00010
/link/drug/ndc    NDC codes linked from KEGG DRUG entries
/link/ndc/D00564    NDC codes that correspond to given a KEGG DRUG entry

See also

idmap for linking from user's data.


DDI

Name

ddi – find adverse drug-drug interactions

URL form

https://api.kegg.net/ddi/<dbentry> <dbentry> = Single entry of the following <database> <database> = drug | ndc | yj

https://api.kegg.net/ddi/<dbentries> <dbentries> = Multiple entries of the following <database> <database> = drug | ndc | yj

Description

This operation searches against the KEGG MEDICUS drug interaction database, where drug-drug interactions designated as contraindication (CI) and precaution (P) in Japanese drug labels are extracted and standardized by D number and DG number identifiers. The first form reports all known interactions, while the second form can be used to check if any drug pair in a given set of drugs is CI or P. The database name "drug" should be used instead of "drug_ja". In the second form, multiple entries must belong to the same database.

Examples

/ddi/D00564    drugs that are known to interact with a given drug
/ddi/D00564+D00100+D00109    checks if adverse drug-drug interactions are present among given drugs


UPLOAD

Name

upload - upload user's data and receive user data ID

URL form

Not applicable

Description

This operation uploads locally stored data to the KEGG API server by the HTTP POST method. Specify either the parameter 'query' for text data to be uploaded or the parameter 'queryfile' for the file name containing the text data. When the upload is successful, this operation returns an ID (8-digit number) for the uploaded data, which may be used in the idmap, map and data operations.

Currently, only the list of IDs is meaningful as the user's data. Prepare the data as follows.
  1. In each line specify one ID, which may optionally be followed by tab-delimited color specification (used only in the map operation).
  2. Comment lines may be inserted with # in the first column.
  3. The comment lines at the top may also be used to specify default parameters for the map operation, such as:
       #default=pink
       #nocolor
    for setting default bgcolor (pink, for example) and using uncolored diagram, respectively (see KEGG Mapper Search&Color Pathway).
  4. IDs must be in the form of KEGG identifiers shown in Table 2 or other database entry identifiers shown in Tables 3 and 4.
The uploaded data may be deleted by the data operation. Otherwise, it is automatically deleted after one week.

Examples

Perl example (1)

#!/bin/env perl # ./upload.pl filename use strict; use HTTP::Request::Common qw(POST); use LWP::UserAgent; my $query_str; while (<>) { $query_str .= $_; } my %postdata = ( 'query' => $query_str ); my $request = POST( 'https://api.kegg.net/upload', \%postdata ); $request->authorization_basic('username', 'password'); my $ua = LWP::UserAgent->new; my $data_id = $ua->request($request)->content; print $data_id; exit;

Perl example (2)

#!/bin/env perl # ./upload.pl filename use strict; use HTTP::Request::Common qw(POST); use LWP::UserAgent; my ($filename) = @ARGV; my $request = POST( 'https://api.kegg.net/upload', Content_Type => 'form-data', Content => [ queryfile => [ $filename ] ] ); $request->authorization_basic('username', 'password'); my $ua = LWP::UserAgent->new; my $data_id = $ua->request($request)->content; print $data_id; exit;

Curl example

curl -u username:password -F queryfile=@filename https://api.kegg.net/upload

See also

data for checking uploaded data.


IDMAP

Name

idmap – perform ID mapping of user's data

URL form

https://api.kegg.net/idmap/<target_db>/<source_db>/<user_data_id> <target_db> = pathway | brite | module <source_db> = ko | <org> | reaction | compound | glycan | drug <user_data_id> = User data ID returned by upload operation

https://api.kegg.net/idmap/<target_db>/<source_db>/<user_data_id> <target_db> = genes | <org> <source_db> = ncbi-geneid | ncbi-proteinid | uniprot <target_db> = compound | glycan | drug <source_db> = pubchem | chebi <target_db> = drug <source_db> = ndc | yj <user_data_id> = User data ID returned by upload operation

Description

This operation is similar to the link and conv operations, but is different in that the link/conv is applied only to those data that are present in the user's dataset. In other words, the user's data (in the first column of each line) that match the source database entries are mapped to the target database.

The first URL form is the one used in the Search and Search&Color tools of KEGG Mapper, which actually consists of two steps corresponding to the idmap and map operations. In this first-step operation, for example, human genes in the user's dataset are checked against all the human pathway maps. The result is a correspondence list of human gene IDs and pathway map numbers, from which a list of pathway map numbers with the number of matching genes may be generated in a similar way as the web interface of KEGG Mapper.

The second URL form is useful for converting outside identifiers in the user's dataset to KEGG identifiers.

Examples

/idmap/pathway/hsa/00000001    map user's human genes to KEGG pathways
/idmap/module/hsa/00000001    map user's human genes to KEGG modules
/idmap/pathway/cpd/00000001    map user's chemical compounds to KEGG pathways
/idmap/brite/drug/00000001    map user's drugs to BRITE hierarchies
/idmap/drug/ndc/00000001    convert user's NDCs to KEGG DRUG IDs
/idmap/genes/ncbi-geneid/00000001    convert user's NCBI-GeneIDs to KEGG GENES IDs

See also

/data/view/00000001    content of uploaded data ID 00000001


MAP

Name

map – perform KEGG pathway, brite or module mapping of user's data

URL form

https://api.kegg.net/map/<database>/<user_data_id>[/<option>] <database> = pathway | brite | module <user_data_id> = User data ID returned by upload operation <option> = complete

https://api.kegg.net/map/<dbentry>/<user_data_id>[/<option>] <dbentry> = Single entry of the following <database> <database> = pathway | brite | module <user_data_id> = User data ID returned by upload operation <option> = html | image | htext

Description

The first URL form is for mapping a KO dataset (list of K numbers) against the reference pathway, brite or module database, corresponding to the Search, Search&Color and Reconstruct tools of KEGG Mapper. The option "complete" is applicable to the module database only. The output is a list of IDs with the numbers of hits for pathway and brite or with the attribute of complete or almost complete (1 block missing) for module.

The second URL form applies to a single entry of both reference and organism-specific pathway, brite and module databases. This map operation highlights a pathway map, a brite hierarchy or a KEGG module, which may be selected from the result of idmap operation or the first form of map operation, with the coloring specified in the uploaded user data. The default output format is html, and the optional formats are: image for pathway/module and htext for brite.

Examples

/map/pathway/00000002    list of pathway maps reconstructed from KO dataset
/map/brite/00000002    list of brite hierarchies reconstructed from KO dataset
/map/module/00000002    list of modules reconstructed from KO dataset
/map/module/00000002/complete    list of complete modules reconstructed from KO dataset
/map/md:M00002/00000002    module mapping result in html
/map/path:hsa04922/00000001    pathway mapping result in html
/map/path:hsa04922/00000001/image    pathway mapping result in png image
/map/br:br08313/00000001    brite mapping result in html
/map/br:br08313/00000001/htext    brite mapping result in htext file
/map/br:br08314/00000001    brite table mapping result in html

See also

/data/view/00000001    content of uploaded data ID 00000001
/data/view/00000002    content of uploaded data ID 00000002


DATA

Name

data – view status of uploded data

URL form

https://api.kegg.net/data/<option>[/<user_data_id>] <option> = status | view | delete <user_data_id> = User data ID returned by upload operation

Description

This operation may be used to check the status of uploaded datasets, or view and delete a selected dataset. The "status" option returns the list of user data IDs, uploaded date and file size. Uploaded data will be deleted automatically after one week, but the "delete" option may be used to delete manually. It does not return any content; check the HTTP status code.

Examples

/data/status    check the status of uploaded data
/data/view/00000001    view the content of uploaded data ID 00000001


Last updated: December 1, 2017