PubChem Compounds API

Operations on compound records

Operations 6

GET /compound/cid/{cids}/{format} Get compound records by CID
GET /compound/name/{name}/{format} Get compound records by name
GET /compound/smiles/{smiles}/{format} Get compound records by SMILES
GET /compound/inchikey/{inchikey}/{format} Get compound records by InChI Key
GET /compound/cid/{cids}/property/{properties}/{format} Get compound properties
GET /compound/cid/{cids}/synonyms/{format} Get compound synonyms

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/pubchem-compounds-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

pubchem-compounds-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: PubChem PUG REST Compounds API
  description: 'PUG REST is a REST-style version of PUG (Power User Gateway), a web interface for accessing PubChem data and services. PUG REST provides access to the data in PubChem Compounds as well as specialized chemical structure search services.


    The service supports various input formats including chemical names, SMILES strings, InChI identifiers, and direct database identifiers. It can return data in multiple formats including JSON, XML, CSV, SDF, and PNG images.

    '
  version: 1.0.0
  contact:
    email: pubchem-help@ncbi.nlm.nih.gov
  license:
    name: Public Domain
    url: https://www.ncbi.nlm.nih.gov/home/about/policies/
servers:
- url: https://pubchem.ncbi.nlm.nih.gov/rest/pug
  description: PubChem PUG REST API
tags:
- name: Compounds
  description: Operations on compound records
