Getting started

Quickstart Guide

Welcome! In this guide, we'll walk you through the basics of using the Lemma API. You'll learn how to make your first request and verify citations.

1

Create an Account

First, you'll need to create an account to access the Lemma API. Follow these steps:

  • Sign up for an account
  • Verify your email address
  • Log in to your account

Once you have all this setup, you can continue to step 2.

New users receive $5 in free credits to get started. This is enough for approximately 1,000 search requests.

2

Generate an API Key

Create an API key via the Lemma Dashboard.

After generating an API key, you need to save it somewhere safe! We recommend you export it as an environment variable in your terminal or save it to a .env file.

Bash
export LEMMA_API_KEY="your_api_key"
3

Make Your First Request

With your API key exported as an environment variable, you're ready to make your first API request. Let's test out the Search API using curl.

Paste the following directly into your terminal:

Bash
curl https://api.lemma.la/v1/search \
    -H "Content-Type: application/json" \
    -H "x-api-key: $LEMMA_API_KEY" \
    -d '{
      "question": "aspirin side effects"
    }'

You should receive a response with FDA drug label segments related to aspirin side effects:

JSON Response
{
  "question": "aspirin side effects",
  "results": [
    {
      "text": "Stop use and ask a doctor if pain gets worse...",
      "fingerprint": "11110011110101100001010001100111...",
      "drug": {
        "name": "aspirin",
        "manufacturer": "P & L Development, LLC"
      },
      "section": "Warnings",
      "source": {
        "url": "https://dailymed.nlm.nih.gov/dailymed/..."
      }
    }
  ],
  "metadata": {
    "count": 5,
    "search_time_ms": 234.5
  }
}
4

Verify a Citation

One of Lemma's key features is cryptographic verification. You can verify any citation using its 128-bit fingerprint - even months or years later.

Take the fingerprint from the previous response and verify it:

Bash
curl https://api.lemma.la/v1/verify/11110011110101100001010001100111...

If the fingerprint is valid, you'll receive verification:

JSON Response
{
  "verified": true,
  "text": "Stop use and ask a doctor if pain gets worse...",
  "source": {
    "url": "https://dailymed.nlm.nih.gov/dailymed/..."
  },
  "message": null
}

This cryptographic proof can be used in legal proceedings, compliance reports, or research papers to verify the authenticity of citations.

5

Enable Reasoning for Complex Queries

For questions that require understanding relationships between drugs and conditions, use the Reasoning API. It performs multi-hop reasoning over FDA data to answer complex questions with structured results and complete evidence chains.

Bash
curl https://api.lemma.la/v1/graph \
                -H "Content-Type: application/json" \
                -H "x-api-key: $LEMMA_API_KEY" \
                -d '{
                  "question": "Which drugs cause liver damage?"
                }'

The Reasoning API returns structured drug-condition relationships with severity levels, relationship types (warning, contraindication, adverse reaction), and complete FDA evidence for each finding. Each piece of evidence includes fingerprints for verification.

Next Steps