> ## Documentation Index
> Fetch the complete documentation index at: https://www.openrevenue.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

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

**domain** `string` *required*

Your project's domain, e.g. `example.com`.

**period** `string`

Page period: today, 7d, 30d, 6m, or 12m. Defaults to 30d.

## Response

**period** `string`

Resolved reporting period.

**goals\[].id** `string`

Goal identifier.

**goals\[].name** `string`

Goal display name.

**goals\[].type** `string`

Goal type (event, pageview, traffic, engagement, revenue, …).

**goals\[].value** `string`

Matching value for the goal type (e.g. event name or path).

**goals\[].target** `number | null`

Optional target value.

**goals\[].category** `string`

Goal category such as conversion, traffic, engagement, or revenue.

**goals\[].current** `number`

Current metric value for the period.

**goals\[].conversionRate** `number | null`

Conversion rate for conversion goals; null otherwise.

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

```javascript JavaScript theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
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()
```

```bash cURL theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
curl "https://api.openrevenue.com/api/v1/projects/example.com/goals?period=30d" \
  -H "Authorization: Bearer session_token"
```

```json 200 theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
{
  "period": "30d",
  "goals": [
    {
      "id": "g1",
      "name": "Signups",
      "type": "event",
      "value": "signup",
      "target": 100,
      "category": "conversion",
      "direction": "up",
      "format": "number",
      "current": 42,
      "conversionRate": 0.12
    }
  ]
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.