lads_get_audience_count
LinkedIn Ads read low risk
Part of the LinkedIn Audience Agent.
What it does
Estimates the addressable audience size for a targeting definition via GET /rest/audienceCounts?q=targetingCriteriaV2, before any campaign is created. Accepts included_facets/excluded_facets ([{facet_urn, entity_urns}], entity URNs from the resolver tools) plus locations, builds the targetingCriteria=(include:(and:List(...))) expression, and returns LinkedIn's AudienceCount elements: total (rounded approximation; 0 when the audience is under 300, by privacy design) and active (members more likely to be on LinkedIn). ACCURACY NOTES: estimates are directional and fluctuate; total is a rounded approximation whose coarseness scales with segment size. HARD-WARN that any audience LinkedIn reports as <300 (returned as total:0) will NOT serve; also flag too-narrow (<50K) or too-broad (>5M). Any MDP-approved app may call this with any 3-legged token (no extra OAuth scope). A read/preview used to right-size targeting before the create flow.
When to use it
During a full account audit, start with lads_audit_account — it defines the checks, benchmarks, and severity rules this tool's data feeds.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
included_facets | array<{facet_urn, entity_urns[]}> | yes | Targeting facets to include (e.g. industries, seniorities, titles, skills), each {facet_urn, entity_urns[]} ({facet, entities} also accepted); an item without a facet is refused. Entity URNs from lads_get_targeting_entities; serialized into targetingCriteria include AND/OR groups. facet_urn may be a URN or a short name ('skills'); URNs may be plain or already percent-encoded — Scalix encodes each exactly once. |
excluded_facets | array<{facet_urn, entity_urns[]}> | no | Facets to exclude. Age and gender are refused (LinkedIn refuses them in exclude on every campaign). Also subject to anti-discrimination rules you apply — no protected-attribute exclusion for employment/housing/education/credit; no Groups exclusion in those verticals. |
locations | array<urn:li:geo> | no | Geo URNs (urn:li:geo:{id}) from lads_list_geo_locations, sent under the locations facet; plain or already percent-encoded (Scalix encodes each exactly once). |
Safeguards
Policy
Estimating reach is read-only, but the targeting it validates must comply: for employment/housing/education/credit ads do not include/exclude protected attributes (age targeting is off for recruitment); audiences under 300 members will not serve (LinkedIn reports total:0 by privacy design) and must be flagged, not silently launched.
Reminder
Sub-300 audiences won't serve (total returns 0); apply anti-discrimination rules to any included/excluded facet.
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
INVALID_TARGETING_CRITERIA | targetingCriteria is malformed or references an unknown facet/entity URN (surfaced verbatim; LinkedIn may return 'Invalid query parameters passed to request'). | Re-resolve entities via the resolver tools and fix the criteria. Do not guess URNs. | no |
PROTECTED_ATTRIBUTE_TARGETING | Targeting includes/excludes a protected attribute disallowed for this ad vertical (employment/housing/education/credit). | Remove protected-attribute facets; for recruitment, age targeting is disabled. Blocked before the call. | no |
TOKEN_REVOKED | Token expired/revoked (HTTP 401). | Refresh once and retry; else needs_reauth. | yes |
PERMISSION_DENIED | App is not approved for the Marketing API Program, or token is not a valid 3-legged token (HTTP 403). Note: no extra OAuth scope is required for this endpoint. | Ensure the app is MDP-approved and a valid 3-legged token is used. | no |
RATE_LIMITED | Daily quota exceeded (HTTP 429). | Exponential backoff 5/10/20s cap 60s honoring X-RateLimit-Reset. | yes |
PLATFORM_UNAVAILABLE | LinkedIn returned a 5xx. | Retry with backoff. | yes |
Edge cases
- LinkedIn returns total:0 for any audience under 300 (privacy floor) -> success, but a loud warning that the audience will NOT serve (it is not an empty/error result).
- Estimate < 50K -> warn 'too narrow'; > 5M -> warn 'too broad'.
- Counts are rounded approximations and fluctuate between calls — present as approximate, not exact; coarseness scales with audience size.
- Over-constrained AND of facets can yield total:0 with guidance to loosen.
- Age or gender in excluded_facets is refused before the call (protected_attribute_targeting): LinkedIn refuses them in exclude targeting on every campaign (probe 1 Oct 2026). The other protected-attribute rules depend on the ad's vertical, which a count does not know, so they are yours to apply.
- URNs may be plain or already percent-encoded; Scalix encodes each exactly once (an unencoded URN would 400 with 'Invalid query parameters').
- Response also includes active (members more likely to be on LinkedIn) which is <= total.