> Documentation index: https://docs.zernio.com/llms.txt. Every page is also Markdown: add .md to its URL.

# Targeting

Target Reddit ads by location, gender, language, interest, subreddit, conversation keyword and custom audience, and search Reddit's targeting catalog.

The targeting fields go on [`POST /v1/ads/create`](/platforms/reddit-ads/create-ads), inside `targeting` on a [boost](/platforms/reddit-ads/boost), and in `targeting` on `PUT /v1/ads/{adId}` ([Manage ads](/platforms/reddit-ads/manage-ads)).

## Targeting fields

| Field | Reddit targeting | Values from |
|-------|------------------|-------------|
| `countries` | Locations | ISO country codes. With no location at all, the ad targets `US` |
| `regions`, `metros`, `cities`, `zips` | Locations | `{ "key": "..." }` from targeting search, `dimension=geo` |
| `excludedLocations` | Excluded locations | `countries`, `regions`, `cities` and `zips` only; other shapes return `400` |
| `gender` | Gender | `all`, `male` or `female` |
| `languages` | Languages | Language codes such as `en` or `de` |
| `targeting.interests` | Interests | `{ "id": "..." }` from targeting search, `dimension=interest` |
| `audienceInclude`, `audienceExclude` | Custom audiences | Reddit custom audience ids, created through Zernio or in Reddit Ads Manager |
| `targeting.communities`, `targeting.excludedCommunities` | Subreddits | Subreddit names, with or without `r/`; from targeting search, `dimension=community` |
| `targeting.conversationKeywords`, `targeting.excludedConversationKeywords` | Conversation keywords | Free text; suggestions from targeting search, `dimension=conversationKeyword` |

Age, income, behaviors, radius and every other targeting field return `400` naming the field, because Reddit has no slot for them.

`POST /v1/ads/audiences` on a `redditads` account creates customer list and website audiences. Names need at least 3 characters.

Add and remove people with `POST` and `DELETE /v1/ads/audiences/{audienceId}/users`. Reddit matches on email only. Audiences built in Reddit Ads Manager are targeted by id too.

## Find targeting values

`GET /v1/ads/targeting/search` with the `redditads` `accountId` searches Reddit's own catalog ([Search ad targeting](/ad-targeting/search-ad-targeting)).

It takes `dimension` set to `geo`, `interest`, `community` or `conversationKeyword`; any other dimension returns `400`.

On `geo`, `geoType` is `city` (the default), `zip`, `region`, `metro_area`, `country` or `all`, and `countryCode` narrows the search to one country.

<Tabs items={['Node.js', 'Python', 'curl']}>
<Tab value="Node.js">
```typescript
const { data: search } = await zernio.adtargeting.searchAdTargeting({
  query: { accountId: '66b2e19d8c3f5a7e9d0b1c2d', q: 'gaming', dimension: 'community' }
});

const subreddits = search.results.map((result) => result.id);
```
</Tab>
<Tab value="Python">
```python
search = client.ad_targeting.search_ad_targeting(
    account_id="66b2e19d8c3f5a7e9d0b1c2d",
    q="gaming",
    dimension="community",
)

subreddits = [result["id"] for result in search["results"]]
```
</Tab>
<Tab value="curl">
```bash
curl "https://zernio.com/api/v1/ads/targeting/search?accountId=66b2e19d8c3f5a7e9d0b1c2d&q=gaming&dimension=community" \
  -H "Authorization: Bearer $ZERNIO_API_KEY"
```
</Tab>
</Tabs>

A community result's `id` is the subreddit name to send in `targeting.communities`, with the subscriber count in `audienceSize`.

Geo results carry the Reddit location id as `id` (send it as `key`), and interest results the interest id with its category in `path`.

## If it fails

| Error | Cause | Fix |
|-------|-------|-----|
| `400` naming a targeting field | Age, income, behaviors, radius or another field Reddit has no slot for | Remove the field. |
| `400` on `excludedLocations` | A shape other than `countries`, `regions`, `cities` or `zips` | Exclude by country, region, city or zip only. |
| `400` with `param: "dimension"` | A search dimension other than the four Reddit takes | Search `geo`, `interest`, `community` or `conversationKeyword`. |

## Related

- [Search ad targeting](/ad-targeting/search-ad-targeting): locations, interests, subreddits and keywords.
- [Create a campaign](/platforms/reddit-ads/create-ads): the request these fields go on.
- [Promote a post](/platforms/reddit-ads/boost): targeting inside the `targeting` object.
- [Manage ads](/platforms/reddit-ads/manage-ads): replace an ad group's targeting.