User Tools

Site Tools


api

API base url: https://mcule.com/api/v1/

Examples are demonstrated with HTTPie.

Response status codes

  • 200 OK - Success response
  • 400 BAD REQUEST - A validation error typically
  • 401 UNAUTHORIZED - Unauthorized
  • 403 FORBIDDEN - Permission denied
  • 404 NOT FOUND - Not found
  • 500 SERVER ERROR - Something went wrong

Public API endpoints

Public API endpoints are accessible to everyone, without authentication.

Database files

Endpoint:
/database-files/
Example API request:
http https://mcule.com/api/v1/database-files/ --print HBhb
Request:
GET /api/v1/database-files/ HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Response:
HTTP/1.1 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json

[
    {
        "created": "2015-05-18",
        "description": "Gzipped 2D SDF of all purchasable compounds",
        "download_size_gb": 2.2,
        "download_url": "https://mcule.s3.amazonaws.com/mcule_purchasable_compounds_150518.sdf.gz",
        "entry_count": 11695894,
        "name": "mcule_purchasable_compounds"
    },
    {
        "created": "2015-05-18",
        "description": "Gzipped 2D SDF of in stock compounds with known or unknown exact stock amount",
        "download_size_gb": 1.4,
        "download_url": "https://mcule.s3.amazonaws.com/mcule_in_stock_compounds_150518.sdf.gz",
        "entry_count": 5827052,
        "name": "mcule_in_stock_compounds"
    },
    {
        "created": "2015-05-18",
        "description": "Gzipped 2D SDF of in stock compounds with known exact stock amount",
        "download_size_gb": 1.2,
        "download_url": "https://mcule.s3.amazonaws.com/mcule_known_stock_amount_compounds_150518.sdf.gz",
        "entry_count": 4922295,
        "name": "mcule_known_stock_amount_compounds"
    },
    {
        "created": "2015-08-20",
        "description": "Gzipped 2D SDF of purchasable compounds with known prices",
        "download_size_gb": 2.2,
        "download_url": "https://mcule.s3.amazonaws.com/mcule_instant_quotable_compounds_150820.sdf.gz",
        "entry_count": 11533450,
        "name": "mcule_instant_quotable_compounds"
    },
    {
        "created": "2014-07-21",
        "description": "Gzipped csv (delimiter: tab) of all compounds with mcule ID, standard InChI and InChIKey",
        "download_size_gb": 0.4,
        "download_url": "https://mcule.s3.amazonaws.com/mcule_inchies_140721.csv.gz",
        "entry_count": 7334938,
        "name": "mcule_inchies"
    }
]

Authentication

Authentication is currently a token based authentication. If you would like to access our protected API endpoints, please drop us an email at info@mcule.com and we can provide you with a token.

Once you have a valid token you have to send it in the Authorization header:

Authorization: Token <your_token>

Protected API endpoints

Protected API endpoints are only accessible if a valid token is provided in the Authorization header of the request.

Multiple queries exact search currently accepts the following input identifiers: mcule ID, SMILES, InChI or InChIKey identifiers.

Endpoint:
/search/exact/
Example API request:
echo {"queries": ["COC(C1SC(C=CC2SC(C3=NC=CC=C3)=NC=2)=NC=1)=O", "CC1=C(C(N2CC3C(CCC3N)C2)=O)SC(CC2=CC=CC=C2)=N1", "C1([C@H](C(C)C)NC(CCCCC2CCSS2)=O)NC2=C(C=CC=C2)N=1", "C1C=C(COC(C(O)(CC2C=CC(O)=CC=2)C(C)OC(C(O)(CC2C=CC(O)=CC=2)C(C)OC(C)=O)=O)=O)C=CC=1OC1C(O)C(O)C(O)C(CO)O1", "CCCCC1=CC=C(CC(N(CC2CCN(C)CC2)C)=O)C=C1"]} | http https://mcule.com/api/v1/search/exact/ "Authorization: Token <your_token>" --print HBhb
Request:
POST /api/v1/search/exact/ HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Authorization: Token <your_token>
Content-Type: application/json

