Unable to Retrieve Direct Line Token from Copilot Studio Web Application Channel – "RouteNotFound"

Nathan 10 Reputation points
2025-05-13T07:37:53.58+00:00

Hi everyone,

I'm currently trying to integrate a Microsoft Copilot Studio bot into a custom web application. The bot is:

  • Published from Copilot Studio (Power Platform)
  • Has "Secure access required" enabled
  • Does not use authentication (no Azure AD, open to all channels)

In the Web Application channel, I copied the Connection string that looks like this:

https://{ENV}.environment.api.powerplatform.com/copilotstudio/dataverse-backed/authenticated/bots/cr405_copilotAssistant/conversations?api-version=2022-03-01-preview

According to this Microsoft documentation, calling that endpoint should return a Direct Line token.

However, when I perform a GET request (in browser or curl), I get the following error:

{
  "code": "RouteNotFound",
  "message": "The request URI does not match any known API routes."
}

I’ve also tried:

  • POST and GET requests with and without headers
  • Reviewing both Web Application and Mobile Application channels — neither token endpoint worked as expected

I’m confused because:

  • Example URLs from Microsoft documentation (like the one with /directline/token?api-version=2022-03-01-preview) do return a valid token
  • My environment URL and bot ID are different, and the /conversations endpoint seems invalid

Any help would be highly appreciated — I’ve been stuck trying all combinations.

Thanks in advance!

Microsoft Copilot | Other

2 answers

Sort by: Most helpful
  1. Karan Shewale 2,585 Reputation points Microsoft External Staff
    2025-05-19T07:05:26.7566667+00:00

    Hi Nathan,

    Thanks for reaching out! The error you're seeing ("RouteNotFound") is happening because the /conversations endpoint you're using isn’t meant to return a Direct Line token.

    To resolve this, please use the following endpoint instead:

    POST https://{ENV}.environment.api.powerplatform.com/copilotstudio/directline/token?api-version=2022-03-01-preview
    

    Also, make sure to include this header in your request:

    Authorization: Bearer <your_web_channel_secret>
    

    You can find the secret in your Copilot Studio Web Application channel settings.

    For reference, here are some helpful documents:

    Best regards,

    Karan Shewale.

    *************************************************************************  

    If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate. 

    Was this answer helpful?


  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

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.