> ## Documentation Index
> Fetch the complete documentation index at: https://hc.starbridge.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Opportunity

> Everything about one procurement record in a single call: the full untruncated summary, the buyer and its parent, the seller it was awarded to, the amounts and dates, the source files behind it, and the purchase-order line items parsed out of them. Call it with an `opportunityId` from `searchOpportunities`, `researchBuyerFiles`, or an RFP signal's `row.entity.id` from `listSignals`. For an RFP signal, this response's `rfpIds` are the source RFP IDs to pass to `getRfp`; one opportunity may contain several RFPs.

`files[]` carries each source file's `fileId` — pass it to `viewFileContents` for the extracted text, or to `getFileDownloadLinks` for the original bytes. Only a file in `Processed` status has readable text. `lineItems[]` is the per-line detail of the purchase orders bundled into the opportunity, oldest first and drawn from at most 200 purchase orders; it is empty for an opportunity with none; its per-line `purchaseAmount` is in whole currency units, the same unit as the opportunity's own `purchaseAmount`. Set `includeFiles=false` or `includeLineItems=false` when you only need the record — the line-item lookup in particular costs an extra round trip.

`status` is `Future` while `untilDate` is still ahead, `Past` once it has gone by, which is how you tell an open RFP from a closed one. `buyer.id` is the handle for everything about the buyer itself: `getBuyerSummary`, `getBuyerAccountContext`, `searchBuyerContacts`, `researchBuyerFiles`. For line items across several opportunities at once, call `getOpportunityLineItems` instead of this tool per id.



## OpenAPI

````yaml https://core-http2-157602306522.us-central1.run.app/external/public/swagger/documentation.yaml get /api/external/opportunity/{opportunityId}/details
openapi: 3.1.1
info:
  title: Starbridge External Public API
  version: '1.0'
servers:
  - url: https://dashboard.starbridge.ai
security: []
paths:
  /api/external/opportunity/{opportunityId}/details:
    get:
      tags:
        - External API
        - Opportunity
      summary: Get Opportunity
      description: >-
        Everything about one procurement record in a single call: the full
        untruncated summary, the buyer and its parent, the seller it was awarded
        to, the amounts and dates, the source files behind it, and the
        purchase-order line items parsed out of them. Call it with an
        `opportunityId` from `searchOpportunities`, `researchBuyerFiles`, or an
        RFP signal's `row.entity.id` from `listSignals`. For an RFP signal, this
        response's `rfpIds` are the source RFP IDs to pass to `getRfp`; one
        opportunity may contain several RFPs.


        `files[]` carries each source file's `fileId` — pass it to
        `viewFileContents` for the extracted text, or to `getFileDownloadLinks`
        for the original bytes. Only a file in `Processed` status has readable
        text. `lineItems[]` is the per-line detail of the purchase orders
        bundled into the opportunity, oldest first and drawn from at most 200
        purchase orders; it is empty for an opportunity with none; its per-line
        `purchaseAmount` is in whole currency units, the same unit as the
        opportunity's own `purchaseAmount`. Set `includeFiles=false` or
        `includeLineItems=false` when you only need the record — the line-item
        lookup in particular costs an extra round trip.


        `status` is `Future` while `untilDate` is still ahead, `Past` once it
        has gone by, which is how you tell an open RFP from a closed one.
        `buyer.id` is the handle for everything about the buyer itself:
        `getBuyerSummary`, `getBuyerAccountContext`, `searchBuyerContacts`,
        `researchBuyerFiles`. For line items across several opportunities at
        once, call `getOpportunityLineItems` instead of this tool per id.
      operationId: getOpportunity
      parameters:
        - name: opportunityId
          in: path
          required: true
          schema:
            type: string
        - name: includeFiles
          in: query
          description: >-
            Whether to include the source files. Set false when you only need
            the record.
          schema:
            type: boolean
            default: 'true'
        - name: includeLineItems
          in: query
          description: >-
            Whether to include parsed purchase-order line items. Set false to
            skip an extra lookup.
          schema:
            type: boolean
            default: 'true'
      responses:
        '200':
          description: The opportunity with its files and line items
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpportunityDetails'
        '400':
          description: Invalid request body or format
        '401':
          description: Missing or invalid authentication
        '403':
          description: Unauthorized to access resource or perform action
        '404':
          description: Resource not found
        '415':
          description: Unsupported media type or request body format
        '429':
          description: Rate limit exceeded
        '500':
          description: Internal server error
      security:
        - apiKey: []
