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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Dynamics365 - Rest API - Credential Access

(0) ShareShare
ReportReport
Posted on by 5

Hello,

 I am trying to build some APIs to populate or update contact records in our CRM. we generated credentials in our Azure AD environment. Were able to use the client/secret keys to generate our bearer token, but the API calls are getting a 401 error. I was hoping you had some insights into what permissions are required for that endpoint credential to access the CRM platform to run Get/Post/Patch calls. When we created the endpoint we had to give it roles/assignments but we weren't sure what exactly to give it. I think this is the root of the 401 error.

Example API is as follows:


customer.crm.dynamics.com/.../contacts

customer.api.crm.dynamics.com/.../candidates

customer.crm.dynamics.com/.../candidates

Hoping to get insights into what are the appropriate roles/responsibilities in AZURE AD to run these types of commands.

Thank you,

Ted Woods

I have the same question (0)
  • Suggested answer
    Guido Preite Profile Picture
    54,086 Moderator on at

    are you sure you did all the steps for the clientid-clientsecret? including the assignment of a security role? here you can find a tutorial

    benediktbergmann.eu/.../

    where are you getting the 401 error?

    if inside postman try to generate the request using my tool Dataverse REST Builder and after export the collection to postman, when you export you can set the authentication to your clientid-clientsecret

  • TedWoods1848 Profile Picture
    5 on at

    I am using OneTrust our Privacy Management Solution:

    HTTP operation failed invoking https://***Customer***.api.crm.dynamics.com/api/data/v9.2/candidates with statusCode: 401

  • Suggested answer
    Guido Preite Profile Picture
    54,086 Moderator on at

    you can use any software you want to call the API, but you have two problems:

    1) the bearer token needs to be valid, and you can verify it with postman

    2) the query to Dynamics needs to be valid, in your example that endpoint I am 99,99% sure that is not valid because "candidates" endpoint does not exists (maybe is prefix_candidates) and for that you can use Dataverse REST Builder to build the query.

    hope it helps

  • TedWoods1848 Profile Picture
    5 on at

    1) Bearer token generates properly

    2) there is prefix ahead of candidates, I was anonymizing our API call.

    Thanks

  • Guido Preite Profile Picture
    54,086 Moderator on at

    then try if the request works inside Postman, if works inside Postman then contact the support of OneTrust (because the problem looks like not connected to Dynamics). If doesn't work inside Postman it means the Bearer token is not correct.

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 Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 180 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 123

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans