> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/connectors/mariadb-connector-c/mariadb-binlogreplication-api-reference/replication-api-function-reference.md).

# Replication API Function Reference

The Binlog/Replication API provides a low‑level interface for consuming and processing binary log events from a MariaDB server. It allows applications to configure replication handles, open streams, fetch and decode events, and manage errors.

Together, these functions enable developers to build custom replication clients and event processing tools.

## Function Overview

| Function                                                                                                                                                                    | Description                                                     |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| [`mariadb_rpl_init()` ](/docs/connectors/mariadb-connector-c/mariadb-binlogreplication-api-reference/replication-api-function-reference/mariadb_rpl_init.md)                | Allocates and initializes a replication handle                  |
| [`mariadb_rpl_optionsv()`](/docs/connectors/mariadb-connector-c/mariadb-binlogreplication-api-reference/replication-api-function-reference/mariadb_rpl_optionsv.md)         | Sets options on a replication handle                            |
| [`mariadb_rpl_get_optionsv()`](/docs/connectors/mariadb-connector-c/mariadb-binlogreplication-api-reference/replication-api-function-reference/mariadb_rpl_get_optionsv.md) | Retrieves the current value of a replication handle option      |
| [`mariadb_rpl_open()`](/docs/connectors/mariadb-connector-c/mariadb-binlogreplication-api-reference/replication-api-function-reference/mariadb_rpl_open.md)                 | Opens a binary log stream and registers the client as a replica |
| [`mariadb_rpl_fetch()`](/docs/connectors/mariadb-connector-c/mariadb-binlogreplication-api-reference/replication-api-function-reference/mariadb_rpl_fetch.md)               | Fetches the next event from a binary log stream                 |
| [`mariadb_free_rpl_event()`](/docs/connectors/mariadb-connector-c/mariadb-binlogreplication-api-reference/replication-api-function-reference/mariadb_free_rpl_event.md)     | Frees memory allocated for an event                             |
| [`mariadb_rpl_extract_rows()`](/docs/connectors/mariadb-connector-c/mariadb-binlogreplication-api-reference/replication-api-function-reference/mariadb_rpl_extract_rows.md) | Extracts a list of rows from a row event                        |
| [`mariadb_rpl_errno()`](/docs/connectors/mariadb-connector-c/mariadb-binlogreplication-api-reference/replication-api-function-reference/mariadb_rpl_errno.md)               | Returns the error number for the last Binlog API call           |
| [`mariadb_rpl_error()`](/docs/connectors/mariadb-connector-c/mariadb-binlogreplication-api-reference/replication-api-function-reference/mariadb_rpl_error.md)               | Returns the error message for the last Binlog API call          |
| [`mariadb_rpl_close()`](/docs/connectors/mariadb-connector-c/mariadb-binlogreplication-api-reference/replication-api-function-reference/mariadb_rpl_close.md)               | Closes a binary log stream and frees the replication handle     |

## See Also

* [MariaDB Binlog/Replication API Reference](/docs/connectors/mariadb-connector-c/mariadb-binlogreplication-api-reference.md)
* [Replication API Types and Definitions](/docs/connectors/mariadb-connector-c/mariadb-binlogreplication-api-reference/replication-api-types-and-definitions.md)
* [Replication API Function Reference](/docs/connectors/mariadb-connector-c/mariadb-binlogreplication-api-reference/replication-api-function-reference.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://mariadb.com/docs/connectors/mariadb-connector-c/mariadb-binlogreplication-api-reference/replication-api-function-reference.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.
