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,...
Unanswered

How do I get a contact's account with Web API?

(0) ShareShare
ReportReport
Posted on by 15

I can get an account's contacts easily enough, with 

accounts?$select=name&$expand=contact_customer_accounts($select=contactid)

but how can I do the reverse? I can't seem to figure it out. I can do:

contacts?$select=firstname,lastname,emailaddress1,telephone1&$expand=account_primary_contact($select=name)

but this will only give me account info if the contact is a primary contact of that account. How do I get just the related account?

I would guess it's this, but this doesn't work:

contacts?$select=firstname,lastname,emailaddress1,telephone1&$expand=accounts($select=name)

Edit: I just found you can get the account id from `_parentcustomerid_value`, but this requires then a separate call to accounts(<accountid>) to get account info. There's got to be a better way, right?

I have the same question (0)
  • erhan.keskin Profile Picture
    2,253 on at

    Hi,

    Please use this instead;

    contacts?$select=firstname,lastname,emailaddress1,telephone1&$expand=parentcustomerid_account($select=name)

    Regards,

  • cloflyMao Profile Picture
    25,210 on at

    Hi Partner,

    If your contact's accounts means below:(in Related - Commons)

    pastedimage1571409308329v1.png

    then you could retrieve them with 

    https://org.crm.dynamics.com/api/data/v9.0/contacts(id)?$select=firstname,lastname&$expand=adx_account_created_by_portal_contact($select=name)

    pastedimage1571409450100v2.png

    The relationship is in contact's 1:N

    pastedimage1571409481759v3.png

    Regards,

    Clofly

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 182 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