curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/reddit/audiences/ca.129482487242828/users \
-d '{"accountId": "a2_abcdefg", "schema": ["EMAIL"], "data": [["5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"]]}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/reddit/audiences/ca.129482487242828/users", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"accountId": "a2_abcdefg",
"schema": [
"EMAIL"
],
"data": [
[
"5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"
]
]
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY', 'Content-Type': 'application/json'}
payload = {
"accountId": "a2_abcdefg",
"schema": [
"EMAIL"
],
"data": [
[
"5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"
]
]
}
r = requests.post('https://api.ayrshare.com/api/ads/reddit/audiences/ca.129482487242828/users', json=payload, headers=headers)
print(r.json())
{
"status": "success",
"id": "ca.129482487242828",
"received": 1,
"invalid": 0,
"batches": 1
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "data[0][0] (EMAIL) is not a hash: expected 64 lowercase hex characters."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "id ca.129482487242999 is a website audience; members can be added to or removed from a customer-list audience only."
}
{
"action": "request",
"status": "error",
"code": 525,
"message": "The request body is too large. Please reduce the size of the request."
}
Reddit Ads
Audience Members
Add people to, or remove them from, a Reddit customer-list audience by sending SHA-256 hashes of their email or mobile advertising ID.
POST
/
ads
/
reddit
/
audiences
/
{id}
/
users
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/reddit/audiences/ca.129482487242828/users \
-d '{"accountId": "a2_abcdefg", "schema": ["EMAIL"], "data": [["5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"]]}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/reddit/audiences/ca.129482487242828/users", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"accountId": "a2_abcdefg",
"schema": [
"EMAIL"
],
"data": [
[
"5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"
]
]
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY', 'Content-Type': 'application/json'}
payload = {
"accountId": "a2_abcdefg",
"schema": [
"EMAIL"
],
"data": [
[
"5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"
]
]
}
r = requests.post('https://api.ayrshare.com/api/ads/reddit/audiences/ca.129482487242828/users', json=payload, headers=headers)
print(r.json())
{
"status": "success",
"id": "ca.129482487242828",
"received": 1,
"invalid": 0,
"batches": 1
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "data[0][0] (EMAIL) is not a hash: expected 64 lowercase hex characters."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "id ca.129482487242999 is a website audience; members can be added to or removed from a customer-list audience only."
}
{
"action": "request",
"status": "error",
"code": 525,
"message": "The request body is too large. Please reduce the size of the request."
}
Add people to a customer-list audience created with Create Audience (
type: customerList), or remove them. You send each person as SHA-256 hashes of their normalized identifiers; Reddit matches the hashes to accounts; the raw values never leave your system.
DELETE /ads/reddit/audiences/{id}/users takes the same body and removes the people instead.
- A list is usable in a boost once Reddit has matched at least 1,000 people. Audiences shows
status.readywhen it is. - Each request carries at most 10,000 rows and a body of at most 10 MiB. Send a larger list as several requests.
- If a request fails part way, the rows sent before the failure stay in the audience. Send the whole request again: adding someone who is already on the list changes nothing.
- The id must be a customer-list audience on the ad account named by
accountId. Any other id returns a400withcode: 101.
Hashed identifiers are personal data
A hashed email or advertising ID is still personal data under GDPR and similar laws. When you upload a list:- You are the data controller. You need a lawful basis, usually the consent of the people on the list, to use their data for advertising, as your privacy policy and Reddit’s advertising policies require.
- Ayrshare is a processor. We pass the hashes to Reddit and keep nothing but the counts: no row of the body is logged, cached or stored, and the response never echoes a row.
- You hash before sending. Ayrshare never hashes for you. A value that is not a hash is refused before anything is sent to Reddit.
How to hash
Normalize each value the way Reddit’s customer list guide describes, then hash it with SHA-256 and send the result as 64 lowercase hex characters. In short:EMAIL: trim spaces and lowercase, for examplejane@example.com.MADID: the device’s mobile advertising ID (Google’s GAID or Apple’s IDFA).
Header Parameters
Path Parameters
The customer-list audience id, from Create Audience or Audiences.
Body Parameters
The identifier in each column, in order:
EMAIL, MADID, or both. These are the same names Facebook audiences use. Other keys return a 400 with code: 101.One row per person: an array with one SHA-256 hash per
schema column, as 64 lowercase hex characters. At most 10,000 rows.A cell that is not such a hash, a row of the wrong width, or an unsupported key returns a 400 with code: 101 before anything is sent to Reddit. The message names the row and column, never the value, for example data[1][0] (EMAIL) is not a hash: expected 64 lowercase hex characters.Response
Counts only:received: rows Reddit took.invalid: always0on Reddit. Reddit does not report rows it could not match. Matches show later in the audience’ssizeandstatusin Audiences.batches: how many uploads the rows were sent in. Reddit takes 2,500 rows per upload.
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/reddit/audiences/ca.129482487242828/users \
-d '{"accountId": "a2_abcdefg", "schema": ["EMAIL"], "data": [["5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"]]}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/reddit/audiences/ca.129482487242828/users", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"accountId": "a2_abcdefg",
"schema": [
"EMAIL"
],
"data": [
[
"5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"
]
]
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY', 'Content-Type': 'application/json'}
payload = {
"accountId": "a2_abcdefg",
"schema": [
"EMAIL"
],
"data": [
[
"5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"
]
]
}
r = requests.post('https://api.ayrshare.com/api/ads/reddit/audiences/ca.129482487242828/users', json=payload, headers=headers)
print(r.json())
{
"status": "success",
"id": "ca.129482487242828",
"received": 1,
"invalid": 0,
"batches": 1
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "data[0][0] (EMAIL) is not a hash: expected 64 lowercase hex characters."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "id ca.129482487242999 is a website audience; members can be added to or removed from a customer-list audience only."
}
{
"action": "request",
"status": "error",
"code": 525,
"message": "The request body is too large. Please reduce the size of the request."
}