
Client library for interacting with the Notion API, offering coroutine-based, blocking, and future-based flavors. Facilitates OAuth support, pagination, content creation with DSL, and configurable logging/proxy settings.
A Notion API client library for Kotlin and Java.
This library is written in Kotlin Multiplatform and can be used from the JVM (Kotlin and Java), Android, and MacOS native.
Several flavors of the client are available to match your needs:
suspend) based:
the default client for Kotlin projectsFuture based (JVM only):
useful for Java projectsThe artifact is hosted on the Maven Central repository.
dependencies {
implementation("org.jraf:klibnotion:2.0.0")
}The easiest way to see how to use it is to look at the samples:
You can also explore the reference doc.
You will find your Internal Integration Token by following the instructions here.
val notionClient = NotionClient.newInstance(
ClientConfiguration(
Authentication(TOKEN)
)
)To get other flavors of the client (Java):
BlockingNotionClient blockingClient = BlockingNotionClientUtils.asBlockingNotionClient(notionClient);
FutureNotionClient futureClient = FutureNotionClientUtils.asFutureNotionClient(notionClient);
The client gives access to several API areas:
Each area exposes related APIs, for instance:
notionClient.pages.getPage.
The APIs that are paginated all follow the same principle:
Pagination
object as a parameter, which defines the page to retrieveResultPage<T>
with the result list but also a reference to the next Pagination objects (handy when retrieving several pages).A small DSL is available on the page creation API, here's an example usage:
NotionClient
with a
null Authentication.oAuth.getUserPromptUri
to get a URI that will prompt users to agree to add your integration to their workspaceoAuth.extractCodeAndStateFromRedirectUri
to extract the code from this URI.oAuth.getAccessToken
NotionClient is updated with the token so you can now make authenticated calls. Securely save the token so you
can pass it to the authentication next time you build your NotionClient.See the sample for a working example.
To log HTTP requests/response, pass a
HttpConfiguration
to
NotionClient.newInstance().
Several levels
are available: NONE, INFO, HEADERS, BODY and ALL
A proxy can be configured by passing a
HttpConfiguration
to
NotionClient.newInstance().
2026-03-11 version of the Notion API.Note: this project is not officially related to or endorsed by Notion.
Copyright (C) 2021-present Benoit 'BoD' Lubek (BoD@JRAF.org)
and contributors (https://github.com/BoD/klibnotion/graphs/contributors)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
A Notion API client library for Kotlin and Java.
This library is written in Kotlin Multiplatform and can be used from the JVM (Kotlin and Java), Android, and MacOS native.
Several flavors of the client are available to match your needs:
suspend) based:
the default client for Kotlin projectsFuture based (JVM only):
useful for Java projectsThe artifact is hosted on the Maven Central repository.
dependencies {
implementation("org.jraf:klibnotion:2.0.0")
}The easiest way to see how to use it is to look at the samples:
You can also explore the reference doc.
You will find your Internal Integration Token by following the instructions here.
val notionClient = NotionClient.newInstance(
ClientConfiguration(
Authentication(TOKEN)
)
)To get other flavors of the client (Java):
BlockingNotionClient blockingClient = BlockingNotionClientUtils.asBlockingNotionClient(notionClient);
FutureNotionClient futureClient = FutureNotionClientUtils.asFutureNotionClient(notionClient);
The client gives access to several API areas:
Each area exposes related APIs, for instance:
notionClient.pages.getPage.
The APIs that are paginated all follow the same principle:
Pagination
object as a parameter, which defines the page to retrieveResultPage<T>
with the result list but also a reference to the next Pagination objects (handy when retrieving several pages).A small DSL is available on the page creation API, here's an example usage:
NotionClient
with a
null Authentication.oAuth.getUserPromptUri
to get a URI that will prompt users to agree to add your integration to their workspaceoAuth.extractCodeAndStateFromRedirectUri
to extract the code from this URI.oAuth.getAccessToken
NotionClient is updated with the token so you can now make authenticated calls. Securely save the token so you
can pass it to the authentication next time you build your NotionClient.See the sample for a working example.
To log HTTP requests/response, pass a
HttpConfiguration
to
NotionClient.newInstance().
Several levels
are available: NONE, INFO, HEADERS, BODY and ALL
A proxy can be configured by passing a
HttpConfiguration
to
NotionClient.newInstance().
2026-03-11 version of the Notion API.Note: this project is not officially related to or endorsed by Notion.
Copyright (C) 2021-present Benoit 'BoD' Lubek (BoD@JRAF.org)
and contributors (https://github.com/BoD/klibnotion/graphs/contributors)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.