> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenSession

> OpenSession in the ABBYY FlexiCapture Web Services API opens an Application Server connection for a valid role and station type, returning a session ID.

## What it does

Opens a connection to the Application Server.

<Note>
  You must specify a valid combination of roleType and stationType (i.e. the station you specify for a role must be accessible to that role). Otherwise the session will not be opened. For detailed information about roles and their accessible stations, see [Operators of ABBYY FlexiCapture](/flexi-capture/brief/operator-overview).
</Note>

## Definition

```
int OpenSession( int roleType, int stationType );
```

## Parameters

| **Name**    | **Type** | **Description**                                                                                                                |
| ----------- | -------- | ------------------------------------------------------------------------------------------------------------------------------ |
| roleType    | int      | The type of role to be used for the connection. See [RoleType](/flexi-capture/api/structures/t-role-type) for possible values. |
| stationType | int      | The type of connecting station. See [WorkstationType](/flexi-capture/api/structures/t-workstation-type) for possible values.   |

## Returned value

| **Type** | **Description**                 |
| -------- | ------------------------------- |
| int      | The ID of the opened connection |
