Goals
GET https://metrix.utilityhub.co/api/goals/
curl --request GET \
--url 'https://metrix.utilityhub.co/api/goals/' \
--header 'Authorization: Bearer {api_key}' \
--url 'https://metrix.utilityhub.co/api/goals/' \
--header 'Authorization: Bearer {api_key}' \
| Parameters | Details | Description |
|---|---|---|
| website_id | Optional Integer | |
| type | Optional String | Allowed values: pageview, custom |
| search | Optional String | The search string. |
| search_by | Optional String | What field are you searching by. Allowed values are: name, path, key. |
| datetime_field | Optional String | Allowed values: datetime, last_datetime |
| datetime_start | Optional String | Filter results starting from this datetime. Y-m-d H:i:s format. |
| datetime_end | Optional String | Filter results up to this datetime. Y-m-d H:i:s format. |
| order_by | Optional String | What field to order the results by. Allowed values are: goal_id, last_datetime, datetime, name, path, key. |
| order_type | Optional String | The ordering of the results. Allowed values are: ASC for ascending ordering, and DESC for descending ordering. |
| page | Optional Integer | The page number that you want results from. Defaults to 1. |
| results_per_page | Optional Integer | How many results you want per page. Allowed values are: 10, 25, 50, 100, 250, 500, 1000. Defaults to 25. |
{
"data": [
{
"id": 1,
"website_id": 1,
"user_id": 1,
"key": "123456789",
"type": "custom",
"path": null,
"name": "Example",
"datetime": "2026-04-15 01:28:39",
"last_datetime": null
},
],
"meta": {
"page": 1,
"results_per_page": 25,
"total": 1,
"total_pages": 1
},
"links": {
"first": "https://metrix.utilityhub.co/api/goals?page=1",
"last": "https://metrix.utilityhub.co/api/goals?page=1",
"next": null,
"prev": null,
"self": "https://metrix.utilityhub.co/api/goals?page=1"
}
}
GET https://metrix.utilityhub.co/api/goals/{goal_id}
curl --request GET \
--url 'https://metrix.utilityhub.co/api/goals/{goal_id}' \
--header 'Authorization: Bearer {api_key}' \
--url 'https://metrix.utilityhub.co/api/goals/{goal_id}' \
--header 'Authorization: Bearer {api_key}' \
{
"data": {
"id": 1,
"website_id": 1,
"user_id": 1,
"key": "123456789",
"type": "custom",
"path": null,
"name": "Example",
"datetime": "2026-04-15 01:28:39",
"last_datetime": null
}
}
POST https://metrix.utilityhub.co/api/goals
| Parameters | Details | Description |
|---|---|---|
| website_id | Required Integer | - |
| type | Required String | Allowed values: pageview, custom |
| name | Required String | - |
| path | Optional String | Available when: type = pageview |
| key | Optional String | - |
curl --request POST \
--url 'https://metrix.utilityhub.co/api/goals' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Example' \
--form 'chart_datetime=2026-04-15 01:28:39' \
--url 'https://metrix.utilityhub.co/api/goals' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Example' \
--form 'chart_datetime=2026-04-15 01:28:39' \
{
"data": {
"id": 1
}
}
POST https://metrix.utilityhub.co/api/goals/{goal_id}
| Parameters | Details | Description |
|---|---|---|
| website_id | Optional Integer | - |
| type | Optional String | Allowed values: pageview, custom |
| name | Optional String | - |
| path | Optional String | Available when: type = pageview |
| key | Optional String | - |
curl --request POST \
--url 'https://metrix.utilityhub.co/api/goals/{goal_id}' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Example' \
--form 'is_enabled=0' \
--url 'https://metrix.utilityhub.co/api/goals/{goal_id}' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Example' \
--form 'is_enabled=0' \
{
"data": {
"id": 1
}
}
DELETE https://metrix.utilityhub.co/api/goals/{goal_id}
curl --request DELETE \
--url 'https://metrix.utilityhub.co/api/goals/{goal_id}' \
--header 'Authorization: Bearer {api_key}' \
--url 'https://metrix.utilityhub.co/api/goals/{goal_id}' \
--header 'Authorization: Bearer {api_key}' \