Skip to main content

Affinities

Returns the affinities found by the search, if any.

You can search for b2b, brands, influencers, interest, media, personas, private.

note

The children field is actually an array of affinity objects, not an array of strings.

Getting Started

URL REQUEST (GET)
https://api.statsocial.com/platform/v0/affinities

The query URL parameter searches an affinity by its name or ID.

https://api.statsocial.com/platform/v0/affinities?query=xxx

When using the parent_id URL parameter, the API will return the children of that affinity.

https://api.statsocial.com/platform/v0/affinities?parent_id=xxx

The rollups_only URL parameter only accepts two values: true and false. The default value is false

https://api.statsocial.com/platform/v0/affinities?rollups_only=xxx

When using it, only category affinities will be returned. i.e. affinities where the is_category field is true.

note

Let's use the data in this section when creating audiences

Let's go to examples

Query

In this first example we will look for affinities related to Lewandowski

https://api.statsocial.com/platform/v0/affinities?query=Lewandowski

We will receive a json like this

{
"response": [
{
"id": ".b2b.",
"name": "B2B",
"is_category": true,
"can_add": false,
"kind": "affinity"
},
{
"id": ".brands.",
"name": "Brands",
"is_category": true,
"can_add": false,
"kind": "affinity"
},
{
"id": ".influencers.",
"name": "Influencers",
"is_category": true,
"can_add": false,
"kind": "affinity",
"children": [
{
"id": "a197",
"name": "Sports",
"is_category": true,
"followers_count": 238080000,
"can_add": true,
"kind": "affinity",
"children": [
{
"id": "a759",
"name": "Soccer",
"is_category": true,
"followers_count": 120750000,
"can_add": true,
"kind": "affinity",
"children": [
{
"id": "a38802",
"name": "Robert Lewandowski",
"is_category": false,
"followers_count": 420000,
"can_add": true,
"is_match": true,
"kind": "affinity"
}
]
}
]
}
]
},
{
"id": ".interests.",
"name": "Interests",
"is_category": true,
"can_add": false,
"kind": "affinity"
},
{
"id": ".media.",
"name": "Media",
"is_category": true,
"can_add": false,
"kind": "affinity"
},
{
"id": ".personas.",
"name": "Personas",
"is_category": true,
"can_add": false,
"kind": "affinity"
},
{
"id": ".private.",
"name": "Private",
"is_category": true,
"can_add": false,
"kind": "affinity"
}
],
"information": {
"version": "0.0.1"
}
}

Parent ID

When searching for Robert Lewandowski we can see that he is a child of the Sports category, we can find other affinities of this category using directly the parent_id of the category, which in this case is a197, would look like this.

https://api.statsocial.com/platform/v0/affinities?parent_id=a197

We will receive a json like this

{
"response": [
{
"id": "a721",
"name": "Agent",
"is_category": true,
"followers_count": 160000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a722",
"name": "Australian_football",
"is_category": true,
"followers_count": 930000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a723",
"name": "Auto_racing",
"is_category": true,
"followers_count": 14810000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a724",
"name": "Baseball",
"is_category": true,
"followers_count": 11910000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a725",
"name": "Basketball",
"is_category": true,
"followers_count": 55860000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a726",
"name": "Billiards_snooker",
"is_category": true,
"followers_count": 50000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a727",
"name": "Bodybuilding",
"is_category": true,
"followers_count": 2840000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a728",
"name": "Boxing",
"is_category": true,
"followers_count": 22400000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a729",
"name": "Cricket",
"is_category": true,
"followers_count": 8580000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a730",
"name": "Curling",
"is_category": true,
"followers_count": 30000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a731",
"name": "Cycling",
"is_category": true,
"followers_count": 4070000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a111884",
"name": "Dancing",
"is_category": true,
"followers_count": 2190000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a732",
"name": "Diving",
"is_category": true,
"followers_count": 2290000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a733",
"name": "Fencing",
"is_category": true,
"followers_count": 40000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a734",
"name": "Field_hockey",
"is_category": true,
"followers_count": 70000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a736",
"name": "Figure_skating",
"is_category": true,
"followers_count": 1910000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a111971",
"name": "Fishing / Hunting",
"is_category": true,
"followers_count": 650000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a737",
"name": "Fitness",
"is_category": true,
"followers_count": 11400000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a738",
"name": "Football",
"is_category": true,
"followers_count": 50920000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a739",
"name": "Gambling_betting",
"is_category": true,
"followers_count": 1860000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a740",
"name": "Golf",
"is_category": true,
"followers_count": 9220000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a741",
"name": "Gymnastics",
"is_category": true,
"followers_count": 5570000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a742",
"name": "Handball",
"is_category": true,
"followers_count": 20000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a743",
"name": "Horse_racing",
"is_category": true,
"followers_count": 160000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a744",
"name": "Ice_hockey",
"is_category": true,
"followers_count": 5130000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a745",
"name": "Inline_skating",
"is_category": true,
"followers_count": 100000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a746",
"name": "Journalist_broadcaster",
"is_category": true,
"followers_count": 15410000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a735",
"name": "Martial Arts / Fighting",
"is_category": true,
"followers_count": 21250000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a747",
"name": "Motorcycle_racing",
"is_category": true,
"followers_count": 6280000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a748",
"name": "Mountaineering",
"is_category": true,
"followers_count": 250000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a749",
"name": "NASCAR",
"is_category": true,
"followers_count": 4030000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a750",
"name": "Olympic_athlete",
"is_category": true,
"followers_count": 4330000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a767",
"name": "Other",
"is_category": true,
"followers_count": 36480000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a751",
"name": "Pro_wrestling",
"is_category": true,
"followers_count": 13010000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a752",
"name": "Rowing",
"is_category": true,
"followers_count": 470000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a753",
"name": "Rugby",
"is_category": true,
"followers_count": 3240000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a754",
"name": "Runner",
"is_category": true,
"followers_count": 870000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a755",
"name": "Sailing",
"is_category": true,
"followers_count": 80000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a756",
"name": "Skateboarding",
"is_category": true,
"followers_count": 12660000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a757",
"name": "Skiing",
"is_category": true,
"followers_count": 2660000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a758",
"name": "Snowboarding",
"is_category": true,
"followers_count": 2300000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a759",
"name": "Soccer",
"is_category": true,
"followers_count": 120750000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a760",
"name": "Softball",
"is_category": true,
"followers_count": 510000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a761",
"name": "Speed_skating",
"is_category": true,
"followers_count": 290000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a762",
"name": "Stuntman",
"is_category": true,
"followers_count": 800000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a763",
"name": "Surfing",
"is_category": true,
"followers_count": 5570000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a764",
"name": "Swimming",
"is_category": true,
"followers_count": 3760000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a765",
"name": "Tennis",
"is_category": true,
"followers_count": 20870000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a501410",
"name": "Track & Field",
"is_category": true,
"followers_count": 7000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a249430",
"name": "Uncategorized",
"is_category": true,
"followers_count": 32620000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a766",
"name": "Volleyball",
"is_category": true,
"followers_count": 370000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a485007",
"name": "Weightlifting",
"is_category": true,
"followers_count": 30000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a382770",
"name": "Yoga",
"is_category": true,
"followers_count": 210000,
"can_add": true,
"kind": "affinity"
}
],
"information": {
"version": "0.0.1"
}
}

