1.0.0 • Public • Published

    govinfo-link-js Node.js and Web browser API

    democracy-ia mascot

    Apache License FOSSA Status NPM version
    NSP Status Dependency Status Development Dependency Status
    MacOS and Ubuntu build statuses Windows build status Coverage percentage Codacy code quality

    Node.js and Web browser API Access U.S. Government Publishing Office's FDsys (Federal Digital System) content and metadata collections using the govinfo-link-js client for Node.js and Web browsers.

    Table of contents

    1. Install

    1.1. For Node.js environments

    light-bulb Download and install Node.js link-external (and its package manager, npm), if you don't have them, already.

    1.1.1. Using npm

    To publish the library as a npm link-external, please follow the procedure in "Publishing npm packages link-external."

    Then install it via:

    npm install govinfo-link-js --save

    1.1.2. Using git

    If the library is hosted at a git repository, e.g. then install it via:

    npm install democracy-ia/govinfo-link-js --save

    code Designers and developers: additional installation instructions

    To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

    npm install

    Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

    npm link

    Finally, switch to the directory you want to use your govinfo-link-js from, and run:

    npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

    You should now be able to require('govinfo-link-js') in javascript files from the directory you ran the last command above from.

    1.2. For browsers

    The library also works in the browser environment via npm and browserify link-external. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file, that's to say your javascript file where you actually use this library):

    browserify main.js > bundle.js

    Then include bundle.js in the HTML pages.

    1.3. Webpack configuration

    Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

    module: {
      rules: [
          parser: {
            amd: false

    2. Usage

    light-bulb View all govinfo-link-js API references (with usage examples).

    const { CodeOfFederalRegulations } = require('govinfo-link-js')
    const api = new CodeOfFederalRegulations()
    // {Number} Title number
    const titlenum = 3
    // {String} Part number.
    const partnum = '100'
    const opts = {
       * @prop {String} sectionnum - This is the section number. Sample value is 1.
       *    If section number is not provided the entire part will be returned.
      sectionnum: null,
       * @prop {String} year - This is the four digit numerical year OR mostrecent.
       *    If year is not provided, the most recent version of the CFR section
       *    or part is returned. Default is most recent.
      year: '2011',
       * @prop {string=pdf} [linkType] - This is the format of the returned
       *    document. Default is pdf. Other values are xml, mods, premis,
       *    details, context, related.
      linkType: 'xml'
    api.cfrFetchUsingGET(titlenum, partnum, opts, (error, data) => {
      if (error) {
      } else {
        console.log(`✅  Returned data: ${api.toJson(data)}`)

    3. API

    The link service is used to create embedded links to content and metadata on govinfo and is currently enabled for the collections below. More information about each query, including examples, is provided on each collection page.

    3.1. Models

    1. API reference CodeOfFederalRegulations: Code of Federal Regulations
    2. API reference CompilationOfPresidentialDocuments: Compilation of Presidential Documents
    3. API reference CongressionalBills: Congressional Bills
    4. API reference CongressionalCalendars: Congressional Calendars
    5. API reference CongressionalCommitteePrints: Congressional Committee Prints
    6. API reference CongressionalDocuments: Congressional Documents
    7. API reference CongressionalHearings: Congressional Hearings
    8. API reference CongressionalRecordDaily: Congressional Record Daily
    9. API reference CongressionalReports: Congressional Reports
    10. API reference FederalRegister: Federal Register
    11. API reference PublicAndPrivateLaws: Public and Private Laws
    12. API reference StatutesAtLarge: Statutes at Large
    13. API reference UnitedStatesCode: United States Code

    3.2. Endpoints

    info All HTTP request URIs are relative to

    Class Method HTTP request
    govinfo. CodeOfFederalRegulations cfrFetchUsingGET GET /cfr/{titlenum}/{partnum}

    Parameters: title number, part number, section number, year OR most recent
    govinfo. CompilationOfPresidentialDocuments cpdDcpdFetchUsingGET GET /cpd/{year}

    Parameters: dcpd type OR dcpd number
    govinfo. CompilationOfPresidentialDocuments cpdFetchUsingGET GET /cpd/{doctype}/{docnum}

    Parameters: document type, document number
    govinfo. CongressionalBills billsFetchUsingGET GET /bills/{congress}/{billtype}/{billnum}

    Parameters: bill number, bill type, congress, bill version OR most recent
    govinfo. CongressionalCalendars ccalFetchUsingGET GET /ccal/{chamber}/{section}

    Parameters: chamber, section, publish date OR most recent
    govinfo. CongressionalCommitteePrints cprtHouseFetchUsingGET GET /cprt/{congress}/house/{printnum}/{committee}

    Parameters: congress, chamber, house print number, committee
    govinfo. CongressionalCommitteePrints cprtJacketFetchUsingGET GET /cprt/{congress}/{jacketid}

    Parameters: congress, jacket number
    govinfo. CongressionalCommitteePrints cprtSenateFetchUsingGET GET /cprt/{congress}/senate/{printnum}

    Parameters: congress, chamber, senate print number
    govinfo. CongressionalDocuments cdocFetchUsingGET GET /cdoc/{congress}/{doctype}/{docnum}

    Parameters: congress, document type, document number
    govinfo. CongressionalDocuments cdocJacketFetchUsingGET GET /cdoc/{congress}/{jacketid}

    Parameters: congress, jacket number
    govinfo. CongressionalHearings chrgHouseFetchUsingGET GET /chrg/{congress}/house/{committee}/{serialnumber}

    Parameters: congress, chamber, committee, house serial number
    govinfo. CongressionalHearings chrgJacketFetchUsingGET GET /chrg/{congress}/{jacketid}

    Parameters: congress, jacket number
    govinfo. CongressionalHearings chrgSenateFetchUsingGET GET /chrg/{congress}/senate/{hearingnumber}

    Parameters: congress, chamber, senate hearing number
    govinfo. CongressionalRecordDaily crecSectionFetchUsingGET GET /crec/section/{section}

    Parameters: section, publish date OR most recent
    govinfo. CongressionalRecordDaily crecTypeFetchUsingGET GET /crec/cas/{congress}/{billtype}/{billnum}

    Parameters: congress, bill number, bill type
    govinfo. CongressionalRecordDaily crecTypeFetchUsingGET1 GET /crec/type/{type}

    Parameters: document type, publish date OR most recent
    govinfo. CongressionalRecordDaily crecVolumeFetchUsingGET GET /crec/{volume}/{pageprefix}/{page}

    Parameters: volume, page prefix, page number
    govinfo. CongressionalReports crptBillFetchUsingGET GET /crpt/{congress}/{associatedbillnum}

    Parameters: associated bill, congress
    govinfo. CongressionalReports crptReportFetchUsingGET GET /crpt/{congress}/{doctype}/{reportnum}

    Parameters: congress, report type, report number
    govinfo. FederalRegister frDocFetchUsingGET GET /fr/{frdocnum}

    Parameters: Federal Register document number
    govinfo. FederalRegister frVolumeFetchUsingGET GET /fr/{volume}/{page}

    Parameters: volume, page number
    govinfo. PublicAndPrivateLaws plawBillFetchUsingGET GET /plaw/{congress}/{associatedbillnum}

    Parameters: associated bill number, congress
    govinfo. PublicAndPrivateLaws plawStatuteFetchUsingGET GET /plaw/{statutecitation}

    Parameters: Statutes at Large citation
    govinfo. PublicAndPrivateLaws plawTypeFetchUsingGET GET /plaw/{congress}/{lawtype}/{lawnum}

    Parameters: congress, law type, law number
    govinfo. StatutesAtLarge statuteTypeFetchUsingGET GET /statute/{congress}/{lawtype}/{lawnum}

    Parameters: congress, law type, law number
    govinfo. StatutesAtLarge statuteVolumeFetchUsingGET GET /statute/{volume}/{page}

    Parameters: volume, page number
    govinfo. UnitedStatesCode uscodeFetchUsingGET GET /uscode/{title}/{section}

    Parameters: title number, type, section, year OR most recent

    4. Contribute

    PRs Welcome We welcome contributions with GitHub issues and pull requests.

    Request a feature Report a defect

    Read the CONTRIBUTING guidelines

    Contributions in the form of GitHub pull requests are welcome. Before embarking on a significant change, please adhere to the following guidelines:

    1. Create an issue—e.g., a defect ("bug") report or a feature request—to propose changes.


      If you're working on documentation and fixing something simple like a typo or an easy bug, go ahead and make a pull request.

    2. Follow the CONTRIBUTING guidelines.


      Standards and guidelines make communication easier. If you're willing and able to program—or want to learn how— following the guidelines will increase the likelihood of adding your changes to the software product.

    3. Read the Code of Conduct.


      It's more fun when everybody's friendly and respectful.

    4. Make a pull request link-external when you're ready for other to review your changes (or you get stuck somewhere).

      PR novices:

      🙋 Never created a pull request? No problem. 🆓 Take this free online training link-external. (It even covers most of the conventions in the CONTRIBUTING guidelines!)

    5. License

    Apache 2.0

    FOSSA Status


    npm i govinfo-link-js

    DownloadsWeekly Downloads






    Unpacked Size

    391 kB

    Total Files


    Last publish


    • gregswindle