economy

Get US federal spending by state, county or country

Returns how much the US federal government spent, by geography, for an industry, a product or service, or a topic. Data comes from USAspending.gov, the official US government source for federal spending. Narrow it with naics (industry), psc (product or service code) and keyword, or send none to see all spending. The window defaults to the most recent US federal fiscal year that ended at least 90 days ago (agencies report with a lag, so a year that just ended is only partly reported), and any window since 2007-10-01 is allowed. award_type is contracts by default, with grants and all available. geo picks the layer: state (USPS codes, with DC and territories), county (5 digit FIPS codes) or country (ISO alpha-3 codes, which is how foreign place of performance appears). scope chooses whether spending is placed where the work is done (place_of_performance, the default) or where the recipient is based (recipient_location). Amounts are US dollars of federal obligations recorded in the window. The response is data.regions[], sorted by amount, largest first, each { code, name, amount, population, per_capita } (the last two when the source publishes them), plus data.total_amount, data.geo_layer and a data.filters echo of what was applied. A combination with no spending returns 404 and is not billed.

get/economy/government-spend

Request

  • Base URL: https://www.socialcrawl.dev/v1
  • URL: https://www.socialcrawl.dev/v1/economy/government-spend
  • Auth: API key in header x-api-key

Query parameters

naicsstring

Industry filter: one or more NAICS codes, comma-separated (up to 20). Each code must be 2, 4 or 6 digits, and a shorter code matches the whole family, so 4811 covers scheduled air transportation and 48 covers all transportation.

pscstring

Product or service code filter: one or more codes, comma-separated (up to 20), 1 to 4 characters each. A shorter code matches the family, so V is all transportation, travel and relocation services and V301 is travel agent services.

keywordstring

Free-text match against award descriptions, 3 to 120 characters. Use it for a topic such as travel that no single industry code captures.

from_datestring

Start of the window, YYYY-MM-DD, no earlier than 2007-10-01. Defaults to the first day of the most recent US federal fiscal year (1 October to 30 September) that ended at least 90 days ago, because agencies report with a lag and a year that just ended is only partly reported. Send only this and the window runs to today.

to_datestring

End of the window, YYYY-MM-DD. Defaults to the last day of the most recent US federal fiscal year that ended at least 90 days ago (30 September). Send only this and the window starts one year earlier.

geo'state' | 'county' | 'country'

Geography layer: state (default), county or country.

scope'place_of_performance' | 'recipient_location'

place_of_performance (default) places spending where the work is done. recipient_location places it where the recipient is based.

award_type'contracts' | 'grants' | 'all'

contracts (default) is purchase orders, delivery orders, definitive contracts and blanket purchase agreement calls. grants is grants and cooperative agreements. all is every award type.

Headers

Cache-Controlstring

Send no-cache to bypass the response cache and force a live fetch. Billed at the normal endpoint cost; the fresh result is written back to cache for the next caller. Only the no-cache directive triggers this. See the Response Schema guide for details.

Idempotency-Keystring

Optional UUID that makes the request safely retriable. The key is reserved atomically per account before billing. A concurrent retry receives 409 IDEMPOTENCY_IN_PROGRESS with a Retry-After of 1 second while the original is young, growing to a quarter of the time it has been running (at most 30); a crashed reservation expires after 5 minutes. A replay keeps the cached payload immutable except for billing metadata: credits_used becomes 0, idempotent_replay becomes true, and credits_remaining is refreshed to the current balance. A known current balance appears in both the body and X-Credits-Remaining header; no balance row resolves to 0. On a transient lookup failure, body credits_remaining is null and X-Credits-Remaining is omitted. Completed outcomes expire after 24 hours. If the claim store is unavailable, the request fails closed before billing. GET endpoints do not combine idempotent replay with Server-Sent Events: use Accept: application/json when sending this header. The unsupported key-plus-SSE combination is rejected before billing.

Response

Successful response

successboolean required

Whether the request succeeded

platformstring required

Platform name

endpointstring required

API endpoint path

credits_usedinteger required

Number of credits consumed

credits_remaininginteger nullable required

Current account balance, or null when this response could not establish one. Free cache hits always return null because they do not establish an authoritative post-request balance. An idempotency replay also returns null when its current-balance lookup fails. It is never a fabricated zero, so a zero here means the account really is empty. The authoritative reading is the one on a billed response, which comes straight from the deduction.

request_idstring required

Unique request identifier for support

cachedboolean required

Whether the response was served from cache

idempotent_replayboolean

True only when this response is an idempotency replay

Example response

{
  "success": true,
  "platform": "economy",
  "endpoint": "/v1/economy/government-spend",
  "credits_used": 1,
  "credits_remaining": 4999,
  "request_id": "req-abc123",
  "idempotent_replay": true,
  "meta": {
    "hint": {
      "code": "search_multi",
      "message": "You searched \"matcha\" on 3 platforms one call at a time; /v1/search/multi returns each platform's own search rows in one call at the same price per platform, and a platform with no rows is not charged.",
      "method": "GET",
      "path": "/v1/search/multi?query=matcha&platforms=instagram,tiktok,youtube"
    }
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.