Menu
On this page

API quickstart

8 min read

Create an API key, authenticate, call POST /v1/tools/{name} and handle the error codes, with working examples in cURL, Python, JavaScript and C#.

What you will get

A live API key and a working call to lookup_company from cURL, Python, JavaScript and C#, against the production host.

Before you start

  • An account with a confirmed email and accepted Terms. Keys do not work before both steps.

  • Access to API keys in the panel.

  • A terminal with curl, Python 3, Node.js 18 or later, or the .NET SDK, depending on the example you want to run.

  • A secret manager or an environment variable to store the key. The full token is shown once.

The endpoint

ItemValue
Base URLhttps://api.verygov.com
Tool callPOST /v1/tools/{name}
BodyJSON object with the input of the tool
AuthenticationAuthorization: Bearer YOUR_API_KEY (or X-Api-Key: YOUR_API_KEY)
Content typeapplication/json
ResponseJSON envelope with status, code, credits_charged, sources, data, warnings and summary

The same tools and the same schema are exposed by the remote MCP server at https://api.verygov.com/mcp.

Steps

1. Create an API key

  1. In the panel, open API keys.

  2. In Create a key, type a Name such as Production.

  3. Choose the Mode:

    • Live: real data, spends credits.

    • Test: fixed sample answers, never spends credits.

  4. Select Create key.

  5. Copy the token now. It starts with vgov_live_ or vgov_test_. The full token is shown only once; afterwards the list shows vgov_live_… and the last four characters.

The API keys page of the panel, with the name field, the live or test mode and the Create key button.
Open full-size screenshotScreenshot in English.

An account can keep 10 active keys. Use one key per environment and revoke the ones you no longer need.

2. Store the key

Put the token in an environment variable, not in the source code:

[bash]
export VERYGOV_API_KEY="vgov_live_…"

3. Run the first call with cURL

[bash]
curl -X POST "https://api.verygov.com/v1/tools/lookup_company" \
  -H "Authorization: Bearer $VERYGOV_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: lookup-otis-1" \
  -d '{"name":"OTIS WORLDWIDE CORPORATION","state":"CT"}'

4. Run the same call with Python

The example uses only the standard library, so it runs on any Python 3 installation.

[python]
import json
import os
import urllib.error
import urllib.request

api_key = os.environ["VERYGOV_API_KEY"]
payload = json.dumps({"name": "OTIS WORLDWIDE CORPORATION", "state": "CT"}).encode()

request = urllib.request.Request(
    "https://api.verygov.com/v1/tools/lookup_company",
    data=payload,
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
        "Idempotency-Key": "lookup-otis-1",
    },
    method="POST",
)

try:
    with urllib.request.urlopen(request) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    body = json.load(error)
    print("HTTP", error.code, body.get("code"), body.get("message"))
    print(json.dumps(body, indent=2)[:800])
    raise SystemExit(1)

print(result["status"], result["code"], result["credits_charged"])
print(result["summary"])

5. Run the same call with JavaScript

The example targets Node.js 18 or later, where fetch is built in. Do not put a live key in browser code: call the API from a server you control.

[javascript]
const apiKey = process.env.VERYGOV_API_KEY;

