# Quickstart

Call the Wefluence API for the first time in 5 minutes.

## 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.

```bash
export WEFLUENCE_API_KEY="wfb_live_xxxxxxxx"
```
```powershell
setx WEFLUENCE_API_KEY "wfb_live_xxxxxxxx"
```
Want to try it without touching real data? Ask [hello@wefluence.id](mailto: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.

```bash
curl https://api.wefluence.app/v1/me \
  -H "Authorization: Bearer $WEFLUENCE_API_KEY"
```
```python
import os, requests

headers = {"Authorization": f"Bearer {os.environ['WEFLUENCE_API_KEY']}"}
print(requests.get("https://api.wefluence.app/v1/me", headers=headers).json())
```
```javascript
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:

```json
{
  "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

```bash
curl "https://api.wefluence.app/v1/campaigns?status=active" \
  -H "Authorization: Bearer $WEFLUENCE_API_KEY"
```
```python
r = requests.get(
    "https://api.wefluence.app/v1/campaigns",
    headers=headers,
    params={"status": "active"},
)
campaigns = r.json()["data"]
```
```javascript
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.

```bash
curl "https://api.wefluence.app/v1/campaigns/abc123/content?status=approved" \
  -H "Authorization: Bearer $WEFLUENCE_API_KEY"
```
```python
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"])
```
```javascript
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));
```
## Next steps

- [Daily sync](https://docs.wefluence.app/en/guides/daily-sync/): Pull every page and store it without duplicates.
- [What the numbers mean](https://docs.wefluence.app/en/data/): Understand views, engagement, and amounts paid.
- [API reference](https://docs.wefluence.app/en/reference/): See every endpoint and its parameters.
