web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / How to Pass Dynamic Pa...
Copilot Studio
Answered

How to Pass Dynamic Parameters to an External API in Copilot Studio Custom Knowledge

(2) ShareShare
ReportReport
Posted on by 115
Hi everyone,
I am trying to use Custom Knowledge in Copilot Studio where the knowledge source comes from an external API. I followed this article: https://microsoft.github.io/mcscatblog/posts/copilot-studio-custom-knowledge-source/  
 
However, I am facing a challenge the API endpoint retrieves data dynamically and requires a parameter called ExpNumber, for example:

POST request body:
{
  "ExpNumber": "EXP-000001"
}

The issue is that ExpNumber changes for each request. For example, a user might want to retrieve information for document EXP-000013 instead of EXP-000001.


My question is:

How can I pass a dynamic value like ExpNumber from the user’s prompt to the API when using Custom Knowledge in Copilot Studio? And how can I take advantage of these system variables to achieve this?
System.SearchQuery
System.KeywordSearchQuery
System.SearchResults


I want to understand how to use these variables to build a dynamic custom knowledge source that calls my API with different ExpNumber values based on the user’s request.

Thank you for you suggestion and answers

This is the API response 
{

  "ExpenseReportHeader": {
    "ExpNumber": "EXP-000001",
    "ApprovalStatus": "In review",
    "CreatingWorker": "User One",
    "Location": "",
    "FinalApprover": "Manager One",
    "LegalEntity": "LE01",
    "Purpose": "Testing Workflow AI",
    "Description": "Sample AI agent test",
    "IntercompanyLE": "LE01",
    "InvoiceId": "",
    "PostedDate": "",
    "ReferenceDataAreaId": "LE01",
    "SourceDocumentHeader": 0,
    "ModifiedDateTime": "01/01/2026 10:00:00 AM",
    "ModifiedBy": "User One",
    "ModifiedTransactionId": 10001,
    "CreatedDateTime": "01/01/2026 09:50:00 AM",
    "CreatedBy": "User One",
    "TotalExpenseReportAmount": "100,000.00 CUR",
    "BudgetCode": "BC0001-Sample Budget",
    "BudgetOwner": "User One",
    "Department": "DEP01 , Sample Department",
    
    "ReviewLink": "https://example.test/link",
    "LastComment": "",
    "PendingUsers": [],
    "ApprovedBy": [
      "Manager One on 01/01/2026 10:10:00 AM",
      "User One on 01/01/2026 10:05:00 AM"
    ],
    "LastApprovedBy": "Manager One on 01/01/2026 10:10:00 AM",
    "SubmittedBy": "User One On: 01/01/2026 10:00:00 AM"
  },
  "LineTransactions": [
    {

      "ExpenseTransactionNumber": "00000001",
      "LegalEntity": "LE01",
      "ExpenseLineType": "Default",
      "TransactionDate": "01/01/2026 12:00:00 AM",
      "ApprovalStatus": "Approved",
      "ApprovedDate": "",
      "Merchant": "Sample Merchant A",
      "TransactionAmount": "40,000.00 CUR",
      "NetTransactionAmount": "40,000.00 CUR",
      "CreatedBy": "User One",
      "CreatedDateAndTime": "01/01/2026 09:55:00 AM",
      "ReceiptAttached": 1,
      "Description": "Sample expense A",
      "PaymentMethod": "ADV SET",
      "CostOwner": 0,
      "ExpenseCategory": "Category A",
      "AdditionalInformation": "Line info A",
      "BudgetCode": "BC0001-Sample Budget",
      "BudgetOwner": "User One",
      "Department": "DEP01 , Sample Department",
      "Voucher": "",
      "LineNumber": 1.0,
      "WorkFlowLineLastComment": "By: User One on 01/01/2026 10:15:00 AM: Sample comment",
      "WorkFlowLinePendingUsers": [],
      "WorkFlowLineApprovedBy": [
        "User One on 01/01/2026 10:15:00 AM"
      ],
      "WorkFlowLineLastApprovedBy": "User One on 01/01/2026 10:15:00 AM",
      "WorkFlowLineSubmittedBy": "User One on 01/01/2026 10:15:00 AM"
    },
    {
 
      "ExpenseTransactionNumber": "00000002",
      "LegalEntity": "LE01",
      "ExpenseLineType": "Default",
      "TransactionDate": "01/01/2026 12:00:00 AM",
      "ApprovalStatus": "In review",
      "ApprovedDate": "",
      "Merchant": "Sample Merchant B",
      "TransactionAmount": "60,000.00 CUR",
      "NetTransactionAmount": "60,000.00 CUR",
      "CreatedBy": "User One",
      "CreatedDateAndTime": "01/01/2026 09:58:00 AM",
      "ReceiptAttached": 1,
      "Description": "Sample expense B",
      "PaymentMethod": "ADV SET",
      "CostOwner": 0,
      "ExpenseCategory": "Category B",
      "AdditionalInformation": "Line info B",
      "BudgetCode": "BC0001-Sample Budget",
      "BudgetOwner": "User One",
      "Department": "DEP01 , Sample Department",
      "Voucher": "",
      "LineNumber": 2.0,
      "WorkFlowLineLastComment": "",
      "WorkFlowLinePendingUsers": [
        "User One"
      ],
      "WorkFlowLineApprovedBy": [],
      "WorkFlowLineLastApprovedBy": "",
      "WorkFlowLineSubmittedBy": ""
    }
  ]
}
 
I have the same question (0)
  • Verified answer
    Sayali Profile Picture
    Microsoft Employee on at
    Hello,

    Custom Knowledge in Copilot Studio is retrieval-based and does NOT support dynamic parameter passing to external APIs. While some examples may suggest flexibility, the runtime only sends the interpreted user search query (free text), optional preprocessing content, and index metadata — not structured parameters.

    System variables like System.SearchQuery and System.KeywordSearchQuery contain only raw or compressed text, and System.SearchResults holds only the API response. Copilot does not extract domain-specific values (e.g., ExpNumber, DocumentId) before calling the Custom Knowledge endpoint. As a result, APIs receive only a simple query payload, and any parameter extraction must be handled outside Copilot.

     
    Recommended approaches:
    - Extract parameters directly inside your API (e.g., regex parsing).
    - Use Actions/API plugins instead of Custom Knowledge for native parameter extraction and structured API calls.
    - Use Topics with entity extraction and flows if structured parameters are required within Copilot.
    Custom Knowledge is designed for semantic retrieval and RAG scenarios — not transactional or parameterized API integrations.
     
  • Suggested answer
    Sayali Profile Picture
    Microsoft Employee on at
    Hello,
    If the response was helpful, could you please share your valuable feedback?
    Your feedback is important to us. Please rate us:

    🤩 Excellent 🙂 Good 😐 Average 🙁 Needs Improvement 😠 Poor

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Copilot Studio

#1
Valantis Profile Picture

Valantis 673

#2
chiaraalina Profile Picture

chiaraalina 170 Super User 2026 Season 1

#3
deepakmehta13a Profile Picture

deepakmehta13a 112

Last 30 days Overall leaderboard