API reference
Federal contracts
POST /federal/contracts looks up a company in USAspending.gov by UEI or name: federal obligations over 12 months, top agencies and NAICS codes, latest contracts.
https://api.qelka.com/v1/federal/contractsLook up the US federal awards of a company in USAspending.gov, the official source of federal spending data: who the recipient is, its corporate parent, what it received over the last 12 months, from which agencies, in which industries, and its latest contracts. Each lookup costs 1 credit when a recipient is found; lookups that find nothing, errors and test keys are never billed.
Request
Send the SAM.gov Unique Entity ID (UEI) of the company, or its name. A UEI finds that exact entity; a name finds the recipient with the most obligations among those whose name matches, and lists the next ones.
ueistringnamestringfreshbooleanDefault falsetrue skips the 24-hour result cache and asks USAspending.gov again.Send exactly one of uei and name: a body with both, or with neither, is a 400 invalid_request.
A lookup makes up to five requests to USAspending.gov in two rounds, each with a 12-second limit, so every snippet sets a 60-second client timeout.
curl https://api.qelka.com/v1/federal/contracts \
--max-time 60 \
-H "Authorization: Bearer $QELKA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Lockheed Martin"}'
const response = await fetch('https://api.qelka.com/v1/federal/contracts', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.QELKA_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ name: 'Lockheed Martin' }),
signal: AbortSignal.timeout(60_000),
})
const result = await response.json()
console.log(result)
import os
import requests
api_key = os.environ["QELKA_API_KEY"]
response = requests.post(
"https://api.qelka.com/v1/federal/contracts",
headers={"Authorization": f"Bearer {api_key}"},
json={"name": "Lockheed Martin"},
timeout=60,
)
result = response.json()
print(result)
<?php
$ch = curl_init('https://api.qelka.com/v1/federal/contracts');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('QELKA_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(['name' => 'Lockheed Martin']),
CURLOPT_TIMEOUT => 60,
]);
$result = json_decode(curl_exec($ch), true);
print_r($result);
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
"time"
)
func main() {
payload, _ := json.Marshal(map[string]any{"name": "Lockheed Martin"})
request, _ := http.NewRequest(http.MethodPost, "https://api.qelka.com/v1/federal/contracts", bytes.NewReader(payload))
request.Header.Set("Authorization", "Bearer "+os.Getenv("QELKA_API_KEY"))
request.Header.Set("Content-Type", "application/json")
client := &http.Client{Timeout: 60 * time.Second}
response, err := client.Do(request)
if err != nil {
panic(err)
}
defer response.Body.Close()
var result map[string]any
if err := json.NewDecoder(response.Body).Decode(&result); err != nil {
panic(err)
}
fmt.Println(result)
}
require 'json'
require 'net/http'
uri = URI('https://api.qelka.com/v1/federal/contracts')
request = Net::HTTP::Post.new(uri)
request['Authorization'] = "Bearer #{ENV.fetch('QELKA_API_KEY')}"
request['Content-Type'] = 'application/json'
request.body = JSON.generate({ name: 'Lockheed Martin' })
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true, read_timeout: 60) do |http|
http.request(request)
end
result = JSON.parse(response.body)
puts result
Response
Every valid request gets a 200. Read status first: only found fills the recipient and the lists.
idstringlkp_ followed by 26 characters.objectstringfederal_contracts.inputstringuei or name you sent, without surrounding spaces.querystringuei or name: the field you sent.statusstringfound, not_found or invalid.reasonstring or nullno_match with not_found, invalid_uei with invalid, else null.recipientobject or nullnull unless status is found.recipient.namestringrecipient.ueistring or nullrecipient.dunsstring or nullrecipient.levelstringparent: a corporate parent whose totals include its children. child: an entity with a parent. recipient: an entity with neither.recipient.parentobject or nullchild, its parent: name and uei, each string or null. null otherwise.recipient.alternate_namesarray of stringsrecipient.business_typesarray of stringsother_than_small_business or manufacturer_of_goods.recipient.addressobject or nullline1, city, state, zip, country_code (ISO 3166-1 alpha-3) and congressional_district, each string or null.recipient.urlstringobligationsobject or nullnull unless status is found.obligations.last_12_monthsnumberobligations.transactionsintegerperiodobjecttop_agencies and top_naics: from and to, YYYY-MM-DD, the last 365 days.top_agenciesarray of objectstop_agencies.namestringtop_agencies.codestring or nullDOD.top_agencies.amountnumbertop_naicsarray of objectsname, code and amount fields.recent_contractsarray of objectsrecent_contracts.award_idstringrecent_contracts.descriptionstring or nullrecent_contracts.amountnumber or nullrecent_contracts.date_signedstring or nullYYYY-MM-DD.recent_contracts.start_date, recent_contracts.end_datestring or nullYYYY-MM-DD.recent_contracts.agency, recent_contracts.sub_agencystring or nullrecent_contracts.award_typestring or nullDELIVERY ORDER or DEFINITIVE CONTRACT.recent_contracts.naics_code, recent_contracts.naics_titlestring or nullrecent_contracts.urlstring or nullother_matchesarray of objectsname, uei, level and amount. Empty for a UEI lookup.credits_usedintegerstatus is found with a live key, else 0.cachedbooleantrue when the answer came from the 24-hour cache.Some arrays are cut short in this example:
{
"id": "lkp_01M8CEKJEYE4WD4FZ4WBK4R09Z",
"object": "federal_contracts",
"input": "Lockheed Martin",
"query": "name",
"status": "found",
"reason": null,
"recipient": {
"name": "LOCKHEED MARTIN CORP",
"uei": "ZFN2JJXBLZT3",
"duns": "834951691",
"level": "parent",
"parent": null,
"alternate_names": ["ASTROTECH SPACE OPERATIONS LLC", "COMPOSITE TECHNOLOGY INC.", "DERCO AEROSPACE INC."],
"business_types": [
"category_business",
"corporate_entity_not_tax_exempt",
"manufacturer_of_goods",
"other_than_small_business",
"special_designations",
"us_owned_business"
],
"address": {
"line1": "6801 ROCKLEDGE DR",
"city": "BETHESDA",
"state": "MD",
"zip": "20817",
"country_code": "USA",
"congressional_district": "08"
},
"url": "https://www.usaspending.gov/recipient/b97d19b0-833c-8d8f-3a2c-157d04ea55ef-P/latest"
},
"obligations": { "last_12_months": 51518953111.31, "transactions": 21669 },
"period": { "from": "2025-11-26", "to": "2026-11-26" },
"top_agencies": [
{ "name": "Department of Defense", "code": "DOD", "amount": 50148825310.64 },
{ "name": "National Aeronautics and Space Administration", "code": "NASA", "amount": 1111118808.27 },
{ "name": "Department of Commerce", "code": "DOC", "amount": 136989987.57 }
],
"top_naics": [
{ "name": "Guided Missile and Space Vehicle Manufacturing", "code": "336414", "amount": 19827468446.29 },
{ "name": "Aircraft Manufacturing", "code": "336411", "amount": 16873823470.96 }
],
"recent_contracts": [
{
"award_id": "70Z03827FJ0000031",
"description": "PURCHASE OF MULTIPLE FORMERS TO BE UTILIZED ON THE USCG MH-60T HELICOPTERS.",
"amount": 11504.52,
"date_signed": "2026-11-24",
"start_date": "2026-11-24",
"end_date": "2027-09-25",
"agency": "Department of Homeland Security",
"sub_agency": "U.S. Coast Guard",
"award_type": "DELIVERY ORDER",
"naics_code": "336413",
"naics_title": "OTHER AIRCRAFT PARTS AND AUXILIARY EQUIPMENT MANUFACTURING",
"url": "https://www.usaspending.gov/award/CONT_AWD_70Z03827FJ0000031_7008_70Z03822DJ0000017_7008"
},
{
"award_id": "70Z03827FJ0000028",
"description": "PURCHASE OF THE VARIOUS ITEMS TO BE UTILIZED ON USCG MH-60T HELICOPTERS.",
"amount": 9754.96,
"date_signed": "2026-11-23",
"start_date": "2026-11-23",
"end_date": "2027-12-13",
"agency": "Department of Homeland Security",
"sub_agency": "U.S. Coast Guard",
"award_type": "DELIVERY ORDER",
"naics_code": "336413",
"naics_title": "OTHER AIRCRAFT PARTS AND AUXILIARY EQUIPMENT MANUFACTURING",
"url": "https://www.usaspending.gov/award/CONT_AWD_70Z03827FJ0000028_7008_SPE4A122G0005_9700"
}
],
"other_matches": [
{ "name": "LOCKHEED MARTIN CORPORATION", "uei": "XFJMYSYFJEK4", "level": "child", "amount": 15566390489.39 },
{ "name": "LOCKHEED MARTIN CORPORATION", "uei": "G4KDGE4JFFK7", "level": "child", "amount": 14798575240.9 }
],
"credits_used": 1,
"cached": false
}
Act on the status
status |
What it means | What to do | Billed |
|---|---|---|---|
found |
A recipient matched. | Read the recipient and its totals. For a name search, compare other_matches before you conclude: a group often has several recipients with close names. |
Yes, and cached 24 hours |
not_found |
No recipient matches the UEI or the name (reason: "no_match"). |
Try the legal name, a shorter part of it, or the UEI from the SAM.gov registration. A company that never received a federal award has no recipient. | No |
invalid |
The UEI is not 12 letters and digits without I or O (reason: "invalid_uei"). USAspending.gov is not asked. |
Fix the UEI. | No |
Answers other than found are never cached, so the next request asks USAspending.gov again.
How the lookup works
- A UEI loses its spaces and hyphens and is turned to upper case. It must be 12 characters, letters other than I and O and digits, not starting with 0; otherwise the answer is
invalid. - The UEI or the name is searched among USAspending.gov recipients, sorted by amount. For a UEI, only recipients with exactly that UEI are kept. For a name, the results are grouped by UEI, keeping the entry with the largest amount, and a parent when two tie; the first is the recipient, the next 5 are
other_matches. - Four requests then run together: the recipient profile for its latest 12 months, its obligations of the period by awarding agency over all award types, its obligations by NAICS code over contracts only, and its latest contract awards (types A to D: BPA calls, purchase orders, delivery orders and definitive contracts), searched by UEI, or by DUNS number or name for a recipient without one, and sorted by date signed.
- The profile gives the name, UEI, DUNS, level, parent, alternate names, business types, address and the 12-month totals. If it cannot be read,
obligations.last_12_monthsfalls back to the amount of the search andtransactionsto0.
The Department of Defense publishes its contract awards with a 90-day delay, so its latest contracts are missing from recent_contracts and from the period totals. Subawards are not counted anywhere.
Search a name with a test key
Test keys return a sample recipient without calling USAspending.gov: a name that contains nomatch returns not_found, the UEI TESTUEX12345 returns the sample parent, any other valid UEI returns not_found, and any other name returns the sample below. With a test key in QELKA_API_KEY, this request returns:
curl https://api.qelka.com/v1/federal/contracts \
--max-time 60 \
-H "Authorization: Bearer $QELKA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Acme Widgets"}'
const response = await fetch('https://api.qelka.com/v1/federal/contracts', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.QELKA_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ name: 'Acme Widgets' }),
signal: AbortSignal.timeout(60_000),
})
const result = await response.json()
console.log(result)
import os
import requests
api_key = os.environ["QELKA_API_KEY"]
response = requests.post(
"https://api.qelka.com/v1/federal/contracts",
headers={"Authorization": f"Bearer {api_key}"},
json={"name": "Acme Widgets"},
timeout=60,
)
result = response.json()
print(result)
{
"id": "lkp_01M8CG2T5Q0V9W7XKJ4R6B3N1D",
"object": "federal_contracts",
"input": "Acme Widgets",
"query": "name",
"status": "found",
"reason": null,
"recipient": {
"name": "ACME WIDGETS CORPORATION",
"uei": "TESTUEX12345",
"duns": null,
"level": "parent",
"parent": null,
"alternate_names": ["ACME WIDGETS CORP"],
"business_types": ["category_business", "corporate_entity_not_tax_exempt", "other_than_small_business"],
"address": {
"line1": "1 TEST WAY",
"city": "ARLINGTON",
"state": "VA",
"zip": "22201",
"country_code": "USA",
"congressional_district": "08"
},
"url": "https://www.usaspending.gov/recipient/c1d2e3f4-0000-4000-8000-000000000001-P/latest"
},
"obligations": { "last_12_months": 12500000, "transactions": 42 },
"period": { "from": "2025-11-26", "to": "2026-11-26" },
"top_agencies": [
{ "name": "Department of Defense", "code": "DOD", "amount": 10000000 },
{ "name": "General Services Administration", "code": "GSA", "amount": 2500000 }
],
"top_naics": [
{ "name": "Other Measuring and Controlling Device Manufacturing", "code": "334519", "amount": 9000000 }
],
"recent_contracts": [
{
"award_id": "TEST0001F0001",
"description": "TEST MODE AWARD: SENSOR MAINTENANCE",
"amount": 1200000,
"date_signed": "2026-06-01",
"start_date": "2026-06-01",
"end_date": "2027-05-31",
"agency": "Department of Defense",
"sub_agency": "Department of the Navy",
"award_type": "DELIVERY ORDER",
"naics_code": "334519",
"naics_title": "OTHER MEASURING AND CONTROLLING DEVICE MANUFACTURING",
"url": null
}
],
"other_matches": [
{ "name": "ACME WIDGETS SERVICES LLC", "uei": "TESTUEX67890", "level": "recipient", "amount": 850000 }
],
"credits_used": 0,
"cached": false
}
Errors
| Status | Type | When |
|---|---|---|
| 400 | invalid_request | Both or neither of uei and name, uei empty or longer than 20 characters, name shorter than 2 or longer than 200 characters, a body that is not a JSON object, or a field the request table does not list |
| 401 | invalid_api_key | The key is missing, unknown or revoked |
| 402 | insufficient_credits | Your balance is less than 1 credit (live keys only) |
| 403 | forbidden | The key is restricted to other endpoints |
| 405 | invalid_request | The method is not POST |
| 429 | rate_limited | Too many requests: wait Retry-After seconds |
| 500 | internal_error | Unexpected error on our side: retry with backoff |
| 502 | upstream_unavailable | USAspending.gov could not be reached, answered with an error or did not answer in time: retry later |
No error is billed. A UEI that fails the format check is not an error: it is a 200 with status: "invalid", and a company that USAspending.gov does not know is a 200 with status: "not_found".
Related
- Federal contracts API
- Free tools: federal contractor lookup, NAICS code lookup
- Batch: up to 100 lookups in one call, each item with
type: "federal_contracts" - Bulk: a whole column of UEIs or company names with
type=federal_contracts - Caching, Errors, Test mode