# IRPCWOPIOperationsPublic.GetWOPIUserSessionKey

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Server integration API](https://developer.m-files.com/APIs/gRPC-API/integration/index.md) > [WOPI operations (anonymous)](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperationsPublic/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperationsPublic/GetWOPIUserSessionKey/

Badges: `Server integration API / specialized` `internal: not for applications` `write` `no session`

Exchanges a one-time token for the WOPI user session token it stands for.

- **Service:** [WOPI operations (anonymous)](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperationsPublic/index.md) `MFiles.IRPCWOPIOperationsPublic`
- **gRPC method:** `/MFiles.IRPCWOPIOperationsPublic/GetWOPIUserSessionKey`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/get-wopiuser-session-key`
- **Request:** [`GetWOPIUserSessionKeyRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperationsPublic/GetWOPIUserSessionKey/index.md#request)
- **Response:** [`GetWOPIUserSessionKeyResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperationsPublic/GetWOPIUserSessionKey/index.md#response)
- **Book and level:** Server integration API, specialized
- **Kind:** write
- **Session:** Not needed: the call can be made before logging in.
- **Idempotent:** no
- **Returns metadata structure version:** no
- **Streaming:** none (unary)

<a id="remarks"></a>

## Remarks

**For M-Files components only.** M-Files Web calls it when its WOPI page is opened with a
one-time token in the URL. Applications should not call it.
- Authorized by the one-time token, which expires 5 minutes after it was created. The token is
  cleared after a successful exchange and cannot be used again.

<a id="request"></a>

## Request: GetWOPIUserSessionKeyRequest

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `pwszkey` | `string` | The one-time token from [CreateWOPIUserSession](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperations/CreateWOPIUserSession/index.md) with `WOPITOKEN_TYPE_ONE_TIME_TOKEN`. |

<a id="response"></a>

## Response: GetWOPIUserSessionKeyResponse

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `wopi_key` | `string` | The WOPI user session token. |

<a id="related"></a>

## Related methods

- [GetWOPIUserSession](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperationsPublic/GetWOPIUserSession/index.md): Gets the details of a WOPI user session: the shared object and file version, the action, the user and whether editing is allowed.
