Looking at the documentation it is (should be) possible to use the &idProperty={unique_field} parameter in the query string, when getting a company. Thus: /crm/v3/objects/companies/microsoft.com?idProperty=domain should return the company with the domain “microsoft.com”.
However, it returns 404 in all cases. I also tried without “.” and URL encoding the “.” charaters - with same result.
Excerpt from the API documentation:
Read an Object identified by {companyId}. {companyId} refers to the internal object ID by default, or optionally any unique property value as specified by the idProperty query param. Control what is returned via the properties query param.
Is this a bug?
Hey, @michaelrandrup
I do not believe this is a bug. It appears to work as designed, but not as we expect.
There is no documentation for this, so I am extrapolating a bit here.
- Domain is an “old” property in HubSpot
- Domain is a “unique identifier” for deduplication of the Company object
- The ability to set a Property as “has unique value” is a much newer feature
- If we query the Company property — Domain, in the Properties API, we can see the “hasUniqueValue” flag is set to false — “hasUniqueValue”: false
- This seems to be the root issue, the missing flag
One question, for testing purposes, have you tried creating a custom single-line-text property, adding an example URL to a Company, and then trying to use the custom property in your query?
Best,
Jaycee
Thanks for your reply Jaycee!
No, creating a unique custom property would be the next test (Which would probably work as per your explanation). As a workaround I am simply using the “Search API” instead - but, I just find it strange since “domain” is inherently a unique property, like “email” on the Contact object, that it cannot be used in the newest Company API.
Regards
Michael
Hey, @michaelrandrup
I agree on weirdness. I expected it to work as well. And you already addressed my other suggestion, the Search API 
Thanks for the update. Have a great day! — Jaycee