How can we get an ownerId of the currently logged in user?
Context: we are creating engagements and notice that in HubSpot web UI newly created engagements are automatically assigned current user as owner (the one, whose name is in the top right corner). But, when api is used, the ownerId is null and not automatically assigned.
How can we get the same ownerId of the current user, that would be assigned to engagement through UI?
We currently have found this endpoint:
/oauth/v1/access-tokens/{token}
which in its response contains userId :
{
...
"user_id": 27106345
...
}
However, owner endpoints (from both new and oldapi) seem to not be able to find owner by user_id.
V3 api: /crm/v3/owners/27106345
V2 api: /owners/v2/owners/27106345
Both return error not found.
However if we request all owners through:
/crm/v3/owners/?limit=500
We can find owner with that user_id and there we can also find field 'id' (ownerId)
This seems to work but it is very inefficient, since, as far as I'm concerned, HubSpot has unlimited number of users and owner's pagination is 500 (which indicates just how many owners there can be).