{
  "openapi": "3.0.1",
  "info": {
    "title": "SAM.gov Contract Opportunities API",
    "description": "Search US federal contract opportunities on SAM.gov (solicitations, sources sought, awards) with full detail - NAICS, set-aside, deadlines, POC emails/phones, place of performance, attachment links. No API key required.",
    "version": "0.1",
    "x-build-id": "47Xxqnet8yw0x4eyj"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/alxlin~samgov-opportunities/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-alxlin-samgov-opportunities",
        "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/alxlin~samgov-opportunities/runs": {
      "post": {
        "operationId": "runs-sync-alxlin-samgov-opportunities",
        "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/alxlin~samgov-opportunities/run-sync": {
      "post": {
        "operationId": "run-sync-alxlin-samgov-opportunities",
        "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": {
          "query": {
            "title": "Keyword search",
            "type": "string",
            "description": "Free-text search across opportunity titles/descriptions. Leave blank to match all.",
            "default": ""
          },
          "naics": {
            "title": "NAICS codes",
            "type": "array",
            "description": "Filter to these NAICS codes (OR'd together). Leave empty for all industries. Default is 541511 (Custom Computer Programming Services) so the actor has a fast, reliable default run.",
            "default": [
              "541511"
            ],
            "items": {
              "type": "string"
            }
          },
          "setAside": {
            "title": "Set-aside codes",
            "type": "array",
            "description": "Filter to these set-aside codes (OR'd together), e.g. SBA (total small business), WOSB, EDWOSB, SDVOSBC, HZC, 8A. Leave empty for all. See README for the full code table.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "noticeTypes": {
            "title": "Notice type codes",
            "type": "array",
            "description": "Filter to these notice type codes (OR'd together): o=Solicitation, p=Presolicitation, k=Combined Synopsis/Solicitation, r=Sources Sought, a=Award Notice, s=Special Notice, g=Sale of Surplus Property, i=Intent to Bundle, u=Justification (J&A). Leave empty for all.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "organizationIds": {
            "title": "Agency organization IDs",
            "type": "array",
            "description": "Filter to these SAM.gov internal organization IDs (the organizationId of any level in a result's organizationHierarchy, e.g. \"100000000\" = Dept of Defense). Advanced/optional - leave empty for all agencies.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "popState": {
            "title": "Place-of-performance state",
            "type": "string",
            "description": "Two-letter US state code for place of performance, e.g. TX. Leave blank for all states.",
            "default": ""
          },
          "activeOnly": {
            "title": "Active opportunities only",
            "type": "boolean",
            "description": "Only return currently active (not archived/expired) opportunities.",
            "default": true
          },
          "postedFrom": {
            "title": "Posted from (YYYY-MM-DD)",
            "type": "string",
            "description": "Only include opportunities posted on or after this date. Applied client-side after fetching (SAM.gov's internal search API has no working server-side date filter). Leave blank for no lower bound.",
            "default": ""
          },
          "postedTo": {
            "title": "Posted to (YYYY-MM-DD)",
            "type": "string",
            "description": "Only include opportunities posted on or before this date. Leave blank for no upper bound.",
            "default": ""
          },
          "maxItems": {
            "title": "Max opportunities",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Maximum number of opportunities to return. Kept small by default so the daily automated test run finishes in well under 5 minutes.",
            "default": 25
          },
          "includeDetails": {
            "title": "Include full detail",
            "type": "boolean",
            "description": "Fetch the opportunity-detail page for each result: full NAICS/PSC/set-aside, response deadline, place of performance, points of contact (name/email/phone), and award info for award notices. Costs one extra request per item (charged event: opportunity-detail).",
            "default": true
          },
          "includeAttachments": {
            "title": "Include attachment links",
            "type": "boolean",
            "description": "Fetch the list of attachments (solicitation documents, SOWs, amendments) for each result and include a stable download URL per attachment. Costs one extra request per item plus one charged event per attachment (attachment-download).",
            "default": false
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 5,
            "type": "integer",
            "description": "How many opportunities to enrich (detail/attachments) in parallel. Kept low by default to be a polite, unobtrusive API citizen.",
            "default": 2
          },
          "samApiKey": {
            "title": "Official SAM.gov API key (optional)",
            "type": "string",
            "description": "Optional: your own api.sam.gov key. When supplied, search uses the official api.sam.gov/opportunities/v2/search endpoint (real server-side date filtering) instead of the keyless internal API, falling back to the internal API on any error. This code path is unverified against a real key as of actor build time - please report issues. Leave blank to use the default keyless search."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}