how to debug the API call in Microsoft Copilot studio REst AIP connector?

Jukka Hekanaho 0 Reputation points
2026-03-04T13:46:32.4866667+00:00

I am getting the error: connectorRequestFailureThe connector 'FMP Final - demo2' returned an HTTP error with code 401..

How Can I review the exact API call details?

Microsoft Copilot | Microsoft 365 Copilot | Development
0 comments No comments

1 answer

Sort by: Oldest
  1. AI answer

    2026-03-04T13:46:46.3833333+00:00

    A 401 in a Copilot Studio REST/API connector means the downstream API rejected the request as unauthorized. Copilot Studio itself doesn’t surface the full raw HTTP request, so debugging focuses on:

    1. Verify and tighten connector inputs
      • Open the agent in Copilot Studio.
      • If the connector is configured as an agent-wide action:
        1. Go to Agents → select the agent.
        2. Select Actions → choose the connector action (for example, your REST action).
        3. Select Inputs and review values such as URL, headers (Authorization, API keys, etc.), and body.
      • If the connector is used in a topic-specific action:
        1. Go to Agents → select the agent.
        2. Select Topics → open the topic that calls the connector.
        3. On the topic canvas, select the connector node.
        4. Under Inputs, check the parameters that are mapped from user input.
        5. Select Advanced inputs to review additional headers, query parameters, or body fields.
      • Ensure the Authorization header or other auth parameters are correctly set and not empty or malformed.
    2. Reproduce the call outside Copilot Studio To see the exact HTTP behavior, reproduce the same request with a tool such as curl or Postman:
      • Take the URL, HTTP method, headers, and body from the connector configuration.
      • Run a curl command similar to:
             curl -i -X <HTTP_METHOD> \
               -H "Accept: application/json" \
               -H "User-Agent: azure-data-factory/2.0" \
               -H "Authorization: <your token or key>" \
               -H "<any-other-header>: <value>" \
               -d '<HTTP body>' \
               <URL>
        
      • If curl also returns 401, the issue is with the API’s auth configuration (token, key, client ID/secret, or scope), not Copilot Studio. Fix it until curl returns 200, then mirror the working values back into the connector configuration.
    3. Check the API’s own logs
      • Use the logging/monitoring of the target API (for example, Application Insights for Azure Functions or your web API) to see incoming requests and why they were rejected.
      • Specifically look for 401/403 entries and error messages such as “invalid token,” “signature validation failed,” or “missing API key.”
    4. Common 401 causes to verify
      • Expired or invalid access token or API key.
      • Wrong audience/scope in the token.
      • Missing required header (for example, Authorization, Ocp-Apim-Subscription-Key, or a custom header).
      • Endpoint URL mismatch (calling a different environment or path than the one the token/key is valid for).

    Because Copilot Studio doesn’t expose a raw trace of the outbound HTTP call, the practical way to “see” the exact call is to:

    • Mirror the connector configuration into an external HTTP client (curl/Postman).
    • Use the target API’s logging to inspect the received request and error details.

    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.