Get a key
In the Wefluence app, open Settings (Pengaturan), then API key, and create a new key. Tick the permissions you need. The key is shown only once, so save it as an environment variable right away.
export WEFLUENCE_API_KEY="wfb_live_xxxxxxxx"setx WEFLUENCE_API_KEY "wfb_live_xxxxxxxx"Want to try it without touching real data? Ask hello@wefluence.id for a wfb_test_ key that reads a sample account.
Check the connection
Call /v1/me to make sure your key works.
curl https://api.wefluence.app/v1/me \
-H "Authorization: Bearer $WEFLUENCE_API_KEY"import os, requests
headers = {"Authorization": f"Bearer {os.environ['WEFLUENCE_API_KEY']}"}
print(requests.get("https://api.wefluence.app/v1/me", headers=headers).json())const headers = { Authorization: `Bearer ${process.env.WEFLUENCE_API_KEY}` };
const res = await fetch("https://api.wefluence.app/v1/me", { headers });
console.log(await res.json());If it works, you get the account name and remaining quota:
Response
{
"object": "account",
"brand": { "name": "Brand Name" },
"key": {
"label": "Marketing dashboard",
"mode": "live",
"scopes": ["campaigns:read", "content:read"],
"expires_at": "2027-11-02T00:00:00.000Z"
},
"quota": { "per_minute": 60, "per_day": 5000, "used_today": 1 }
}List campaigns
curl "https://api.wefluence.app/v1/campaigns?status=active" \
-H "Authorization: Bearer $WEFLUENCE_API_KEY"r = requests.get(
"https://api.wefluence.app/v1/campaigns",
headers=headers,
params={"status": "active"},
)
campaigns = r.json()["data"]const res = await fetch("https://api.wefluence.app/v1/campaigns?status=active", { headers });
const { data: campaigns } = await res.json();List content
Use a campaign id from the previous step.
curl "https://api.wefluence.app/v1/campaigns/abc123/content?status=approved" \
-H "Authorization: Bearer $WEFLUENCE_API_KEY"r = requests.get(
f"https://api.wefluence.app/v1/campaigns/{campaigns[0]['id']}/content",
headers=headers,
params={"status": "approved"},
)
for item in r.json()["data"]:
print(item["url"], item["views"]["verified"])const url = `https://api.wefluence.app/v1/campaigns/${campaigns[0].id}/content?status=approved`;
const { data } = await (await fetch(url, { headers })).json();
data.forEach((item) => console.log(item.url, item.views.verified));