const res = await fetch("https://api.openrevenue.com/api/v1/projects/example.com/goals?period=30d", {
headers: { Authorization: `Bearer ${SESSION_TOKEN}` },
})
const { goals } = await res.json()
curl "https://api.openrevenue.com/api/v1/projects/example.com/goals?period=30d" \
-H "Authorization: Bearer session_token"
{
"period": "30d",
"goals": [
{
"id": "g1",
"name": "Signups",
"type": "event",
"value": "signup",
"target": 100,
"category": "conversion",
"direction": "up",
"format": "number",
"current": 42,
"conversionRate": 0.12
}
]
}
Goals
Returns project goals with current stats for the period. Prefer a session Bearer token — API keys may receive an empty goals list because the underlying action is session-only.
GET
/
api
/
v1
/
projects
/
{domain}
/
goals
const res = await fetch("https://api.openrevenue.com/api/v1/projects/example.com/goals?period=30d", {
headers: { Authorization: `Bearer ${SESSION_TOKEN}` },
})
const { goals } = await res.json()
curl "https://api.openrevenue.com/api/v1/projects/example.com/goals?period=30d" \
-H "Authorization: Bearer session_token"
{
"period": "30d",
"goals": [
{
"id": "g1",
"name": "Signups",
"type": "event",
"value": "signup",
"target": 100,
"category": "conversion",
"direction": "up",
"format": "number",
"current": 42,
"conversionRate": 0.12
}
]
}
Response
Errors
| Status | Error | Description |
|---|---|---|
401 | Invalid or missing API key | The Authorization header is missing or the Bearer token is invalid. |
404 | Project not found | No project with that domain exists for the authenticated user. |
const res = await fetch("https://api.openrevenue.com/api/v1/projects/example.com/goals?period=30d", {
headers: { Authorization: `Bearer ${SESSION_TOKEN}` },
})
const { goals } = await res.json()
curl "https://api.openrevenue.com/api/v1/projects/example.com/goals?period=30d" \
-H "Authorization: Bearer session_token"
{
"period": "30d",
"goals": [
{
"id": "g1",
"name": "Signups",
"type": "event",
"value": "signup",
"target": 100,
"category": "conversion",
"direction": "up",
"format": "number",
"current": 42,
"conversionRate": 0.12
}
]
}
Was this page helpful?