Skip to main content

Type-safe Python SDK for the AppFlowy Cloud REST API

Project description

AppFlowy SDK

Type-safe Python SDK for the AppFlowy Cloud REST API.

Installation

pip install appflowysdk
# or
uv add appflowysdk

Quick Start

from appflowysdk import AppFlowy

with AppFlowy(email="user@example.com", password="password") as client:
    # Authenticate
    token = client.login()
    print(f"Logged in, token expires in {token.expires_in}s")

    # List workspaces
    workspaces = client.get_workspaces(include_member_count=True)
    for ws in workspaces:
        print(f"{ws.workspace_name} ({ws.workspace_id})")

    # Get folder structure
    folder = client.get_workspace_folder(workspaces[0].workspace_id)

    # List databases
    databases = client.get_databases(workspaces[0].workspace_id)

    # Get database fields
    fields = client.get_database_fields(
        workspaces[0].workspace_id, databases[0].id
    )

    # Get row IDs
    rows = client.get_database_row_ids(
        workspaces[0].workspace_id, databases[0].id
    )

    # Get row details
    if rows:
        details = client.get_database_row_details(
            workspaces[0].workspace_id,
            databases[0].id,
            [rows[0].id],
            with_doc=True,
        )

    # Create a row
    row_id = client.create_database_row(
        workspaces[0].workspace_id,
        databases[0].id,
        cells={"field_id": "value"},
    )

    # Upsert a row
    row_id = client.upsert_database_row(
        workspaces[0].workspace_id,
        databases[0].id,
        pre_hash="unique-key",
        cells={"field_id": "value"},
    )

Document APIs

New helpers cover document collabs, pages, quick notes, search, publishing, and imports. See docs/documents.md for details.

workspace_id = "workspace-uuid"
object_id = "object-uuid"
parent_view_id = "parent-view-uuid"
encoded_collab = "encoded-collab"
zip_bytes = b"..."

with AppFlowy(email="user@example.com", password="password") as client:
    client.create_collab(workspace_id, object_id, encoded_collab)
    collab = client.get_collab(workspace_id, object_id)
    page = client.create_page(workspace_id, parent_view_id, name="My Page")
    note = client.create_quick_note(workspace_id, "Idea", "Draft text")
    results = client.search_documents(workspace_id, "meeting notes")
    client.publish_page(workspace_id, page.view_id)
    client.import_zip(zip_bytes)

OAuth

client = AppFlowy()
token = client.oauth_redirect_token(
    code="auth_code_from_redirect",
    grant_type="authorization_code",
)

Error Handling

All SDK errors inherit from AppFlowyError:

from appflowysdk.exceptions import (
    AppFlowyError,
    LoginError,
    RefreshTokenError,
    APIError,
    ValidationError,
    NetworkError,
)

API Reference

Method Endpoint Description
login() POST /gotrue/token?grant_type=password Password auth
refresh_token() POST /gotrue/token?grant_type=refresh_token Refresh token
oauth_redirect_token() GET /web-api/oauth-redirect/token OAuth token exchange
get_workspaces() GET /api/workspace List workspaces
get_workspace_folder() GET /api/workspace/{id}/folder Get folder tree
get_databases() GET /api/workspace/{id}/database List databases
get_database_fields() GET /api/workspace/{id}/database/{id}/fields List fields
get_database_row_ids() GET /api/workspace/{id}/database/{id}/row List row IDs
create_database_row() POST /api/workspace/{id}/database/{id}/row Create row
upsert_database_row() PUT /api/workspace/{id}/database/{id}/row Upsert row
get_database_row_ids_updated() GET /api/workspace/{id}/database/{id}/row/updated Updated rows
get_database_row_details() GET /api/workspace/{id}/database/{id}/row/detail Row details
create_collab() POST /api/workspace/{id}/collab/{object_id} Create collab
update_collab() PUT /api/workspace/{id}/collab/{object_id} Update collab
get_collab() GET /api/workspace/{id}/collab/{object_id} Get collab
get_collab_json() GET /api/workspace/v1/{id}/collab/{object_id}/json Get collab JSON
batch_create_collab() POST /api/workspace/{id}/batch/collab Bulk create collabs
full_sync_collab() POST /api/workspace/v1/{id}/collab/{object_id}/full-sync Full document sync
web_update_collab() POST /api/workspace/v1/{id}/collab/{object_id}/web-update Web client update
create_page() POST /api/workspace/{id}/page-view Create page
get_page() GET /api/workspace/{id}/page-view/{view_id} Get page
append_page_blocks() POST /api/workspace/{id}/page-view/{view_id}/append-block Append blocks
create_orphaned_view() POST /api/workspace/{id}/orphaned-view Create orphaned view
duplicate_page() POST /api/workspace/{id}/page-view/{view_id}/duplicate Duplicate page
create_quick_note() POST /api/workspace/{id}/quick-note Create quick note
list_quick_notes() GET /api/workspace/{id}/quick-note List quick notes
search_documents() GET /api/search/{id} Search documents
publish_page() POST /api/workspace/{id}/page-view/{view_id}/publish Publish page
unpublish_page() POST /api/workspace/{id}/page-view/{view_id}/unpublish Unpublish page
import_zip() POST /api/import Import ZIP archive
create_import_task() POST /api/import/create Create import task

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

appflowysdk-0.1.3.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

appflowysdk-0.1.3-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file appflowysdk-0.1.3.tar.gz.

File metadata

  • Download URL: appflowysdk-0.1.3.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for appflowysdk-0.1.3.tar.gz
Algorithm Hash digest
SHA256 5b4fbda045db4df603473adafdbc93139476c155c0a5ccc4d0df3f527721a154
MD5 f49553f155609d9268b33b15b90d110f
BLAKE2b-256 d9e86298264e0e2b1d31ce818fa28c145a90f0f4f06b6e04cb90f0b71ea86411

See more details on using hashes here.

File details

Details for the file appflowysdk-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: appflowysdk-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for appflowysdk-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 76ba7e4a86b927bf50aa43e6d1ee9c53bf550d6cbbe2e1c8a669e9f061cd11f5
MD5 33c989d8bdba85c70b9c862d0578bb35
BLAKE2b-256 dfd77d52cc61e7f88a26dce1a6080b9ae9a0a601f62cc825c3e6d13acfd91f46

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page