# Creating a session on behalf of the user

## Step 1: Create SessionServer

Before creating notification filters, you need to establish a `SessionServer` using the `token_value` obtained when the `PartnerUserProvision` becomes active.

**Endpoint:**

```http
POST /v1/session-server
```

**Request Body:**

```json
{ 
    "secret": "<credential.token_value_from_created_provision>" 
}
```

The `token_value` is obtained from the credential object when the `PartnerUserProvision` status becomes `CREATED` and subStatus = `PENDING_PROCESS_USER_ONBOARDING` (as shown in Chapter 2).

**Response:**

```json
{
    "Response": [
        {
            "Id": {
                "id": 2173
            }
        },
        {
            "Token": {
                "id": 2173,
                "created": "2025-08-13 15:53:11.594918",
                "updated": "2025-08-13 15:53:11.594918",
                "token": "f981bd6d26b8328b89e85a774c404bb02e72d18062dab92bb59c9e59a1c5958f"
            }
        },
        {
            "UserApiKey": {
                "id": 1364,
                "created": "2025-08-13 15:53:11.286445",
                "updated": "2025-08-13 15:53:11.286445",
                "requested_by_user": {
                    "UserCompany": {
                        "id": 1360,
                        "display_name": "Surrey Coöperatie",
                        "public_nick_name": "Surrey Coöperatie",
                        "avatar": {...},
                        "session_timeout": 604800
                    }
                },
                "granted_by_user": {
                    "UserPerson": {
                        "id": 1363,
                        "display_name": "New bunqer",
                        "public_nick_name": "New bunqer",
                        "avatar": {...},
                        "session_timeout": 604800
                    }
                }
            }
        }
    ]
}
```

* `Id`: Session ID for authentication
* `Token`: Session token for API calls
* `UserApiKey`: Information about the API key relationship between the partner (`requested_by_user`) and the provisioned user (`granted_by_user`)

Save the session ID for subsequent API calls to the provisioned user's endpoints.


---

# 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://doc.bunq.com/user-provisioning/chapter-3-onboarding/creating-a-session-on-behalf-of-the-user.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.
