---
name: "mongoc_client_set_server_api"
section: "3"
platform: "linux"
package: "libmongoc-doc"
version: "1.30.4-1+deb13u3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/mongoc_client_set_server_api"
---

# mongoc\_client\_set\_server\_api(3)

## SYNOPSIS

```
bool
mongoc_client_set_server_api (mongoc_client_t *client,
                              const mongoc_server_api_t *api,
                              bson_error_t *error);
```

Set the API version to use for **client**. Once the API version is set on a client, it may not be changed to a new value. Attempting to do so will cause this method to fail and set **error**.

## PARAMETERS

- •

  **client**: A *mongoc\_client\_t*.

- •

  **api**: A *mongoc\_server\_api\_t*.

- •

  **error**: A *bson\_error\_t*.

## RETURNS

True if the version was successfully set, false if not. On failure, **error** will be set.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