{
    "queries": [
        "COC(C1SC(C=CC2SC(C3=NC=CC=C3)=NC=2)=NC=1)=O",
        "CC1=C(C(N2CC3C(CCC3N)C2)=O)SC(CC2=CC=CC=C2)=N1",
        "C1([C@H](C(C)C)NC(CCCCC2CCSS2)=O)NC2=C(C=CC=C2)N=1",
"C1C=C(COC(C(O)(CC2C=CC(O)=CC=2)C(C)OC(C(O)(CC2C=CC(O)=CC=2)C(C)OC(C)=O)=O)=O)C=CC=1OC1C(O)C(O)C(O)C(CO)O1",
        "CCCCC1=CC=C(CC(N(CC2CCN(C)CC2)C)=O)C=C1"
    ]
}
Response:
HTTP/1.1 200 OK
Allow: POST, OPTIONS
Content-Encoding: gzip
Content-Type: application/json

{
    "results": [
        {
            "input_index": 1,
            "mcule_id": "MCULE-9380369173"
        },
        {
            "input_index": 3,
            "mcule_id": "MCULE-3346133370"
        },
        {
            "input_index": 4,
            "mcule_id": "MCULE-6639674955"
        },
        {
            "input_index": 5,
            "mcule_id": "MCULE-1259420189"
        }
    ]
}

Multiple queries exact search with availability

Endpoint:
/search/exact/availability/
Example API request:
echo {"queries": ["COC(C1SC(C=CC2SC(C3=NC=CC=C3)=NC=2)=NC=1)=O", "CC1=C(C(N2CC3C(CCC3N)C2)=O)SC(CC2=CC=CC=C2)=N1", "C1([C@H](C(C)C)NC(CCCCC2CCSS2)=O)NC2=C(C=CC=C2)N=1", "C1C=C(COC(C(O)(CC2C=CC(O)=CC=2)C(C)OC(C(O)(CC2C=CC(O)=CC=2)C(C)OC(C)=O)=O)=O)C=CC=1OC1C(O)C(O)C(O)C(CO)O1", "CCCCC1=CC=C(CC(N(CC2CCN(C)CC2)C)=O)C=C1"]} | http https://mcule.com/api/v1/search/exact/availability/ "Authorization: Token <your_token>" --print HBhb
Request:
POST /api/v1/search/exact/availability/ HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Authorization: Token <your_token>
Content-Type: application/json

{
    "queries": [
        "COC(C1SC(C=CC2SC(C3=NC=CC=C3)=NC=2)=NC=1)=O",
        "CC1=C(C(N2CC3C(CCC3N)C2)=O)SC(CC2=CC=CC=C2)=N1",
        "C1([C@H](C(C)C)NC(CCCCC2CCSS2)=O)NC2=C(C=CC=C2)N=1",
"C1C=C(COC(C(O)(CC2C=CC(O)=CC=2)C(C)OC(C(O)(CC2C=CC(O)=CC=2)C(C)OC(C)=O)=O)=O)C=CC=1OC1C(O)C(O)C(O)C(CO)O1",
        "CCCCC1=CC=C(CC(N(CC2CCN(C)CC2)C)=O)C=C1"
    ]
}
Response:
HTTP/1.1 200 OK
Allow: POST, OPTIONS
Content-Encoding: gzip
Content-Type: application/json

{
    "results": [
        {
            "availability": {
                "availability_type": "in stock",
                "confirmed_amount_mg": 243
            },
            "input_index": 1,
            "mcule_id": "MCULE-9380369173"
        },
        {
            "availability": {
                "availability_type": "in stock",
                "confirmed_amount_mg": null
            },
            "input_index": 3,
            "mcule_id": "MCULE-3346133370"
        },
        {
            "availability": {
                "availability_type": "not in stock",
                "confirmed_amount_mg": null
            },
            "input_index": 4,
            "mcule_id": "MCULE-6639674955"
        },
        {
            "availability": {
                "availability_type": "potentially purchasable",
                "confirmed_amount_mg": null
            },
            "input_index": 5,
            "mcule_id": "MCULE-1259420189"
        }
    ]
} 
api.txt · Last modified: 2015/11/01 01:49 by flack