Fieldnote Docs
Getting startedInstall the SDK

Install the SDK

The JavaScript SDK lets your app send notes to Fieldnote and read back the links it suggests. Setup takes three steps.

Requirements

Install

  1. Add the package

    terminal
    $ npm install @fieldnote/sdk
  2. Create an API key

    Open Settings → API keys in the app and create a key. Store it in an environment variable named FIELDNOTE_KEY.

  3. Send your first note

    suggest.js
    import { Fieldnote } from "@fieldnote/sdk";
    
    const fn = new Fieldnote({ key: process.env.FIELDNOTE_KEY });
    
    const note = await fn.notes.create({
      title: "Call with Priya",
      body: "She wants the pricing draft before Friday.",
    });
    
    // Suggestions are ready within a second of creating the note
    const links = await fn.links.suggest(note.id);
    console.log(links.map((l) => l.title)); // [ "Pricing draft", "Priya Nair" ]
Server only

Do not ship the API key to a browser. Call the SDK from your server, or create short-lived tokens with fn.tokens.create().

Options

All options are passed to the Fieldnote constructor.

OptionTypeDefaultWhat it does
keystringnoneYour API key. Required.
region"us" | "eu""us"Where requests are sent. Match the region of your workspace.
timeoutnumber10000Milliseconds before a request is cancelled.
retriesnumber2Retries for network errors and 5xx responses.

Troubleshooting

401 Unauthorized

The key is missing or was revoked. Check that FIELDNOTE_KEY is set in the process that runs the SDK, not only in your shell.

Suggestions come back empty

A new workspace needs about 20 notes before suggestions start. Import existing notes first, see Import notes.