Using Fiddler I found that the Experience Profile (which shows each pattern in each profile with a percentage match) calls this API route:
http://[hostname]/sitecore/api/ao/v1/contacts/[contactid]/intel/profile-pattern-matches/[profileid]/?&pageSize=10&pageNumber=1&sort=PatternGravityShare%20desc&visitId=[visitid]
contactid is obviously the ID of the contact
profileid is the ID of the profile you're after
visitId is the ID of the last visit you want to include in the call
That gives you back some JSON, similar to:
{
"<Sort>k__BackingField":[
{
"<Direction>k__BackingField":2,
"<Field>k__BackingField":"PatternGravityShare"
}
],
"<Filter>k__BackingField":[
],
"<Messages>k__BackingField":[
],
"<PageSize>k__BackingField":10,
"<PageNumber>k__BackingField":1,
"<TotalResultCount>k__BackingField":2,
"<Data>k__BackingField":{
"<Dataset>k__BackingField":{
"profile-pattern-matches":[
{
"ContactId":"23cf560d-77df-43e4-ac8c-36d34ef55ef7",
"LatestVisitId":"1ed2718a-ff18-44aa-b8f2-2c2beb799a00",
"ProfileId":"b000189d-de2f-473f-817f-7006254f047e",
"PatternId":"8a1c3791-3f6c-4d17-bac7-56f041faf66c",
"PatternDisplayName":"Gamer",
"PatternGravityShare":0.84728744130282752
},
{
"ContactId":"23cf560d-77df-43e4-ac8c-36d34ef55ef7",
"LatestVisitId":"1ed2718a-ff18-44aa-b8f2-2c2beb799a00",
"ProfileId":"b000189d-de2f-473f-817f-7006254f047e",
"PatternId":"05943b7f-795d-4954-ae8a-af039814d139",
"PatternDisplayName":"Business person",
"PatternGravityShare":0.15271255869717254
}
]
},
"<Lookups>k__BackingField":{
}
}
}
In this, you're probably most likely after the 'PatternGravityShare', where the highest number is the 'winning' pattern.
For your use case, you might have to loop through all profiles and find the pattern with the highest 'PatternGravityShare'.