async function lookupCompany() {
  const response = await fetch("https://api.verygov.com/v1/tools/lookup_company", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${apiKey}`,
      "Content-Type": "application/json",
      "Idempotency-Key": "lookup-otis-1",
    },
    body: JSON.stringify({ name: "OTIS WORLDWIDE CORPORATION", state: "CT" }),
  });

  const result = await response.json();

  if (!response.ok) {
    console.error(result.code, result.message);
    return;
  }

  console.log(result.status, result.code, result.credits_charged);
  console.log(result.summary);
}

lookupCompany();

6. Run the same call with C#

The example targets .NET 6 or later and uses the SDK only.

[csharp]
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json;

var apiKey = Environment.GetEnvironmentVariable("VERYGOV_API_KEY")
    ?? throw new InvalidOperationException("Set VERYGOV_API_KEY.");

using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);
http.DefaultRequestHeaders.Add("Idempotency-Key", "lookup-otis-1");

var body = new { name = "OTIS WORLDWIDE CORPORATION", state = "CT" };

using var response = await http.PostAsJsonAsync(
    "https://api.verygov.com/v1/tools/lookup_company", body);

var raw = await response.Content.ReadAsStringAsync();

if (!response.IsSuccessStatusCode)
{
    Console.Error.WriteLine(raw);
    return;
}

using var json = JsonDocument.Parse(raw);
var root = json.RootElement;
Console.WriteLine($"{root.GetProperty("status")} {root.GetProperty("code")} {root.GetProperty("credits_charged")}");
Console.WriteLine(root.GetProperty("summary").GetString());

7. Read the answer

The four examples send the same request. The abbreviated response below is real:

[json]
{
  "request_id": "20f4de0cec194b108b045c8f517ac718",
  "tool": "lookup_company",
  "status": "complete",
  "code": "OK",
  "credits_charged": 3,
  "cache_hit": true,
  "data": {
    "company": {
      "legal_name": "Otis Worldwide Corp",
      "jurisdiction": "US-DE",
      "identifiers": {
        "cik": "0001781335",
        "lei": "549300ZLBKR8VSU25153",
        "ticker": "OTIS"
      }
    },
    "coverage": {
      "checked_states": ["CT"]
    }
  },
  "summary": "Company found: Otis Worldwide Corp."
}

cache_hit: true and credits_charged: 3 mean that the answer came from the 24-hour cache, at the cached price. A first live call costs 5 credits.

The four examples intentionally reuse the lookup-otis-1 idempotency key. To check a different company, generate a new key; reuse the original only when retrying the same operation.

status describes the whole answer (complete, partial, ambiguous, failed). code is the stable result code (OK, NO_RECORDS, AMBIGUOUS_ENTITY, PARTIAL_RESULT, SOURCE_UNAVAILABLE, NOT_SEC_REGISTRANT, NO_MATCHES_ABOVE_THRESHOLD, STALE_DATA). Each entry of sources carries the source id, its status, the latency and the official URL.

Error codes

HTTPCodeMeaningWhat to do
400INVALID_INPUTThe body does not match the schemaRead message and field; fix the value
400QUERY_TOO_SHORTThe name has fewer than 2 searchable characters after normalizationSend the legal company name
400PERSONAL_DATA_NOT_SUPPORTEDThe body looks like it contains a Social Security numberVeryGov checks companies only
401INVALID_API_KEYThe key is unknown, revoked, disabled, or the account is not readyConfirm the email and the Terms; create a new key
402INSUFFICIENT_CREDITSThe balance does not cover the reserved maximumBuy credits or use a cheaper tool
404UNKNOWN_TOOLThe tool name does not existUse one of the names in the catalog
429RATE_LIMITEDThe per-account limit was reachedWait for the seconds in Retry-After
503SOURCE_UNAVAILABLEEvery source of the tool is downRetry later; no credits are charged

Validation and authentication errors include code, message and, when applicable, field. A total source outage can return HTTP 503 with a tool envelope: inspect status, code, warnings and sources; that response has no message field. The request id travels in the X-Request-Id response header. Include it when you write to support.

Limits, caching and idempotency

  • Rate limit: 10 requests per minute per account on the free plan, 60 after a purchase. A rate-limited call costs 0 credits.

  • Cache: a repeat of the same query within 24 hours costs the cached price. Send fresh: true to force a live query at full price.

  • Idempotency: send Idempotency-Key: <unique value> to make a retry safe. A repeat of the same key within 24 hours returns the stored answer and does not charge again. The stored body keeps the credits_charged value of the original call.

  • Test keys: vgov_test_ keys return fixed sample answers and never spend credits. Use them in CI.

  • Language: for REST, use ?lang=es in the URL or send Accept-Language: es. If neither is provided, the account language applies, then English. For MCP, pass the lang tool argument. JSON field names and official data stay in English as published.

The six core tools

ToolCredits, fullCredits, cachedUse it for
lookup_company53Identity, status, identifiers
screen_company_risk53Sanctions, export controls, exclusions, recalls
get_company_financials32SEC revenue, income, assets, filings
search_federal_contracts32Federal awards
verify_us_address11US address against Census ranges
verify_us_company2513Full report with every block

The catalog also exposes check_counterparty_signals and search_adverse_media at 3 credits each.

Expected result

A 200 answer with "code": "OK", a company object with its identifiers, and one entry in sources for each official source. The credits charged appear in the body and in Usage history.

Common problems

SymptomCauseFix
401 INVALID_API_KEYThe header is missing, the key was revoked, or the account is not readySend Authorization: Bearer …; confirm the email and the Terms
402 INSUFFICIENT_CREDITSThe balance is below the reserved maximum of the toolBuy credits or call a cheaper tool
400 QUERY_TOO_SHORTThe name has fewer than 2 searchable charactersSend the full legal name
429 RATE_LIMITEDMore than 10 or 60 requests in a minuteWait for Retry-After and retry
404 UNKNOWN_TOOLA typo in the pathUse /v1/tools/lookup_company, with the underscore
The response is ambiguous and costs 0The name matches several companiesAdd the state or an identifier accepted by the tool (see its schema)
curl returns Could not resolve hostThe host is misspelledUse https://api.verygov.com

Next step

Continue with MCP setup to connect the same tools to Claude Desktop, Claude Code or Cursor.

Need help?

Write to contacto@verygov.com and include the request id of the report.

API quickstart | VeryGov