Goals
GET https://trak.website/api/goals/
curl --request GET \
--url 'https://trak.website/api/goals/' \
--header 'Authorization: Bearer {api_key}' \
--url 'https://trak.website/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. |
| 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-02-26 02:57:50",
"last_datetime": null
},
],
"meta": {
"page": 1,
"results_per_page": 25,
"total": 1,
"total_pages": 1
},
"links": {
"first": "https://trak.website/api/goals?page=1",
"last": "https://trak.website/api/goals?page=1",
"next": null,
"prev": null,
"self": "https://trak.website/api/goals?page=1"
}
}
GET https://trak.website/api/goals/{goal_id}
curl --request GET \
--url 'https://trak.website/api/goals/{goal_id}' \
--header 'Authorization: Bearer {api_key}' \
--url 'https://trak.website/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-02-26 02:57:50",
"last_datetime": null
}
}
POST https://trak.website/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://trak.website/api/goals' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Example' \
--form 'chart_datetime=2026-02-26 02:57:50' \
--url 'https://trak.website/api/goals' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Example' \
--form 'chart_datetime=2026-02-26 02:57:50' \
{
"data": {
"id": 1
}
}
POST https://trak.website/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://trak.website/api/goals/{goal_id}' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Example' \
--form 'is_enabled=0' \
--url 'https://trak.website/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://trak.website/api/goals/{goal_id}
curl --request DELETE \
--url 'https://trak.website/api/goals/{goal_id}' \
--header 'Authorization: Bearer {api_key}' \
--url 'https://trak.website/api/goals/{goal_id}' \
--header 'Authorization: Bearer {api_key}' \