components:
  schemas:
    OpportunityDetails:
      type: object
      title: OpportunityDetails
      required:
        - opportunityId
        - name
        - type
        - buyer
        - createdAt
        - updatedAt
        - url
      properties:
        opportunityId:
          type: string
          format: uuid
        name:
          type: string
        type:
          type: string
          description: Document type. `Selling` is the wire name for an RFP
          enum:
            - Selling
            - PurchaseOrder
            - Contract
            - SalesProposal
            - BoardMeeting
            - StrategicPlan
            - CapitalImprovementPlan
            - AnnualFinancialReport
            - BoardMeetingAgenda
            - BoardMeetingAgendaPacket
            - ProposedBudget
            - Budget
            - BudgetAmendment
        summary:
          type:
            - string
            - 'null'
          description: >-
            Full summary of the document — not truncated, unlike the one
            `searchOpportunities` returns
        buyer:
          $ref: '#/components/schemas/OpportunityBuyer'
        parentBuyer:
          oneOf:
            - $ref: '#/components/schemas/OpportunityBuyer'
            - type: 'null'
        sellerId:
          type:
            - string
            - 'null'
          description: >-
            Seller the opportunity was awarded to, for a purchase order or
            contract
          format: uuid
        sellerName:
          type:
            - string
            - 'null'
          description: Name of the seller the opportunity was awarded to
        purchaseAmount:
          type:
            - integer
            - 'null'
          description: >-
            Purchase amount in whole currency units, when the document carries
            one
        oneTimeCost:
          type:
            - integer
            - 'null'
          description: One-time cost extracted from the document
        annualCost:
          type:
            - integer
            - 'null'
          description: Recurring annual cost extracted from the document
        fromDate:
          type:
            - string
            - 'null'
        untilDate:
          type:
            - string
            - 'null'
        status:
          type:
            - string
            - 'null'
          description: >-
            `Past` or `Future`, derived from `untilDate` — `Future` means the
            deadline has not passed
          enum:
            - Future
            - NextTwoYears
            - NextYear
            - NextNineMonths
            - NextSixMonths
            - NextThreeMonths
            - NextTwoMonths
            - NextOneMonth
            - NextSixtyDays
            - NextThirtyDays
            - NextSevenDays
            - NextOneDay
            - Present
            - LastOneDay
            - LastSevenDays
            - LastThirtyDays
            - LastSixtyDays
            - LastOneMonths
            - LastTwoMonths
            - LastThreeMonths
            - LastSixMonths
            - LastNineMonths
            - LastYear
            - LastTwoYears
            - Past
        createdAt:
          type: string
          description: When Starbridge ingested the opportunity
          format: date-time
        updatedAt:
          type: string
          description: When Starbridge last updated the opportunity
          format: date-time
        rfpIds:
          type: array
          description: Ids of the RFP records bundled into this opportunity
          items:
            type: string
            format: uuid
        purchaseOrderIds:
          type: array
          description: Ids of the purchase-order records bundled into this opportunity
          items:
            type: string
            format: uuid
        files:
          type:
            - array
            - 'null'
          description: Source files behind the opportunity. Null when `includeFiles=false`
          items:
            $ref: '#/components/schemas/OpportunityFile'
        lineItems:
          type:
            - array
            - 'null'
          description: >-
            Purchase-order line items parsed from the files, oldest first, from
            at most 200 purchase orders. Null when `includeLineItems=false`,
            empty when the opportunity has no parsed purchase orders.
            `purchaseAmount` here is in whole currency units, like the
            opportunity's own `purchaseAmount`.
          items:
            $ref: '#/components/schemas/LineItem'
        url:
          type: string
          description: >-
            Starbridge dashboard link that opens this opportunity. Give it to
            the user when they ask for a link to the opportunity; `sourceUrl`
            fields point at the buyer's original documents instead.
    OpportunityBuyer:
      type: object
      title: OpportunityBuyer
      description: >-
        Parent of the buyer, when the buyer sits under one (a district over a
        school)
      required:
        - id
        - name
      properties:
        id:
          type: string
          description: >-
            Buyer id — pass it to `getBuyerSummary`, `searchBuyerContacts` or
            `researchBuyerFiles`
          format: uuid
        name:
          type: string
        stateCode:
          type:
            - string
            - 'null'
          description: Two-letter state code of the buyer, when it has one
    OpportunityFile:
      type: object
      title: OpportunityFile
      required:
        - fileId
        - name
        - status
      properties:
        fileId:
          type: string
          description: >-
            File id — pass it to `viewFileContents` for the text,
            `getFileDownloadLinks` for the bytes
          format: uuid
        name:
          type: string
          description: >-
            Readable file name, disambiguated when an opportunity has several
            files of one kind
        type:
          type:
            - string
            - 'null'
          description: >-
            What the file is — BoardMeetingAgenda, Budget, and so on. Null for
            an untyped file
          enum:
            - Rfp
            - RfpProposal
            - Contract
            - PurchaseOrder
            - VendorList
            - BoardMeeting
            - BoardMeetingAgenda
            - BoardMeetingAgendaPacket
            - StrategicPlan
            - CapitalImprovementPlan
            - AnnualFinancialReport
            - ProposedBudget
            - Budget
            - BudgetAmendment
            - CurriculumAdoptionSchedule
            - Other
        status:
          type: string
          description: Processing status. Only a Processed file has readable text
          enum:
            - Unprocessed
            - Queued
            - Processing
            - Processed
            - Failed
        sourceUrl:
          type:
            - string
            - 'null'
          description: Citation URL the file was fetched from, when it is known
    LineItem:
      type: object
      title: LineItem
      required:
        - name
      properties:
        buyerFileId:
          type:
            - string
            - 'null'
          description: ID of the source buyer file this line item was parsed from.
          format: uuid
        buyerFileName:
          type:
            - string
            - 'null'
          description: Name of the source buyer file.
        name:
          type: string
          description: Line item name or description.
        purchaseAmount:
          type:
            - integer
            - 'null'
          description: Total purchase amount for the line item, in whole currency units.
        purchaseDate:
          type:
            - string
            - 'null'
          description: Date the line item was purchased.
        quantity:
          type:
            - integer
            - 'null'
          description: Quantity purchased.
        unitPrice:
          type:
            - number
            - 'null'
          description: Unit price of the line item.
        discount:
          type:
            - number
            - 'null'
          description: Discount applied to the line item.
  securitySchemes:
    apiKey:
      scheme: bearer
      description: HTTP Bearer Authentication
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.