paths:
  /compound/cid/{cids}/{format}:
    get:
      tags:
      - Compounds
      summary: Get compound records by CID
      description: Retrieve full compound records for the specified CIDs
      parameters:
      - name: cids
        in: path
        required: true
        schema:
          type: string
        description: Comma-separated list of Compound IDs (CIDs)
        example: 2244,5793
      - name: format
        in: path
        required: true
        schema:
          type: string
          enum:
          - XML
          - JSON
          - JSONP
          - ASNT
          - ASNB
          - SDF
          - PNG
          - TXT
          default: JSON
        description: Output format
      - name: record_type
        in: query
        schema:
          type: string
          enum:
          - 2d
          - 3d
          default: 2d
        description: Type of conformer for compounds
      - name: image_size
        in: query
        schema:
          type: string
          default: large
        description: Image size - large (300x300), small (100x100), or custom (e.g. 320x240)
      - name: callback
        in: query
        schema:
          type: string
        description: Callback function name for JSONP format
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompoundRecords'
            application/xml:
              schema:
                $ref: '#/components/schemas/CompoundRecords'
            chemical/x-mdl-sdfile:
              schema:
                type: string
            image/png:
              schema:
                type: string
                format: binary
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
  /compound/name/{name}/{format}:
    get:
      tags:
      - Compounds
      summary: Get compound records by name
      description: Retrieve compound records for the specified chemical name
      parameters:
      - name: name
        in: path
        required: true
        schema:
          type: string
        description: Chemical name
        example: aspirin
      - name: format
        in: path
        required: true
        schema:
          type: string
          enum:
          - XML
          - JSON
          - JSONP
          - ASNT
          - ASNB
          - SDF
          - PNG
          - TXT
          default: JSON
        description: Output format
      - name: name_type
        in: query
        schema:
          type: string
          enum:
          - word
          - complete
        description: Name matching type
      - name: record_type
        in: query
        schema:
          type: string
          enum:
          - 2d
          - 3d
          default: 2d
        description: Type of conformer for compounds
      - name: image_size
        in: query
        schema:
          type: string
          default: large
        description: Image size for PNG format
      - name: callback
        in: query
        schema:
          type: string
        description: Callback function name for JSONP format
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompoundRecords'
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
  /compound/smiles/{smiles}/{format}:
    get:
      tags:
      - Compounds
      summary: Get compound records by SMILES
      description: Retrieve compound records for the specified SMILES string
      parameters:
      - name: smiles
        in: path
        required: true
        schema:
          type: string
        description: SMILES string (URL-encoded)
        example: CCCC
      - name: format
        in: path
        required: true
        schema:
          type: string
          enum:
          - XML
          - JSON
          - JSONP
          - ASNT
          - ASNB
          - SDF
          - PNG
          - TXT
          default: JSON
        description: Output format
      - name: record_type
        in: query
        schema:
          type: string
          enum:
          - 2d
          - 3d
          default: 2d
        description: Type of conformer for compounds
      - name: image_size
        in: query
        schema:
          type: string
          default: large
        description: Image size for PNG format
      - name: callback
        in: query
        schema:
          type: string
        description: Callback function name for JSONP format
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompoundRecords'
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
  /compound/inchikey/{inchikey}/{format}:
    get:
      tags:
      - Compounds
      summary: Get compound records by InChI Key
      description: Retrieve compound records for the specified InChI Key
      parameters:
      - name: inchikey
        in: path
        required: true
        schema:
          type: string
        description: InChI Key
        example: BPGDAMSIGCZZLK-UHFFFAOYSA-N
      - name: format
        in: path
        required: true
        schema:
          type: string
          enum:
          - XML
          - JSON
          - JSONP
          - ASNT
          - ASNB
          - SDF
          - PNG
          - TXT
          default: JSON
        description: Output format
      - name: record_type
        in: query
        schema:
          type: string
          enum:
          - 2d
          - 3d
          default: 2d
        description: Type of conformer for compounds
      - name: image_size
        in: query
        schema:
          type: string
          default: large
        description: Image size for PNG format
      - name: callback
        in: query
        schema:
          type: string
        description: Callback function name for JSONP format
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompoundRecords'
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
  /compound/cid/{cids}/property/{properties}/{format}:
    get:
      tags:
      - Compounds
      summary: Get compound properties
      description: Retrieve specific properties for the specified compounds
      parameters:
      - name: cids
        in: path
        required: true
        schema:
          type: string
        description: Comma-separated list of Compound IDs (CIDs)
        example: 1,2,3,4,5
      - name: properties
        in: path
        required: true
        schema:
          type: string
        description: Comma-separated list of property names
        example: MolecularFormula,MolecularWeight,InChIKey
      - name: format
        in: path
        required: true
        schema:
          type: string
          enum:
          - XML
          - JSON
          - JSONP
          - ASNT
          - ASNB
          - CSV
          - TXT
          default: JSON
        description: Output format
      - name: callback
        in: query
        schema:
          type: string
        description: Callback function name for JSONP format
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PropertyTable'
            text/csv:
              schema:
                type: string
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
  /compound/cid/{cids}/synonyms/{format}:
    get:
      tags:
      - Compounds
      summary: Get compound synonyms
      description: Retrieve synonyms for the specified compounds
      parameters:
      - name: cids
        in: path
        required: true
        schema:
          type: string
        description: Comma-separated list of Compound IDs (CIDs)
        example: '2244'
      - name: format
        in: path
        required: true
        schema:
          type: string
          enum:
          - XML
          - JSON
          - JSONP
          - ASNT
          - ASNB
          - TXT
          default: JSON
        description: Output format
      - name: callback
        in: query
        schema:
          type: string
        description: Callback function name for JSONP format
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InformationList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
components:
  schemas:
    PropertyTable:
      type: object
      description: Table of compound properties
      properties:
        PropertyTable:
          type: object
          properties:
            Properties:
              type: array
              items:
                type: object
                properties:
                  CID:
                    type: integer
                  MolecularFormula:
                    type: string
                  MolecularWeight:
                    type: string
                  SMILES:
                    type: string
                  InChI:
                    type: string
                  InChIKey:
                    type: string
                  IUPACName:
                    type: string
                  XLogP:
                    type: number
                  ExactMass:
                    type: string
                  MonoisotopicMass:
                    type: string
                  TPSA:
                    type: number
                  Complexity:
                    type: integer
                  Charge:
                    type: integer
                  HBondDonorCount:
                    type: integer
                  HBondAcceptorCount:
                    type: integer
                  RotatableBondCount:
                    type: integer
                  HeavyAtomCount:
                    type: integer
    CompoundRecord:
      type: object
      description: A single compound record
      properties:
        id:
          type: object
          properties:
            id:
              type: object
              properties:
                cid:
                  type: integer
        atoms:
          type: object
        bonds:
          type: object
        stereo:
          type: array
          items:
            type: object
        props:
          type: array
          items:
            type: object
    InformationList:
      type: object
      description: List of information records
      properties:
        InformationList:
          type: object
          properties:
            Information:
              type: array
              items:
                type: object
                properties:
                  CID:
                    type: integer
                  SID:
                    type: integer
                  AID:
                    type: integer
                  Synonym:
                    type: array
                    items:
                      type: string
                  Title:
                    type: string
                  Description:
                    type: string
    CompoundRecords:
      type: object
      description: Collection of compound records
      properties:
        PC_Compounds:
          type: array
          items:
            $ref: '#/components/schemas/CompoundRecord'
    Fault:
      type: object
      description: Error response
      properties:
        Fault:
          type: object
          properties:
            Code:
              type: string
            Message:
              type: string
            Details:
              type: array
              items:
                type: string
  responses:
    ServiceUnavailable:
      description: Too many requests or server is busy, retry later
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Fault'
        application/xml:
          schema:
            $ref: '#/components/schemas/Fault'
        text/html:
          schema:
            type: string
    NotFound:
      description: The input record was not found (e.g. invalid CID)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Fault'
        application/xml:
          schema:
            $ref: '#/components/schemas/Fault'
    BadRequest:
      description: Request is improperly formed (syntax error in the URL, POST body, etc.)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Fault'
        application/xml:
          schema:
            $ref: '#/components/schemas/Fault'