{
  "openapi": "3.0.1",
  "info": {
    "title": "SAM.gov Public Opportunities API",
    "description": "Search U.S. federal contract opportunities via the official GSA Get Opportunities Public API (api.sam.gov). Uses your own free SAM.gov api_key. No HTML scraping.",
    "version": "0.1",
    "x-build-id": "oAFOhoRrEJchChycG"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/tidydata69~sam-gov-opportunities/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-tidydata69-sam-gov-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/tidydata69~sam-gov-opportunities/runs": {
      "post": {
        "operationId": "runs-sync-tidydata69-sam-gov-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/tidydata69~sam-gov-opportunities/run-sync": {
      "post": {
        "operationId": "run-sync-tidydata69-sam-gov-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",
        "required": [
          "apiKey",
          "postedFrom",
          "postedTo"
        ],
        "properties": {
          "apiKey": {
            "title": "SAM.gov API key",
            "type": "string",
            "description": "Your free public API key from SAM.gov. Create a free account at https://sam.gov → Account Details → request a Public API Key (also documented at https://open.gsa.gov/api/get-opportunities-public-api/). Never share this key. Passed to the API as api_key=."
          },
          "postedFrom": {
            "title": "Posted from (MM/dd/yyyy)",
            "pattern": "^(0?[1-9]|1[0-2])/(0?[1-9]|[12][0-9]|3[01])/[0-9]{4}$",
            "type": "string",
            "description": "Inclusive lower bound for posted date. Required by SAM.gov. Format MM/dd/yyyy. Range with postedTo must be ≤ 1 year."
          },
          "postedTo": {
            "title": "Posted to (MM/dd/yyyy)",
            "pattern": "^(0?[1-9]|1[0-2])/(0?[1-9]|[12][0-9]|3[01])/[0-9]{4}$",
            "type": "string",
            "description": "Inclusive upper bound for posted date. Required by SAM.gov. Format MM/dd/yyyy. Range with postedFrom must be ≤ 1 year."
          },
          "keywords": {
            "title": "Keywords / title search",
            "type": "string",
            "description": "Optional title filter. Mapped to the official API title= parameter (substring match on opportunity title). There is no separate q= on the public Opportunities API."
          },
          "ptype": {
            "title": "Procurement type (ptype)",
            "type": "string",
            "description": "Optional notice type code(s). Codes: u=Justification (J&A), p=Pre solicitation, a=Award Notice, r=Sources Sought, s=Special Notice, o=Solicitation, g=Sale of Surplus Property, k=Combined Synopsis/Solicitation, i=Intent to Bundle (DoD). Multiple codes can be comma-separated."
          },
          "status": {
            "title": "Status",
            "enum": [
              "active",
              "inactive",
              "archived",
              "cancelled",
              "deleted"
            ],
            "type": "string",
            "description": "Optional opportunity status filter (API: active, inactive, archived, cancelled, deleted). Marked Coming Soon in GSA docs — passed through when provided."
          },
          "organizationCode": {
            "title": "Organization code",
            "type": "string",
            "description": "Optional organizationCode filter (federal hierarchy code)."
          },
          "organizationName": {
            "title": "Organization name",
            "type": "string",
            "description": "Optional organizationName filter (department / subtier name search)."
          },
          "ncode": {
            "title": "NAICS code (ncode)",
            "pattern": "^[0-9]{2,6}$",
            "type": "string",
            "description": "Optional NAICS code (max 6 digits)."
          },
          "ccode": {
            "title": "Classification code (ccode)",
            "type": "string",
            "description": "Optional PSC / classification code."
          },
          "state": {
            "title": "Place of performance state",
            "type": "string",
            "description": "Optional 2-letter state code for place of performance."
          },
          "zip": {
            "title": "Place of performance ZIP",
            "type": "string",
            "description": "Optional ZIP code for place of performance."
          },
          "solnum": {
            "title": "Solicitation number",
            "type": "string",
            "description": "Optional exact solicitation number filter."
          },
          "noticeid": {
            "title": "Notice ID",
            "type": "string",
            "description": "Optional notice ID filter."
          },
          "typeOfSetAside": {
            "title": "Set-aside code",
            "type": "string",
            "description": "Optional set-aside code (e.g. SBA, 8A, HZC, SDVOSBC, WOSB). See open.gsa.gov Set-Aside Values."
          },
          "rdlfrom": {
            "title": "Response deadline from",
            "pattern": "^(0?[1-9]|1[0-2])/(0?[1-9]|[12][0-9]|3[01])/[0-9]{4}$",
            "type": "string",
            "description": "Optional response-deadline lower bound (MM/dd/yyyy)."
          },
          "rdlto": {
            "title": "Response deadline to",
            "pattern": "^(0?[1-9]|1[0-2])/(0?[1-9]|[12][0-9]|3[01])/[0-9]{4}$",
            "type": "string",
            "description": "Optional response-deadline upper bound (MM/dd/yyyy)."
          },
          "limit": {
            "title": "Max opportunities",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Maximum opportunity records to return across pages. Each SAM page is at most 1000 rows. Keep small while testing (SAM daily quotas apply per api_key).",
            "default": 25
          },
          "offset": {
            "title": "Starting page offset",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Zero-based SAM.gov page index to start from (passed as offset=). Default 0.",
            "default": 0
          },
          "pageSize": {
            "title": "Page size",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Records per SAM.gov request (API limit param, max 1000).",
            "default": 100
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}