> ## Documentation Index
> Fetch the complete documentation index at: https://vaquill.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# n8n and Make.com

> Pre-built n8n and Make.com templates that read statute queries from a Google Sheet, call the Vaquill statutes search API, and write matching sections back.

Automate batch statute lookups with a Google Sheet on one side and the Vaquill statutes search API on the other. This integration ships two pre-built templates - one for [n8n](https://n8n.io) (open-source, self-hostable) and one for [Make.com](https://make.com) (cloud, no-code) - that implement the same flow.

```
Google Sheet (queries) -> Vaquill statutes search API -> Google Sheet (matching sections)
```

Source: [github.com/Vaquill-AI/integrations/n8n](https://github.com/Vaquill-AI/integrations/tree/main/n8n).

## What you get

* **`n8n-workflow.json`** - drop into any n8n instance
* **`make-blueprint.json`** - drop into any Make.com scenario
* Trigger on new rows in a Google Sheet, write matching statute sections back automatically
* Automatic retry on 429 / 5xx, graceful stop on 402 (insufficient credits)
* Scope each query by jurisdiction (US Code, CFR, or any of the 50 state codes) by editing the request body
* Page through results for broad queries

### Use cases

* **Batch statute search** - drop 50 queries into a sheet, get matching US Code, CFR, and state sections in minutes
* **Automated lookup pipelines** - connect a form to Vaquill for instant statute citations
* **Regulatory monitoring** - schedule periodic queries against the monthly-refreshed statute corpus
* **Due-diligence checklists** - process compliance lookups in bulk
* **Client-intake triage** - route incoming statute questions through Vaquill, then forward results to your team

## Prerequisites

1. **Vaquill account** - sign up at [app.vaquill.ai](https://app.vaquill.ai)
2. **Vaquill API key** (`vq_key_...`) - generate in Settings > API Keys. See [Authentication](/docs/api-guide/authentication).
3. **Google account** - for Google Sheets access
4. **n8n instance** (cloud or self-hosted) **or** a **Make.com account**

## Google Sheet setup

Create a Google Sheet with these column headers in row 1:

| A     | B       | C         | D            | E      |
| ----- | ------- | --------- | ------------ | ------ |
| query | results | citations | jurisdiction | status |

Put your queries in column A. Leave B-E empty - the automation fills them in.

Example rows:

| query                                          | results               | citations | jurisdiction | status |
| ---------------------------------------------- | --------------------- | --------- | ------------ | ------ |
| civil action for deprivation of rights         | *(filled by Vaquill)* |           |              |        |
| motion to dismiss for failure to state a claim | *(filled by Vaquill)* |           |              |        |
| overtime exemption for executive employees     | *(filled by Vaquill)* |           |              |        |

## Vaquill API reference

```
POST https://api.vaquill.ai/api/v1/statutes/search
Authorization: Bearer vq_key_YOUR_API_KEY
Content-Type: application/json
```

Request body:

```json theme={"theme":"github-dark"}
{
  "query": "civil action for deprivation of rights",
  "jurisdiction": "us",
  "limit": 10
}
```

| Field          | Type    | Description                                                              |
| -------------- | ------- | ------------------------------------------------------------------------ |
| `query`        | string  | The statute search query                                                 |
| `jurisdiction` | string  | `"us"` for federal (US Code, CFR), or a state code (e.g. `"ca"`, `"ny"`) |
| `limit`        | integer | Maximum sections to return (page through larger result sets)             |

Successful response (200):

```json theme={"theme":"github-dark"}
{
  "data": {
    "results": [
      {
        "citation": "42 U.S.C. 1983",
        "title": "Civil action for deprivation of rights",
        "code": "United States Code"
      }
    ]
  },
  "meta": {
    "creditsUsed": 1,
    "creditsRemaining": 99
  }
}
```

Error responses:

| Status | Meaning              | What to do                                                              |
| ------ | -------------------- | ----------------------------------------------------------------------- |
| 401    | Invalid API key      | Check the key starts with `vq_key_` and the `Bearer ` prefix is present |
| 402    | Insufficient credits | Top up at [app.vaquill.ai/billing](https://app.vaquill.ai/billing)      |
| 429    | Rate limit exceeded  | Wait and retry (the templates handle this automatically)                |

See the [Errors reference](/docs/api-guide/errors) for the full list.

## Option 1: n8n

### Quickstart

<Steps>
  <Step title="Import the workflow">
    1. Open your n8n instance (cloud or self-hosted)
    2. Go to **Workflows > Add Workflow**
    3. Click the three-dot menu (top right) > **Import from File**
    4. Upload `n8n-workflow.json` from the repo
  </Step>

  <Step title="Add the Google Sheets credential">
    1. Click the **New Query Added** node
    2. Under **Credential to connect with**, click **Create New Credential**
    3. Select **Google Sheets OAuth2 API**
    4. Complete the OAuth flow and save
  </Step>

  <Step title="Add the Vaquill API key credential">
    1. Click the **Vaquill Statutes Search** node
    2. Under **Credential to connect with**, click **Create New Credential**
    3. Select **Header Auth**
    4. Set:
       * **Name**: `Authorization`
       * **Value**: `Bearer vq_key_YOUR_ACTUAL_KEY`
    5. Save
  </Step>

  <Step title="Point at your sheet">
    On the **New Query Added**, **Write Answer to Sheet**, and **Write Error to Sheet** nodes, select your spreadsheet and sheet (e.g. `Sheet1`) from the dropdowns.
  </Step>

  <Step title="Test and activate">
    1. Add a test query to column A of your sheet
    2. Click **Test Workflow**
    3. Verify the matching sections appear in column B
    4. Toggle the workflow to **Active** for automatic processing
  </Step>
</Steps>

### Workflow shape

```
[New Query Added] -> [Filter Unanswered] -> [Vaquill Statutes Search] -> [Extract Response] -> [Write Results]
                                                     |
                                                 (on error)
                                                     |
                                            [Insufficient Credits?]
                                              /              \
                                        (yes: 402)       (other error)
                                             |                |
                                     [Stop Workflow]   [Write Error to Sheet]
```

| Node                        | Purpose                                                               |
| --------------------------- | --------------------------------------------------------------------- |
| **New Query Added**         | Triggers on new rows in the Google Sheet                              |
| **Filter Unanswered**       | Skips rows that already have an answer                                |
| **Vaquill Statutes Search** | Calls `/statutes/search`; retries automatically on 429 / 5xx          |
| **Extract Response Fields** | Pulls `results`, `citation`, `code` from the JSON response            |
| **Write Answer to Sheet**   | Updates the original row with results                                 |
| **Insufficient Credits?**   | On 402, stops the workflow; on other errors, marks the row as `error` |

## Option 2: Make.com

### Quickstart

<Steps>
  <Step title="Import the blueprint">
    1. Log in to [make.com](https://www.make.com)
    2. Click **Create a new scenario**
    3. Click the three-dot menu > **Import Blueprint**
    4. Upload `make-blueprint.json`
    5. Click **Save**
  </Step>

  <Step title="Connect Google Sheets">
    1. Click the first module (**Read Questions**)
    2. Click **Add** next to **Connection**
    3. Sign in with Google and grant permissions
    4. Select your spreadsheet and sheet, and set **Table Contains Headers** to **Yes**
  </Step>

  <Step title="Add your Vaquill API key">
    1. Click the second module (**Call Vaquill statutes search API**)
    2. Find the **Authorization** header
    3. Replace `YOUR_VAQUILL_API_KEY` with your actual key:

       ```
       Bearer vq_key_abc123...
       ```
  </Step>

  <Step title="Wire the writer">
    1. Click the third module (**Write Results Back**)
    2. Verify the Google Sheets connection and select the same spreadsheet / sheet
    3. The response mapping is pre-configured:
       * Column B (results): joined section titles
       * Column C (citations): joined citations
       * Column D (jurisdiction): `{{2.data.jurisdiction}}`
       * Column E (status): `processed`
  </Step>

  <Step title="Test and schedule">
    1. Click **Run once** to test
    2. Check the sheet for results
    3. Click **Schedule** to enable automatic runs (e.g. every 15 minutes)
  </Step>
</Steps>

## Configuration

### Scope by jurisdiction

Change the request body `jurisdiction` field to target a specific code: `"us"` covers federal sources (the US Code and the CFR), and any state code (e.g. `"ca"`, `"ny"`, `"tx"`) restricts the search to that state's statutes. The corpus spans all 50 states, the US Code (54,855 sections across 53 titles), and the CFR (218,932 sections across 49 titles).

### Page through large result sets

For broad queries, raise the `limit` field and page through results:

```json theme={"theme":"github-dark"}
{
  "query": "overtime exemption for executive employees",
  "jurisdiction": "us",
  "limit": 25,
  "offset": 0
}
```

Increase `offset` in steps of `limit` to fetch subsequent pages.

### Rate-limit handling

* **n8n** - the template retries automatically on 429 and 5xx (up to 2 retries with 5-second intervals)
* **Make.com** - add a **Sleep** module (e.g. 2 seconds) between iterations for large batches, or enable the built-in error handler with retry

### Extending the workflow

Both templates compose with the rest of n8n / Make.com:

```
Google Sheets -> Vaquill statutes search -> Write Results
                                    |
                                    +-> Slack notification
                                    +-> Email summary
                                    +-> Airtable record
                                    +-> Webhook to your app
```

## Deployment

### n8n self-hosted vs n8n Cloud

| Option                       | Best for                                                                                        |
| ---------------------------- | ----------------------------------------------------------------------------------------------- |
| **n8n self-hosted** (Docker) | Teams that want full data control and unlimited workflow runs. Free, but you operate the infra. |
| **n8n Cloud**                | Teams that want zero-ops and a managed UI. Paid plans starting around \$20 USD/month.           |

Either way, the same `n8n-workflow.json` import works.

### Make.com tiers

Make.com is cloud-only. The free tier covers \~1,000 operations per month, which is enough for small batches. Paid plans scale up. Make.com counts each HTTP module call and each sheet row read / written, so a single Vaquill search typically consumes 3 operations (read row, call API, write row).

<Tip>
  For large nightly batches, n8n is usually more economical because pricing is per workflow execution, not per node operation.
</Tip>

## Troubleshooting

| Problem                  | Cause                           | Fix                                                                        |
| ------------------------ | ------------------------------- | -------------------------------------------------------------------------- |
| 401 Unauthorized         | Invalid or missing API key      | Verify the key starts with `vq_key_` and the `Bearer ` prefix is included  |
| 402 Payment Required     | No credits remaining            | Top up at [app.vaquill.ai/billing](https://app.vaquill.ai/billing)         |
| 429 Too Many Requests    | Rate limit hit                  | Add delays between requests; the n8n template retries automatically        |
| Empty results            | Query too vague or out of scope | Rephrase; check that `jurisdiction` is set correctly                       |
| Google Sheets auth error | OAuth token expired             | Re-authenticate the Google Sheets connection                               |
| Workflow not triggering  | Trigger not activated           | In n8n, toggle the workflow to **Active**; in Make.com, click **Schedule** |

## Related

<CardGroup cols={2}>
  <Card title="Statutes Search API" icon="magnifying-glass" href="/docs/api-reference/statutes/search-us-statutes">
    The endpoint these templates call.
  </Card>

  <Card title="Authentication" icon="key" href="/docs/api-guide/authentication">
    Generate and rotate API keys.
  </Card>

  <Card title="GitHub" icon="github" href="https://github.com/Vaquill-AI/integrations/tree/main/n8n">
    Template JSON files and issue tracker.
  </Card>
</CardGroup>
