{
  "openapi": "3.0.1",
  "info": {
    "title": "USAspending Federal Spending Search",
    "description": "Search and extract US federal government spending data directly from the official USAspending.gov API. This actor provides structured access to over $2 trillion in annual federal spending across contracts, grants, loans, direct payments, and other financial assistance programs.",
    "version": "2.0",
    "x-build-id": "9rhoZgQTYXD91kZGu"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/ryanclinton~usaspending-search/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-ryanclinton-usaspending-search",
        "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/ryanclinton~usaspending-search/runs": {
      "post": {
        "operationId": "runs-sync-ryanclinton-usaspending-search",
        "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/ryanclinton~usaspending-search/run-sync": {
      "post": {
        "operationId": "run-sync-ryanclinton-usaspending-search",
        "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": [
              "search",
              "market",
              "contractor",
              "monitor",
              "discover"
            ],
            "type": "string",
            "description": "What the run optimises for. 'search' (default) returns award rows + analytics. 'market' adds a market-scan digest answering 'should I care about this market?' (health score, trend, incumbents, gaining/losing share). 'contractor' adds a contractor-profile digest for the recipient you search (share, vulnerability, top agencies). 'monitor' is search + cross-run change tracking + historical market snapshots (set a watchlistName). 'discover' ignores the keyword and ranks a curated set of federal markets by spending growth ('where should I be looking?').",
            "default": "search"
          },
          "keyword": {
            "title": "Search Keyword",
            "type": "string",
            "description": "Search keyword across award descriptions (e.g. 'cybersecurity', 'renewable energy', 'healthcare'). Leave empty to search by recipient/agency/date only."
          },
          "keywords": {
            "title": "Search Keywords (multiple)",
            "type": "array",
            "description": "Additional keywords, matched as ANY (OR) by the USAspending API. Combined with the single Search Keyword above.",
            "items": {
              "type": "string"
            }
          },
          "awardType": {
            "title": "Award Type",
            "enum": [
              "contracts",
              "grants",
              "loans",
              "direct_payments",
              "other",
              "idvs"
            ],
            "type": "string",
            "description": "Type of federal spending award to search. Awards from different groups cannot be mixed in one API request — for multiple types use 'Award Types (multiple)' below, which runs each group and merges the results.",
            "default": "contracts"
          },
          "awardTypes": {
            "title": "Award Types (multiple)",
            "type": "array",
            "description": "Search several award types in one run. Valid values: contracts, grants, loans, direct_payments, other, idvs. Each type is fetched as its own API group, then merged and ranked together. Takes precedence over the single Award Type above.",
            "items": {
              "type": "string"
            }
          },
          "dateRange": {
            "title": "Date Range",
            "type": "string",
            "description": "Filter by date range in format 'YYYY-MM-DD to YYYY-MM-DD' (e.g. '2024-01-01 to 2024-12-31'). Earliest supported: 2007-10-01."
          },
          "dateType": {
            "title": "Date Field",
            "enum": [
              "action_date",
              "date_signed",
              "last_modified_date",
              "new_awards_only"
            ],
            "type": "string",
            "description": "Which date the Date Range filters on. 'action_date' (default) = the award/transaction action date; 'date_signed' = when the award was signed; 'last_modified_date' = last update; 'new_awards_only' = only brand-new awards in the window.",
            "default": "action_date"
          },
          "maxResults": {
            "title": "Max Results",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Maximum number of awards to return (API returns up to 100 per page). Across multiple award types, the merged top results are returned up to this cap.",
            "default": 25
          },
          "agency": {
            "title": "Awarding Agency",
            "type": "string",
            "description": "Filter by awarding agency name (e.g. 'Department of Defense', 'Department of Energy'). Must be the exact official top-tier name unless 'Resolve agency name' is on."
          },
          "resolveAgency": {
            "title": "Resolve agency name",
            "type": "boolean",
            "description": "Resolve a loose agency name ('DoD', 'NASA') to its canonical top-tier name via the USAspending autocomplete endpoint before filtering. Any resolution is reported in the summary's resolutionWarnings. Costs one extra API call.",
            "default": false
          },
          "recipient": {
            "title": "Recipient Name",
            "type": "string",
            "description": "Search by recipient/contractor name (e.g. 'Lockheed Martin', 'Deloitte')."
          },
          "naicsCodes": {
            "title": "NAICS Codes",
            "type": "array",
            "description": "Filter by NAICS industry codes (e.g. '541512' Computer Systems Design Services). One or more 6-digit codes.",
            "items": {
              "type": "string"
            }
          },
          "naicsSearch": {
            "title": "NAICS Search Terms",
            "type": "array",
            "description": "Don't know the codes? Enter plain-language industry terms (e.g. 'cybersecurity', 'cloud') and the actor resolves them to NAICS codes via the autocomplete endpoint. Merged with any NAICS Codes above.",
            "items": {
              "type": "string"
            }
          },
          "pscCodes": {
            "title": "PSC Codes",
            "type": "array",
            "description": "Filter by Product or Service Code (e.g. 'D399' IT and Telecom services). One or more codes.",
            "items": {
              "type": "string"
            }
          },
          "pscSearch": {
            "title": "PSC Search Terms",
            "type": "array",
            "description": "Plain-language product/service terms resolved to PSC codes via the autocomplete endpoint. Merged with any PSC Codes above.",
            "items": {
              "type": "string"
            }
          },
          "recipientStates": {
            "title": "Recipient States",
            "type": "array",
            "description": "Filter by recipient location, by 2-letter US state code (e.g. 'VA', 'MD', 'CA').",
            "items": {
              "type": "string"
            }
          },
          "placeOfPerformanceStates": {
            "title": "Place of Performance States",
            "type": "array",
            "description": "Filter by where the work is performed, by 2-letter US state code.",
            "items": {
              "type": "string"
            }
          },
          "minAmount": {
            "title": "Minimum Award Amount",
            "type": "number",
            "description": "Minimum award amount in dollars (e.g. 1000000 for $1M+)."
          },
          "maxAmount": {
            "title": "Maximum Award Amount",
            "type": "number",
            "description": "Maximum award amount in dollars. Combine with the minimum to set an amount band."
          },
          "sortBy": {
            "title": "Sort By",
            "enum": [
              "amount",
              "recipient"
            ],
            "type": "string",
            "description": "Order results by award amount (default) or recipient name.",
            "default": "amount"
          },
          "sortOrder": {
            "title": "Sort Order",
            "enum": [
              "desc",
              "asc"
            ],
            "type": "string",
            "description": "Descending (largest/last first, default) or ascending.",
            "default": "desc"
          },
          "outputProfile": {
            "title": "Output Profile",
            "enum": [
              "minimal",
              "standard",
              "full"
            ],
            "type": "string",
            "description": "How much detail to include on each award record. 'minimal' = decision-shaped headline (recipient, amount, size tier, agency, active flag, recompete signal, flags, link). 'standard' = the full record minus the long description. 'full' = every field including the complete description text. A run-level analytics summary record is always included regardless of profile.",
            "default": "standard"
          },
          "recompeteWindowDays": {
            "title": "Recompete Window (days)",
            "minimum": 1,
            "maximum": 1825,
            "type": "integer",
            "description": "Contracts whose period of performance ends within this many days are flagged as recompete opportunities (recompeteSignal). Default 180.",
            "default": 180
          },
          "includeExpiringOnly": {
            "title": "Only expiring / recompete awards",
            "type": "boolean",
            "description": "Emit only awards inside the recompete window (expiring-soon or recompete-window). Suppressed awards are still counted in the summary analytics. Default off.",
            "default": false
          },
          "onlyFlagged": {
            "title": "Only flagged awards",
            "type": "boolean",
            "description": "Emit only awards carrying at least one anomaly flag (e.g. amount_above_p95, ending_soon, single_recipient_dominance). Suppressed awards are still counted in the summary analytics. Default off.",
            "default": false
          },
          "includeTrend": {
            "title": "Include Spending Trend",
            "type": "boolean",
            "description": "Also compute the federal spending trend for these filters across fiscal years (rising / falling / stable), added to the summary record. Costs one extra API call. Default off.",
            "default": false
          },
          "watchlistName": {
            "title": "Watchlist Name (monitoring)",
            "type": "string",
            "description": "Name a watchlist to turn on cross-run monitoring. The actor remembers the awards and recipient shares from each run under this name; the next run tags each award with a changeType (new_award / amount_increased / amount_decreased / contract_extended / unchanged) and computes recipient share momentum. The first run is a baseline. Leave empty for a one-off search."
          },
          "emitOnly": {
            "title": "Emit Only",
            "enum": [
              "all",
              "new",
              "changed",
              "new_or_changed"
            ],
            "type": "string",
            "description": "When monitoring is on, emit only awards of these change classes. 'all' (default), 'new' (only new_award), 'changed' (amount/extension changes), or 'new_or_changed'. Suppressed awards are still tracked and counted. Ignored when no watchlist is set.",
            "default": "all"
          }
        }
      },
      "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}