Rollups Only

You can use rollups_only to filter by categories only

https://api.statsocial.com/platform/v0/affinities?rollups_only=true

We will receive a json like this

{
"response": [
{
"id": ".b2b.",
"name": "B2B",
"is_category": true,
"can_add": false,
"kind": "affinity"
},
{
"id": ".brands.",
"name": "Brands",
"is_category": true,
"can_add": false,
"kind": "affinity"
},
{
"id": ".influencers.",
"name": "Influencers",
"is_category": true,
"can_add": false,
"kind": "affinity"
},
{
"id": ".interests.",
"name": "Interests",
"is_category": true,
"can_add": false,
"kind": "affinity"
},
{
"id": ".media.",
"name": "Media",
"is_category": true,
"can_add": false,
"kind": "affinity"
},
{
"id": ".personas.",
"name": "Personas",
"is_category": true,
"can_add": false,
"kind": "affinity"
},
{
"id": ".private.",
"name": "Private",
"is_category": true,
"can_add": false,
"kind": "affinity"
}
],
"information": {
"version": "0.0.1"
}
}

With this answer, we can use the id of the B2B category, which would be .b2b., to find the categories that belong to it, as in the example below

https://api.statsocial.com/platform/v0/affinities?parent_id=.b2b.

We will receive a json like this

{
"response": [
{
"id": "a180126",
"name": "Accounting/Finance",
"is_category": true,
"followers_count": 1720000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180116",
"name": "Administrative",
"is_category": true,
"followers_count": 1650000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180143",
"name": "Arts/Entertainment/Publishing",
"is_category": true,
"followers_count": 2180000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180162",
"name": "Banking/Loans",
"is_category": true,
"followers_count": 220000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180132",
"name": "Computer/Internet",
"is_category": true,
"followers_count": 1510000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180417",
"name": "Construction/Facilities",
"is_category": true,
"followers_count": 160000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180145",
"name": "Customer Service",
"is_category": true,
"followers_count": 130000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180107",
"name": "Education/Training",
"is_category": true,
"followers_count": 770000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180111",
"name": "Engineering/Architecture",
"is_category": true,
"followers_count": 800000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180224",
"name": "Government/Military",
"is_category": true,
"followers_count": 40000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180153",
"name": "Healthcare",
"is_category": true,
"followers_count": 180000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180191",
"name": "Hospitality/Travel",
"is_category": true,
"followers_count": 110000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180134",
"name": "Human Resources",
"is_category": true,
"followers_count": 100000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180118",
"name": "Insurance",
"is_category": true,
"followers_count": 30000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180123",
"name": "Law Enforcement/Security",
"is_category": true,
"followers_count": 180000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180109",
"name": "Legal",
"is_category": true,
"followers_count": 970000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180218",
"name": "Manufacturing/Mechanical",
"is_category": true,
"followers_count": 140000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180120",
"name": "Marketing/Advertising/PR",
"is_category": true,
"followers_count": 1230000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180229",
"name": "Non-Profit/Volunteering",
"is_category": true,
"followers_count": 180000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180150",
"name": "Pharmaceutical/Bio-Tech",
"is_category": true,
"followers_count": 80000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180220",
"name": "Real Estate",
"is_category": true,
"followers_count": 660000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180215",
"name": "Restaurant/Food Service",
"is_category": true,
"followers_count": 90000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180282",
"name": "Retail",
"is_category": true,
"followers_count": 190000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180113",
"name": "Sales",
"is_category": true,
"followers_count": 790000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180201",
"name": "Telecommunications",
"is_category": true,
"followers_count": 4060000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180165",
"name": "Transportation/Logistics",
"is_category": true,
"followers_count": 120000,
"can_add": true,
"kind": "affinity"
},
{
"id": "a180105",
"name": "Upper Management/Consulting",
"is_category": true,
"followers_count": 5640000,
"can_add": true,
"kind": "affinity"
}
],
"information": {
"version": "0.0.1"
}
}