> For the complete documentation index, see [llms.txt](https://everyday-digital.gitbook.io/falkor-dev-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://everyday-digital.gitbook.io/falkor-dev-docs/stories/logs/story-logs-alpha-release.md).

# User Story Logs

The `logs/user-story-logs` endpoint is alternative to [`logs/story-logs`](/falkor-dev-docs/stories/logs/story-logs.md) endpoint. The main difference is the response output is broken down into users instead of stories. This endpoint is useful if you want to view story progress of particular users or groups of users.

### Parameters

| Key          | Type                        |
| ------------ | --------------------------- |
| **OPTIONAL** |                             |
| groups       | Array of strings            |
| emails       | Array of strings            |
| stories      | Array of strings            |
| app          | String  (e.g io.falkor.app) |

## Examples

### Fetch all logs

The example below retrieves all users and all story logs

```
curl -X POST \
  v1/story-analytics/logs \
  -H 'Authorization: Basic <Your Base64 Encoded Token>'
```

### Fetch logs for specific groups

The example below retrieves all users and stories for a given array of groups.

```
curl -X POST \
  v1/logs/user-story-logs \
  -H 'Authorization: Basic <Your Base64 Encoded Token>' \
  -d ' {
    "groups" : ["Group A","Group B",...etc]
  }'
```

### Fetch logs for specific stories

The example below retrieves all users for a given array of stories.

```
curl -X POST \
  logs/user-story-logs \
  -H 'Authorization: Basic <Your Base64 Encoded Token>' \
  -d ' {
    "stories" : ["Story 1","Story 2",...etc]
  }'
```

### Fetch logs for specific users

The example below retrieves logs users for a given array of emails.

```
curl -X POST \
  v1/logs/user-story-logs \
  -H 'Authorization: Basic <Your Base64 Encoded Token>' \
  -d ' {
    "emails" : ["one@example.com","two@example",...etc]
  }'
```

### Full Example

The example below retrieves logs for specific users & stories in certain groups.

```
curl -X POST \
  v1/logs/user-story-logs \
  -H 'Authorization: Basic <Your Base64 Encoded Token>' \
  -d ' {
    "groups" : ["Group A"],
    "stories" : ["Story 1","Story 2"],
    "emails" : ["one@example.com","two@example",...etc]
  }'
```

## Success Response

The response returns a list of users with a list of groups and stories completed or in progress.

```
{
    "status": "success",
    "data": {
        "users": [
            {
                "firstname": "Test",
                "lastname": "User",
                "email": "one@example.com",
                "groups": [
                    "Group A",
                    "Group B",
                    ...etc
                ],
                "rank": "7",
                "stories": [
                    {
                        "name": "Story 1",
                        "category": "Business",
                        "sku": "FA34-MMMV-61VD",
                        "type": "Survey",
                        "state": {
                            "complete": true,
                            "duration": 7,
                            "attempts": 1,
                            "started": "2020-09-08T13:10:36+02:00",
                            "updated": "2020-09-08T13:10:39+02:00"
                        }
                    },
                    {
                        "name": "Story 2",
                        "category": "Business",
                        "sku": "FA25-XSYK-20YL",
                        "type": "Assessment",
                        "state": {
                            "complete": true,
                            "score": 100,
                            "passed": true,
                            "duration": 4,
                            "attempts": 2,
                            "started": "2020-09-06T12:48:27+02:00",
                            "updated": "2020-09-06T12:48:30+02:00"
                        }
                    },
                    ...etc
                ]
            }
        ]
    },
    "hash": "bea7506b44e6a6804d3d8e09993c0382",
    "response_time": 0.15078997611999512
}
```

### User Object

The user object contains the users details, leaderboard rank, groups and stories completed.

| Key           | Type                  |
| ------------- | --------------------- |
| **firstname** | String                |
| **lastname**  | String                |
| **email**     | String                |
| **rank**      | String                |
| **groups**    | Array of strings      |
| **stories**   | Array of user stories |

### User Story Object

The story object contains the name, SKU, category, type and user's log

| Key          | Type   |
| ------------ | ------ |
| **name**     | String |
| **category** | String |
| **sku**      | String |
| **type**     | String |
| **state**    | Object |

### State Object

The state object contains the log information of the user's progress on the story.

{% hint style="info" %}
**Please Note:** Only assessment or stories that have assessment activities will have a passed and score parameter. Non-scoring stories such as surveys will not have these parameters.
{% endhint %}

| Key                           | Type                                                  |
| ----------------------------- | ----------------------------------------------------- |
| **FOR ALL STORY TYPES**       |                                                       |
| **complete**                  | Bool. If the story has been completed.                |
| **duration**                  | Int. Entire time spent on the story in seconds        |
| **attempts**                  | Int. Total attempts made.                             |
| **started**                   | String. Timestamp when the first attempt was started. |
| **updated**                   | String. Timestamp when the last attempt was updated.  |
| **SCORING BASED STORY TYPES** |                                                       |
| **score**                     | Float. Percentage scored                              |
| **passed**                    | Bool. If the pass mark was achieved.                  |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://everyday-digital.gitbook.io/falkor-dev-docs/stories/logs/story-logs-alpha-release.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
