{
  "openapi": "3.0.1",
  "info": {
    "title": "USA Spending Federal Awards Scraper",
    "description": "Search every US federal award on USAspending.gov -- contracts, grants, loans, direct payments, IDVs. Filter by agency, recipient, keyword, NAICS/PSC/CFDA, place, amount, disaster codes. Keyset pagination past 50k; full award detail with subawards and executive comp. Keyless.",
    "version": "0.1",
    "x-build-id": "6AzIMiE4zvtx3Txe6"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapyx~usaspending-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapyx-usaspending-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/scrapyx~usaspending-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapyx-usaspending-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/scrapyx~usaspending-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapyx-usaspending-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "awards",
              "award-detail"
            ],
            "type": "string",
            "description": "`awards` runs the spending_by_award search. `award-detail` fetches the full record for specific award ids.",
            "default": "awards"
          },
          "awardGroup": {
            "title": "Award group",
            "enum": [
              "contracts",
              "idvs",
              "grants",
              "direct_payments",
              "loans",
              "other"
            ],
            "type": "string",
            "description": "`awards` mode. USAspending requires all award types to be from ONE group. This picks the type codes and the group-appropriate output fields.",
            "default": "contracts"
          },
          "awardIds": {
            "title": "Award ids",
            "type": "array",
            "description": "`award-detail` mode. One per line: a `generated_internal_id` (`CONT_AWD_...`, `CONT_IDV_...`, `ASST_NON_...`, `ASST_AGG_...`) from an `awards` row, or a `https://www.usaspending.gov/award/...` URL.",
            "items": {
              "type": "string"
            }
          },
          "keywords": {
            "title": "Keywords",
            "type": "array",
            "description": "`awards` filter. Free-text match across award descriptions and recipient names.",
            "items": {
              "type": "string"
            }
          },
          "recipientSearchText": {
            "title": "Recipient name contains",
            "type": "array",
            "description": "`awards` filter. Match the recipient (company / organisation) name, e.g. `Lockheed Martin`.",
            "items": {
              "type": "string"
            }
          },
          "awardingAgency": {
            "title": "Awarding agency",
            "type": "array",
            "description": "`awards` filter. Top-tier agency by name or abbreviation, any capitalisation: `DOD`, `nasa`, `Department of Health and Human Services`. Names are checked against USAspending's own agency list (an unknown name stops the run with the valid list, instead of silently returning nothing).",
            "items": {
              "type": "string"
            }
          },
          "fundingAgency": {
            "title": "Funding agency (exact name)",
            "type": "array",
            "description": "`awards` filter. Funding agency, same rules as awarding agency (name or abbreviation, any case).",
            "items": {
              "type": "string"
            }
          },
          "fromDate": {
            "title": "From date",
            "type": "string",
            "description": "`awards` filter. `YYYY-MM-DD`. Defaults to 5 years ago if neither date is given (the API otherwise searches back to FY2008)."
          },
          "toDate": {
            "title": "To date",
            "type": "string",
            "description": "`awards` filter. `YYYY-MM-DD`. Defaults to today."
          },
          "dateType": {
            "title": "Date type",
            "enum": [
              "",
              "action_date",
              "date_signed",
              "last_modified_date",
              "new_awards_only"
            ],
            "type": "string",
            "description": "`awards` filter. Which date the window applies to: `action_date` (default), `date_signed`, `last_modified_date`, `new_awards_only`.",
            "default": ""
          },
          "minAwardAmount": {
            "title": "Minimum award amount (USD)",
            "type": "integer",
            "description": "`awards` filter."
          },
          "maxAwardAmount": {
            "title": "Maximum award amount (USD)",
            "type": "integer",
            "description": "`awards` filter."
          },
          "placeOfPerformanceState": {
            "title": "Place of performance — state",
            "type": "string",
            "description": "`awards` filter. 2-letter US state code (`CA`, `TX`)."
          },
          "placeOfPerformanceCountry": {
            "title": "Place of performance — country",
            "type": "string",
            "description": "`awards` filter. 3-letter code (`USA`)."
          },
          "recipientLocationState": {
            "title": "Recipient location — state",
            "type": "string",
            "description": "`awards` filter. 2-letter US state code."
          },
          "recipientLocationCountry": {
            "title": "Recipient location — country",
            "type": "string",
            "description": "`awards` filter. 3-letter code."
          },
          "naicsCodes": {
            "title": "NAICS codes",
            "type": "array",
            "description": "`awards` filter (contracts/IDVs). Industry codes, e.g. `336414` (space vehicle manufacturing). Prefixes work (`3364`).",
            "items": {
              "type": "string"
            }
          },
          "pscCodes": {
            "title": "PSC codes",
            "type": "array",
            "description": "`awards` filter (contracts/IDVs). Product/service codes, e.g. `AR62`, `R425`.",
            "items": {
              "type": "string"
            }
          },
          "cfdaNumbers": {
            "title": "CFDA / Assistance Listing numbers",
            "type": "array",
            "description": "`awards` filter (grants/direct payments/loans). e.g. `81.049`, `93.243`.",
            "items": {
              "type": "string"
            }
          },
          "recipientTypeNames": {
            "title": "Recipient business types",
            "type": "array",
            "description": "`awards` filter. e.g. `small_business`, `woman_owned_business`, `minority_owned_business`, `nonprofit`, `higher_education`.",
            "items": {
              "type": "string"
            }
          },
          "defCodes": {
            "title": "Disaster / emergency codes (DEFC)",
            "type": "array",
            "description": "`awards` filter. Supplemental-appropriation codes — COVID-19 relief is `L`,`M`,`N`,`O`,`P`,`U`; infrastructure (IIJA) is `Z`,`1`.",
            "items": {
              "type": "string"
            }
          },
          "setAsideTypeCodes": {
            "title": "Set-aside type codes",
            "type": "array",
            "description": "`awards` filter (contracts). e.g. `SBA` (small business), `8AN` (8(a)), `SDVOSBC` (service-disabled veteran).",
            "items": {
              "type": "string"
            }
          },
          "rawFilters": {
            "title": "Raw filters (power users)",
            "type": "object",
            "description": "Merged into the `filters` object verbatim. See api.usaspending.gov/docs (spending_by_award)."
          },
          "sort": {
            "title": "Sort field",
            "type": "string",
            "description": "`awards` mode. A display field name, e.g. `Award Amount`, `Start Date`, `Recipient Name`. Must be valid for the award group (loans have no `Award Amount`). Default is the group's amount field."
          },
          "order": {
            "title": "Sort order",
            "enum": [
              "desc",
              "asc"
            ],
            "type": "string",
            "description": "`awards` mode. `desc` (largest / newest first) or `asc`.",
            "default": "desc"
          },
          "slimOutput": {
            "title": "Slim output (drop raw)",
            "type": "boolean",
            "description": "By default every AWARD row carries the verbatim API record in `raw`.",
            "default": false
          },
          "maxResults": {
            "title": "Max results",
            "minimum": 1,
            "type": "integer",
            "description": "`awards` mode cap. Keyset pagination is used, so this can exceed 50,000 (the `page`-offset ceiling does not apply).",
            "default": 1000
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Parallel in-flight requests (matters for `award-detail` mode).",
            "default": 3
          },
          "minRequestInterval": {
            "title": "Min seconds between requests",
            "minimum": 0,
            "type": "number",
            "description": "Politeness pacing for a government API. USAspending's limits are generous.",
            "default": 0.4
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional. No anti-bot layer, so a proxy is OFF by default.",
            "default": {
              "useApifyProxy": false
            }
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}