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

# PFMultiplayerCreateAndClaimServerLobby

> PFMultiplayerCreateAndClaimServerLobby reference for creating a new server-owned PlayFab lobby as a game_server entity through the PlayFab Multiplayer C++ SDK.

Create a new lobby as a game\_server entity.

## Syntax

```cpp theme={null}
HRESULT PFMultiplayerCreateAndClaimServerLobby(  
    PFMultiplayerHandle handle,  
    const PFEntityKey* server,  
    const PFLobbyCreateConfiguration* createConfiguration,  
    void* asyncContext,  
    PFLobbyHandle* lobby  
)  
```

### Parameters

**`handle`**   PFMultiplayerHandle

The handle of the PFMultiplayer API instance.

**`server`**   [PFEntityKey\*](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmultiplayer/pfentitykey_clientsdk.md)

The PlayFab Entity Key of the game server creating the lobby. It's entity type must be "game\_server".

**`createConfiguration`**   [PFLobbyCreateConfiguration\*](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbycreateconfiguration.md)

The initial configuration data used when creating the lobby.

**`asyncContext`**   void\*\
*optional*

An optional, app-defined, pointer-sized context value that can be used to associate the completion state change with this call.

**`lobby`**   PFLobbyHandle\*\
*optional, library-allocated output*

The optional, output lobby object which can be used to queue operations for immediate execution of this operation completes.

### Return value

Type: HRESULT

`S_OK` if the call succeeded or an error code otherwise. The human-readable form of the error code can be retrieved via [PFMultiplayerGetErrorMessage()](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmultiplayer/functions/pfmultiplayergeterrormessage.md).

## Remarks

To use this feature, you must define PFMULTIPLAYER\_INCLUDE\_SERVER\_APIS before including PFLobby.h. \
\
&#x20;This is an asynchronous operation. Upon successful completion, the title will be provided a [PFLobbyCreateAndClaimServerLobbyCompletedStateChange](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbycreateandclaimserverlobbycompletedstatechange.md) with the [PFLobbyCreateAndClaimServerLobbyCompletedStateChange::result](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbycreateandclaimserverlobbycompletedstatechange.md) field set to `S_OK`. Upon a failed completion, the title will be provided a [PFLobbyCreateAndClaimServerLobbyCompletedStateChange](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbycreateandclaimserverlobbycompletedstatechange.md) with the [PFLobbyCreateAndClaimServerLobbyCompletedStateChange::result](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbycreateandclaimserverlobbycompletedstatechange.md) field set to a failure.

## Requirements

**Header:** PFLobby.h

## See also

[PFLobby members](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/pflobby_members.md)


## Related topics

- [Create a lobby](https://docs.xbox.com/services/playfab/multiplayer/lobby/create-a-lobby.md)
- [PFLobbyGetLobbyProperty](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pflobbygetlobbyproperty.md)
- [PFLobbyGetLobbyPropertyKeys](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pflobbygetlobbypropertykeys.md)
- [Game Servers and Lobbies](https://docs.xbox.com/services/playfab/multiplayer/lobby/lobby-server-overview.md)
- [PFLobbyGetMembers](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pflobbygetmembers.md)
