# Profiles - Goals

## Goals Overview&#x20;

Dashboard widget

<mark style="color:blue;">`GET`</mark> `‎https://<domain>/<api prefix>/<version>/profiles/overview/`

This endpoint will return goals overview data (dashboard widget).

#### Query Parameters

| Name        | Type   | Description |
| ----------- | ------ | ----------- |
| profile\_id | string | Profile Id  |

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | Apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

{% tabs %}
{% tab title="200 " %}

```markup
HTTP/1.1 200 OK
Content-Type: application/json

Body:
{
    "status_code": 200,
    "errors": {},
    "data": {
        "user_goals": {
            "<goal_key>": {
                "period": "<period>",
                "maximum": <maximum>,
                "minimum": <minimum>,
                "display_name": "<display_name>",
                "currency_code": "<currency_code>",
                "current": <current>,
                "percentage": <percentage>,
                "difference": <difference>
            },
            ...
        },
        "eligibleforupdate": <eligibleforupdate_status>,
        "profiles": [
            {
                "id": <profile_id>,
                "profilename": "<profile_name>"
            },
            ...
        ]
    }
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```javascript
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://<domain>/<api prefix>/<version>/profiles/overview/',
  'headers': {
    'apikey': '<apikey>',
    'api-signature': '<api-signature>',
    'Authorization': 'Bearer <access token>',
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

#### PHP

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/profiles/overview/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'api-signature: <api-signature>',
    'Authorization: Bearer <access token>',
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

## User Goals Leaderboard

<mark style="color:blue;">`GET`</mark> `‎https://<domain>/<api prefix>/<version>/profiles/user/goals-leaderboard/`

This API endpoint will return user goal leaderboard data.

#### Query Parameters

| Name    | Type   | Description  |
| ------- | ------ | ------------ |
| profile | string | profile id   |
| goal    | string | goal keyword |

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | Apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

{% tabs %}
{% tab title="200 " %}

```markup
HTTP/1.1 200 OK
Content-Type: application/json

Body:
{
    "status_code": 200,
    "errors": {},
    "data": {
        "courseList": [
            {
                thumbnail: "<thumbnail>",
                duration: <duration>,
                title: "<title>",
                short_description: "<short_description>",
                detail_url: "<detail_url>"
            },
            ...
        ],
        "goals": {
            "<goal_key>": {
                "period": "<period>",
                "maximum": <maximum>,
                "minimum": <minimum>,
                "display_name": "<display_name>",
                "currency_code": "<currency_code>"
            },
            ...
        },
        "selected_goal": "<selected_goal_keyword>",
        "selected_profile": <selected_profile_id>,
        "profiles_leader_board_data": {
            "<user_id>": {
                "name": "<name>",
                "level": <level>,
                "overall": <overall>,
                "percentage": <percentage>,
                "image": "<profile_image>"
            },
            ...
        },
        "goal_leader_board_user_data": {
            "<user_id>": {
                "value": <value>,
                "image": "<profile_image>",
                "firstname": "<firstname>",
                "surname": "<surname>",
                "percentage": <percentage>
            },
            ...
        },
        "current_goal_info": {
            "<goal_keyword>": {
                "period": "<period>",
                "maximum": <maximum>,
                "minimum": <minimum>,
                "display_name": "<display_name>",
                "currency_code": "<currency_code>",
                "current": <current>,
                "percentage": <percentage>,
                "difference": <difference>
            }
        },
        "goal_status": {
            "goal": "<max_goal_value>",
            "achieved": "<achieved_value>",
            "status_text": "<status_text>"
        },
        "current_goal_details": {
            "variants": [
                {
                    "step": "<step>",
                    "active_link": "<active_link>",
                    "recommended_course": "<recommended_course>",
                    "recommended_article": "<recommended_article>"
                },
                ...
            ]
        },
        "profiles": [
            {
                "id": <profil_id>,
                "profilename": "<profile_name>"
            },
            ...
        ]
    }
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```javascript
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://<domain>/<api prefix>/<version>/profiles/user/goals-leaderboard/',
  'headers': {
    'apikey': '<apikey>',
    'api-signature': '<api-signature>',
    'Authorization': 'Bearer <access-token>',
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/profiles/user/goals-leaderboard/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'api-signature: <api-signature>',
    'Authorization: Bearer <access-token>',
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

#### Error Responses

| Status Code | Error Type       | Field   | Description           |
| ----------- | ---------------- | ------- | --------------------- |
| 400         | Validation Error | profile | Invalid profile id.   |
| 400         | Validation Error | goal    | Invalid goal keyword. |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api.epixelsoftware.help/profiles-goals.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
