# GovFiles — Getting started for agents & developers

GovFiles gives you the complete US business-entity dataset (100M+ filings covering approximately 85M businesses from authoritative government company registries across all 50 states) over a simple REST API. This guide shows an LLM agent or developer how to create an account, get an API key, and make a first request — entirely over HTTP. There is no separate API to integrate: the same backend that powers govfiles.dev issues keys and serves data.

Prefer a UI? A human can do all of this in under a minute at https://govfiles.dev (click **Get API key**), including **Continue with Google**. The steps below are the programmatic equivalent.

## What you'll need

- An email inbox you can read — account creation sends a 6-digit code.
- An HTTP client that keeps cookies between requests (for example, curl with a cookie jar). The sign-up endpoints set a short-lived session cookie; the key-creation endpoint needs it.

The free tier includes 1,000 free credits with no card required, so you can complete this whole flow and run real queries for free.

## 1. Request a sign-in code

```
curl -sX POST https://govfiles.dev/api/auth/otp/request \
  -H "Content-Type: application/json" \
  -d '{"email":"you@company.com"}'
```

GovFiles emails a 6-digit code to that address. The response is identical whether or not an account already exists, so this same call works for both signing up and signing in.

## 2. Verify the code and start a session

Read the code from the email, then exchange it for a session. Save the cookies to a file:

```
curl -sX POST https://govfiles.dev/api/auth/otp/verify \
  -H "Content-Type: application/json" \
  -c govfiles-session.txt \
  -d '{"email":"you@company.com","code":"123456"}'
```

On success this sets your session cookie (stored in `govfiles-session.txt`) and returns your user record. A brand-new account has `"account_just_created": true`.

## 3. Complete your profile

```
curl -sX PATCH https://govfiles.dev/api/me \
  -H "Content-Type: application/json" \
  -b govfiles-session.txt \
  -d '{"name":"Ada Lovelace","company":"Acme Risk","use_case":"KYB & entity verification"}'
```

## 4. Create an API key

```
curl -sX POST https://govfiles.dev/api/keys \
  -H "Content-Type: application/json" \
  -b govfiles-session.txt \
  -d '{"name":"agent key"}'
```

The response contains your secret key:

```
{ "id": 1, "name": "agent key", "key": "gf_live_...", ... }
```

Store the `key` value somewhere safe — the full secret is shown only once. You can create, roll, or revoke keys any time at https://govfiles.dev/dashboard/.

## 5. Make your first request

Authenticate to the data API with the `X-API-Key` header:

```
curl -sX POST https://api.govfiles.dev/v2/companies/search \
  -H "X-API-Key: gf_live_..." \
  -H "Content-Type: application/json" \
  -d '{"q":"acme","jurisdictions":"all","limit":10}'
```

The response contains `results`, with a company record in each result’s `company` and a `match` block describing the match. To fetch another page, send the same search parameters with `page` set to `summary.next_page`. Stop when `summary.next_page` is `null`.

To retrieve one company directly, use its `company.jurisdiction_code` and `company.entity_number` in the lookup path:

```bash
curl -s 'https://api.govfiles.dev/v2/companies/us_ny/5084148' \
  -H "X-API-Key: gf_live_..."
```

This example looks up F & M INDUSTRIE CORP. in New York. The lookup returns the company object directly, without the search results wrapper.

See the live [search reference](https://docs.govfiles.dev/api-reference/endpoints/searchcompanies), [company lookup reference](https://docs.govfiles.dev/api-reference/endpoints/getcompany), and [OpenAPI contract](https://docs.govfiles.dev/openapi.json).

## Managing keys & credits

These account-management endpoints use your session cookie (from step 2). The data API at `api.govfiles.dev` uses the `X-API-Key` header. You can also manage keys and billing in https://govfiles.dev/dashboard/.

### Roll an API key

Rolling revokes the old secret and issues a new one with the same name — use it if a key may have leaked. List your keys with `GET /api/keys` to find the `id`, then:

```
curl -sX POST https://govfiles.dev/api/keys/123/roll \
  -b govfiles-session.txt
```

The response contains the new `gf_live_...` secret (shown once). The old key stops working immediately.

### Check your credit balance

```
curl -s https://govfiles.dev/api/billing/balance \
  -b govfiles-session.txt
```

Returns your current `balance`, `purchased_total`, and `used_this_cycle`. Manage billing at https://govfiles.dev/dashboard/.

### Add credits (Stripe checkout)

Here's how to get a Stripe checkout link to go buy credits. Pass the number of credits to buy:

```
curl -sX POST https://govfiles.dev/api/billing/checkout \
  -H "Content-Type: application/json" \
  -b govfiles-session.txt \
  -d '{"credits":100000}'
```

The response is a Stripe checkout URL:

```
{ "url": "https://checkout.stripe.com/..." }
```

Open that URL (or give it to your operator) to complete payment. Once Stripe confirms, the credits land on your balance — re-check it with `GET /api/billing/balance`.

`POST /api/billing/portal` works the same way (POST with the session cookie, returning a `url`) and returns a link to manage billing and payment methods. Manage billing at https://govfiles.dev/dashboard/.

## Next steps

- Documentation index for agents: https://docs.govfiles.dev/llms.txt
- Live API contract: https://docs.govfiles.dev/openapi.json
- Full data API reference: https://docs.govfiles.dev
- Pricing & credits: searches bill 1 credit per row returned; direct entity lookups bill 1 credit. You get 1,000 free credits.
- Bulk datasets & warehouse shares (Parquet via S3/SFTP; Snowflake, BigQuery, Databricks): book a call at https://cal.com/alex-1/30min
