Skip to content

pyfocalboard

FocalboardApi

FocalboardApi(token: str | None, server: str, is_standalone=False, non_standard_api_url: str | None = None)
Source code in pyfocalboard/api.py
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
def __init__(
    self,
    token: str | None,
    server: str,
    is_standalone=False,
    non_standard_api_url: str | None = None,
):
    self._server = server
    self._client = Session()
    self._client.headers["X-Requested-With"] = "XMLHttpRequest"
    self.api_url = (
        FocalboardApi.STANDALONE_API_URL
        if is_standalone
        else FocalboardApi.MM_PLUGIN_API_URL
    )
    self.api_url = (
        self.api_url if not non_standard_api_url else non_standard_api_url
    )

    if token:
        self._client.headers["Authorization"] = "Bearer " + token

MM_PLUGIN_API_URL

MM_PLUGIN_API_URL = '/plugins/focalboard/api/v2'

STANDALONE_API_URL

STANDALONE_API_URL = '/api/v2'

api_url

api_url = api_url if not non_standard_api_url else non_standard_api_url

add_member

add_member(board_id: str, user_id: str, member: MemberBody | None = None) -> Member

Adds a new member to a board

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-addMember

Source code in pyfocalboard/api.py
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
def add_member(
    self, board_id: str, user_id: str, member: MemberBody | None = None
) -> Member:
    """
    Adds a new member to a board

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-addMember](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-addMember)
    """
    response = self._client.post(
        f"{self._server}{self.api_url}/boards/{board_id}/members",
        json=dict(userID=user_id, **(member.to_dict() if member else {})),
    )
    self._check_response(response)
    data = response.json()
    return Member.from_dict(data)

archive_board_export

archive_board_export(board_id: str) -> bytes

Exports an archive of all blocks for one boards.

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-archiveExportBoard

Source code in pyfocalboard/api.py
419
420
421
422
423
424
425
426
427
428
429
def archive_board_export(self, board_id: str) -> bytes:
    """
    Exports an archive of all blocks for one boards.

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-archiveExportBoard](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-archiveExportBoard)
    """
    response = self._client.get(
        f"{self._server}{self.api_url}/boards/{board_id}/archive/export",
    )
    self._check_response(response)
    return response.content

archive_export_team

archive_export_team(team_id: str) -> bytes

Exports an archive of all blocks for one boards.

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-archiveExportTeam

Source code in pyfocalboard/api.py
657
658
659
660
661
662
663
664
665
666
667
def archive_export_team(self, team_id: str) -> bytes:
    """
    Exports an archive of all blocks for one boards.

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-archiveExportTeam](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-archiveExportTeam)
    """
    response = self._client.get(
        f"{self._server}{self.api_url}/teams/{team_id}/archive/export",
    )
    self._check_response(response)
    return response.content

archive_import

archive_import(team_id: str, file: bytes) -> None

Import an archive of boards.

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-archiveImport

Source code in pyfocalboard/api.py
669
670
671
672
673
674
675
676
677
678
679
def archive_import(self, team_id: str, file: bytes) -> None:
    """
    Import an archive of boards.

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-archiveImport](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-archiveImport)
    """
    response = self._client.post(
        f"{self._server}{self.api_url}/teams/{team_id}/archive/import",
        files=dict(file=file),
    )
    self._check_response(response)

client_config

client_config() -> ClientConfig

Returns the client configuration

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getClientConfig

Source code in pyfocalboard/api.py
954
955
956
957
958
959
960
961
962
963
def client_config(self) -> ClientConfig:
    """
    Returns the client configuration

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getClientConfig](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getClientConfig)
    """
    response = self._client.get(f"{self._server}{self.api_url}/clientConfig")
    self._check_response(response)
    data = response.json()
    return ClientConfig.from_dict(data)

create_board

create_board(team_id: str, board: BoardBody) -> Board

Creates a new board

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-createBoard

Source code in pyfocalboard/api.py
260
261
262
263
264
265
266
267
268
269
270
271
272
def create_board(self, team_id: str, board: BoardBody) -> Board:
    """
    Creates a new board

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-createBoard](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-createBoard)
    """
    response = self._client.post(
        f"{self._server}{self.api_url}/boards",
        json=dict(teamID=team_id, **board.to_dict()),
    )
    self._check_response(response)
    data = response.json()
    return Board.from_dict(data)

create_card

create_card(board_id: str, card: CardBody | None = None, disable_notify: bool = False) -> Card

Creates a new card for the specified board.

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-createCard

Source code in pyfocalboard/api.py
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
def create_card(
    self, board_id: str, card: CardBody | None = None, disable_notify: bool = False
) -> Card:
    """
    Creates a new card for the specified board.

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-createCard](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-createCard)
    """
    response = self._client.post(
        f"{self._server}{self.api_url}/boards/{board_id}/cards",
        json=(card.to_dict() if card else {}),
        params=dict(disable_notify="true" if disable_notify else "false"),
    )
    self._check_response(response)
    data = response.json()
    return Card.from_dict(data)

create_category

create_category(team_id: str, user_id: str, category: CategoryBody) -> Category

Create a category for boards

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-createCategory

Source code in pyfocalboard/api.py
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
def create_category(
    self, team_id: str, user_id: str, category: CategoryBody
) -> Category:
    """
    Create a category for boards

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-createCategory](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-createCategory)
    """
    response = self._client.post(
        f"{self._server}{self.api_url}/teams/{team_id}/categories",
        json=dict(teamID=team_id, userID=user_id, **category.to_dict()),
    )
    self._check_response(response)
    data = response.json()
    return Category.from_dict(data)

create_subscription

create_subscription(block: Block, user_id: str) -> Subscription

Creates a subscription to a block for a user. The user will receive change notifications for the block.

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-createSubscription

Source code in pyfocalboard/api.py
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
def create_subscription(self, block: Block, user_id: str) -> Subscription:
    """
    Creates a subscription to a block for a user. The user will receive change notifications for the block.

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-createSubscription](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-createSubscription)
    """
    response = self._client.post(
        f"{self._server}{self.api_url}/subscriptions",
        json=dict(
            blockID=block.id,
            BlockType=block.type,
            subscriberID=user_id,
            SubscriberType="user",
        ),
    )
    self._check_response(response)
    data = response.json()
    return Subscription.from_dict(data)

delete_block

delete_block(board_id: str, block_id: str) -> None

Deletes a block

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-deleteBlock

Source code in pyfocalboard/api.py
158
159
160
161
162
163
164
165
166
167
def delete_block(self, board_id: str, block_id: str) -> None:
    """
    Deletes a block

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-deleteBlock](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-deleteBlock)
    """
    response = self._client.delete(
        f"{self._server}{self.api_url}/boards/{board_id}/blocks/{block_id}",
    )
    self._check_response(response)

delete_board

delete_board(board_id: str) -> None

Removes a board

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-deleteBoard

Source code in pyfocalboard/api.py
288
289
290
291
292
293
294
295
296
297
def delete_board(self, board_id: str) -> None:
    """
    Removes a board

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-deleteBoard](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-deleteBoard)
    """
    response = self._client.delete(
        f"{self._server}{self.api_url}/boards/{board_id}",
    )
    self._check_response(response)

delete_boards_and_blocks

delete_boards_and_blocks(board_ids: list[str], block_ids: list[str]) -> None

Deletes boards and blocks

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-deleteBoardsAndBlocks

Source code in pyfocalboard/api.py
514
515
516
517
518
519
520
521
522
523
524
525
526
def delete_boards_and_blocks(
    self, board_ids: list[str], block_ids: list[str]
) -> None:
    """
    Deletes boards and blocks

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-deleteBoardsAndBlocks](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-deleteBoardsAndBlocks)
    """
    response = self._client.delete(
        f"{self._server}{self.api_url}/boards-and-blocks",
        json=dict(boards=board_ids, blocks=block_ids),
    )
    self._check_response(response)

delete_category

delete_category(team_id: str, category_id: str) -> None

Delete a category

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-deleteCategory

Source code in pyfocalboard/api.py
765
766
767
768
769
770
771
772
773
774
def delete_category(self, team_id: str, category_id: str) -> None:
    """
    Delete a category

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-deleteCategory](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-deleteCategory)
    """
    response = self._client.delete(
        f"{self._server}{self.api_url}/teams/{team_id}/categories/{category_id}",
    )
    self._check_response(response)

delete_member

delete_member(board_id: str, user_id: str) -> None

Deletes a member from a board

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-deleteMember

Source code in pyfocalboard/api.py
404
405
406
407
408
409
410
411
412
413
414
415
416
417
def delete_member(
    self,
    board_id: str,
    user_id: str,
) -> None:
    """
    Deletes a member from a board

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-deleteMember](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-deleteMember)
    """
    response = self._client.delete(
        f"{self._server}{self.api_url}/boards/{board_id}/members/{user_id}",
    )
    self._check_response(response)

delete_subscriptions

delete_subscriptions(block_id: str, user_id: str) -> None

Deletes a subscription a user has for a a block. The user will no longer receive change notifications for the block.

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-deleteSubscription

Source code in pyfocalboard/api.py
849
850
851
852
853
854
855
856
857
858
def delete_subscriptions(self, block_id: str, user_id: str) -> None:
    """
    Deletes a subscription a user has for a a block. The user will no longer receive change notifications for the block.

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-deleteSubscription](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-deleteSubscription)
    """
    response = self._client.delete(
        f"{self._server}{self.api_url}/subscriptions/{block_id}/{user_id}"
    )
    self._check_response(response)

duplicate_block

duplicate_block(board_id: str, block_id: str) -> None

Returns the new created blocks

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-duplicateBlock

Source code in pyfocalboard/api.py
169
170
171
172
173
174
175
176
177
178
179
180
def duplicate_block(self, board_id: str, block_id: str) -> None:
    """
    Returns the new created blocks

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-duplicateBlock](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-duplicateBlock)
    """
    response = self._client.post(
        f"{self._server}{self.api_url}/boards/{board_id}/blocks/{block_id}/duplicate",
    )
    self._check_response(response)
    data = response.json()
    return [Block.from_dict(item) for item in data]

duplicate_board

duplicate_board(board_id: str) -> BoardAndBlocks

Returns the new created board and all the blocks

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-duplicateBoard

Source code in pyfocalboard/api.py
361
362
363
364
365
366
367
368
369
370
371
372
def duplicate_board(self, board_id: str) -> BoardAndBlocks:
    """
    Returns the new created board and all the blocks

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-duplicateBoard](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-duplicateBoard)
    """
    response = self._client.post(
        f"{self._server}{self.api_url}/boards/{board_id}/duplicate"
    )
    self._check_response(response)
    data = response.json()
    return BoardAndBlocks.from_dict(data)

get_blocks

get_blocks(board_id: str, parent_id: str | None = None, type: str | None = None) -> list[Block]

Returns team boards

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getBlocks

Source code in pyfocalboard/api.py
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
def get_blocks(
    self, board_id: str, parent_id: str | None = None, type: str | None = None
) -> list[Block]:
    """
    Returns team boards

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getBlocks](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getBlocks)
    """
    response = self._client.get(
        f"{self._server}{self.api_url}/boards/{board_id}/blocks",
        params={
            "parent_id:": parent_id,
            "type": type,
        },
    )
    self._check_response(response)
    data = response.json()
    return [Block.from_dict(item) for item in data]

get_board

get_board(board_id: str) -> Board

Returns a board

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getBoard

Source code in pyfocalboard/api.py
249
250
251
252
253
254
255
256
257
258
def get_board(self, board_id: str) -> Board:
    """
    Returns a board

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getBoard](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getBoard)
    """
    response = self._client.get(f"{self._server}{self.api_url}/boards/{board_id}")
    self._check_response(response)
    data = response.json()
    return Board.from_dict(data)

get_boards

get_boards(team_id: str) -> list[Board]

Returns team boards

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getBoards

Source code in pyfocalboard/api.py
236
237
238
239
240
241
242
243
244
245
246
247
def get_boards(self, team_id: str) -> list[Board]:
    """
    Returns team boards

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getBoards](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getBoards)
    """
    response = self._client.get(
        f"{self._server}{self.api_url}/teams/{team_id}/boards"
    )
    self._check_response(response)
    data = response.json()
    return [Board.from_dict(item) for item in data]

get_card

get_card(card_id: str) -> Card

Fetches the specified card.

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getCard

Source code in pyfocalboard/api.py
545
546
547
548
549
550
551
552
553
554
def get_card(self, card_id: str) -> Card:
    """
    Fetches the specified card.

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getCard](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getCard)
    """
    response = self._client.get(f"{self._server}{self.api_url}/cards/{card_id}")
    self._check_response(response)
    data = response.json()
    return Card.from_dict(data)

get_cards

get_cards(board_id: str, page: int = 0, per_page: int = 100) -> list[Card]

Fetches cards for the specified board.

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getCards

Source code in pyfocalboard/api.py
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
def get_cards(
    self, board_id: str, page: int = 0, per_page: int = 100
) -> list[Card]:
    """
    Fetches cards for the specified board.

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getCards](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getCards)
    """
    response = self._client.get(
        f"{self._server}{self.api_url}/boards/{board_id}/cards",
        params=dict(page=page, per_page=per_page),
    )
    self._check_response(response)
    data = response.json()
    return [Card.from_dict(item) for item in data]

get_category_boards

get_category_boards(team_id: str) -> list[Category]

Gets the user's board categories

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getUserCategoryBoards

Source code in pyfocalboard/api.py
718
719
720
721
722
723
724
725
726
727
728
729
def get_category_boards(self, team_id: str) -> list[Category]:
    """
    Gets the user's board categories

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getUserCategoryBoards](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getUserCategoryBoards)
    """
    response = self._client.get(
        f"{self._server}{self.api_url}/teams/{team_id}/categories"
    )
    self._check_response(response)
    data = response.json()
    return [Category.from_dict(item) for item in data]

get_channel

get_channel(team_id: str, channel_id: str) -> Channel

Returns the requested channel

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getChannel

Source code in pyfocalboard/api.py
875
876
877
878
879
880
881
882
883
884
885
886
def get_channel(self, team_id: str, channel_id: str) -> Channel:
    """
    Returns the requested channel

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getChannel](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getChannel)
    """
    response = self._client.get(
        f"{self._server}{self.api_url}/teams/{team_id}/channels/{channel_id}"
    )
    self._check_response(response)
    data = response.json()
    return Channel.from_dict(data)

get_file

get_file(team_id: str, board_id: str, filename: str) -> bytes

Returns the contents of an uploaded file

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getFile

Source code in pyfocalboard/api.py
889
890
891
892
893
894
895
896
897
898
899
def get_file(self, team_id: str, board_id: str, filename: str) -> bytes:
    """
    Returns the contents of an uploaded file

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getFile](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getFile)
    """
    response = self._client.get(
        f"{self._server}{self.api_url}/files/teams/{team_id}/{board_id}/{filename}"
    )
    self._check_response(response)
    return response.content

get_me

get_me() -> User

Returns the currently logged-in user

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getMe

Source code in pyfocalboard/api.py
682
683
684
685
686
687
688
689
690
691
def get_me(self) -> User:
    """
    Returns the currently logged-in user

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getMe](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getMe)
    """
    response = self._client.get(f"{self._server}{self.api_url}/users/me")
    self._check_response(response)
    data = response.json()
    return User.from_dict(data)

get_members_for_board

get_members_for_board(board_id: str) -> list[Member]

Returns the members of the board

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getMembersForBoard

Source code in pyfocalboard/api.py
321
322
323
324
325
326
327
328
329
330
331
332
def get_members_for_board(self, board_id: str) -> list[Member]:
    """
    Returns the members of the board

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getMembersForBoard](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getMembersForBoard)
    """
    response = self._client.get(
        f"{self._server}{self.api_url}/boards/{board_id}/members"
    )
    self._check_response(response)
    data = response.json()
    return [Member.from_dict(item) for item in data]

get_my_memberships

get_my_memberships() -> list[Member]

Returns the currently users board memberships

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getMyMemberships

Source code in pyfocalboard/api.py
704
705
706
707
708
709
710
711
712
713
714
715
def get_my_memberships(self) -> list[Member]:
    """
    Returns the currently users board memberships

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getMyMemberships](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getMyMemberships)
    """
    response = self._client.get(
        f"{self._server}{self.api_url}/users/me/memberships"
    )
    self._check_response(response)
    data = response.json()
    return [Member.from_dict(item) for item in data]

get_sharing

get_sharing(board_id: str) -> Sharing

Returns sharing information for a board

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getSharing

Source code in pyfocalboard/api.py
334
335
336
337
338
339
340
341
342
343
344
345
def get_sharing(self, board_id: str) -> Sharing:
    """
    Returns sharing information for a board

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getSharing](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getSharing)
    """
    response = self._client.get(
        f"{self._server}{self.api_url}/boards/{board_id}/sharing"
    )
    self._check_response(response)
    data = response.json()
    return Sharing.from_dict(data)

get_statistics

get_statistics() -> BoardsStatistics

Fetches the statistic of the server.

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-handleStatistics

Source code in pyfocalboard/api.py
918
919
920
921
922
923
924
925
926
927
def get_statistics(self) -> BoardsStatistics:
    """
    Fetches the statistic of the server.

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-handleStatistics](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-handleStatistics)
    """
    response = self._client.get(f"{self._server}{self.api_url}/statistics")
    self._check_response(response)
    data = response.json()
    return BoardsStatistics.from_dict(data)

get_subscriptions

get_subscriptions(subscriber_id: str) -> list[Subscription]

Gets subscriptions for a user.

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getSubscriptions

Source code in pyfocalboard/api.py
817
818
819
820
821
822
823
824
825
826
827
828
def get_subscriptions(self, subscriber_id: str) -> list[Subscription]:
    """
    Gets subscriptions for a user.

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getSubscriptions](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getSubscriptions)
    """
    response = self._client.get(
        f"{self._server}{self.api_url}/subscriptions/{subscriber_id}"
    )
    self._check_response(response)
    data = response.json()
    return [Subscription.from_dict(item) for item in data]

get_team

get_team(team_id: str) -> Team

Returns information of the root team

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getTeam

Source code in pyfocalboard/api.py
602
603
604
605
606
607
608
609
610
611
def get_team(self, team_id: str) -> Team:
    """
    Returns information of the root team

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getTeam](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getTeam)
    """
    response = self._client.get(f"{self._server}{self.api_url}/teams/{team_id}")
    self._check_response(response)
    data = response.json()
    return Team.from_dict(data)

get_team_users

get_team_users(team_id: str, search: str | None = None, exclude_bots: bool = False) -> list[User]

Returns team users

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getTeamUsers

Source code in pyfocalboard/api.py
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
def get_team_users(
    self, team_id: str, search: str | None = None, exclude_bots: bool = False
) -> list[User]:
    """
    Returns team users

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getTeamUsers](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getTeamUsers)
    """
    response = self._client.get(
        f"{self._server}{self.api_url}/teams/{team_id}/users",
        params=dict(
            search=search, exclude_bots="true" if exclude_bots else "false"
        ),
    )
    self._check_response(response)
    data = response.json()
    return [User.from_dict(item) for item in data]

get_teams

get_teams() -> list[Team]

Returns information of all the teams

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getTeams

Source code in pyfocalboard/api.py
591
592
593
594
595
596
597
598
599
600
def get_teams(self) -> list[Team]:
    """
    Returns information of all the teams

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getTeams](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getTeams)
    """
    response = self._client.get(f"{self._server}{self.api_url}/teams")
    self._check_response(response)
    data = response.json()
    return [Team.from_dict(item) for item in data]

get_templates

get_templates(team_id: str) -> list[Board]

Returns team templates

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getTemplates

Source code in pyfocalboard/api.py
644
645
646
647
648
649
650
651
652
653
654
655
def get_templates(self, team_id: str) -> list[Board]:
    """
    Returns team templates

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getTemplates](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getTemplates)
    """
    response = self._client.get(
        f"{self._server}{self.api_url}/teams/{team_id}/templates"
    )
    self._check_response(response)
    data = response.json()
    return [Board.from_dict(item) for item in data]

get_user

get_user(user_id: str) -> User

Returns a user

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getUser

Source code in pyfocalboard/api.py
693
694
695
696
697
698
699
700
701
702
def get_user(self, user_id: str) -> User:
    """
    Returns a user

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getUser](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getUser)
    """
    response = self._client.get(f"{self._server}{self.api_url}/users/{user_id}")
    self._check_response(response)
    data = response.json()
    return User.from_dict(data)

get_user_config

get_user_config() -> list[UserPreference]

Returns an array of user preferences

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getUserConfig

Source code in pyfocalboard/api.py
776
777
778
779
780
781
782
783
784
785
def get_user_config(self) -> list[UserPreference]:
    """
    Returns an array of user preferences

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getUserConfig](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getUserConfig)
    """
    response = self._client.get(f"{self._server}{self.api_url}/users/me/config")
    self._check_response(response)
    data = response.json()
    return [UserPreference.from_dict(item) for item in data]

get_users

get_users(user_ids: list[str]) -> list[User]

Returns a user list

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getUsersList

Source code in pyfocalboard/api.py
803
804
805
806
807
808
809
810
811
812
813
814
def get_users(self, user_ids: list[str]) -> list[User]:
    """
    Returns a user list

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getUsersList](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-getUsersList)
    """
    response = self._client.post(
        f"{self._server}{self.api_url}/users", json=user_ids
    )
    self._check_response(response)
    data = response.json()
    return [User.from_dict(item) for item in data]

insert_boards_and_blocks

insert_boards_and_blocks(boards: list[BoardBody], blocks: list[BlockBody]) -> None

Creates new boards and blocks

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-insertBoardsAndBlocks

Source code in pyfocalboard/api.py
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
def insert_boards_and_blocks(
    self, boards: list[BoardBody], blocks: list[BlockBody]
) -> None:
    """
    Creates new boards and blocks

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-insertBoardsAndBlocks](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-insertBoardsAndBlocks)
    """
    response = self._client.post(
        f"{self._server}{self.api_url}/boards-and-blocks",
        json=dict(
            boards=[board.to_dict() for board in boards],
            blocks=[
                {
                    "createAt": int(datetime.now().timestamp()),
                    "updateAt": int(datetime.now().timestamp()),
                    **block.to_dict(),
                }
                for block in blocks
            ],
        ),
    )
    self._check_response(response)
    data = response.json()
    return BoardAndBlocks.from_dict(data)

join_board

join_board(board_id: str) -> None

Become a member of a board

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-joinBoard

Source code in pyfocalboard/api.py
299
300
301
302
303
304
305
306
307
308
def join_board(self, board_id: str) -> None:
    """
    Become a member of a board

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-joinBoard](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-joinBoard)
    """
    response = self._client.post(
        f"{self._server}{self.api_url}/boards/{board_id}/join"
    )
    self._check_response(response)

leave_board

leave_board(board_id: str) -> None

Remove your own membership from a board

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-leaveBoard

Source code in pyfocalboard/api.py
310
311
312
313
314
315
316
317
318
319
def leave_board(self, board_id: str) -> None:
    """
    Remove your own membership from a board

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-leaveBoard](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-leaveBoard)
    """
    response = self._client.post(
        f"{self._server}{self.api_url}/boards/{board_id}/leave"
    )
    self._check_response(response)

login

login(auth: LoginRequest)

Login user

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-login

Source code in pyfocalboard/api.py
930
931
932
933
934
935
936
937
938
939
940
941
def login(self, auth: LoginRequest):
    """
    Login user

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-login](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-login)
    """
    response = self._client.post(
        f"{self._server}{self.api_url}/login", json=auth.to_dict()
    )
    self._check_response(response)
    data = response.json()
    self._client.headers["Authorization"] = "Bearer " + data.token

logout

logout()

Logout user

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-logout

Source code in pyfocalboard/api.py
943
944
945
946
947
948
949
950
951
def logout(self):
    """
    Logout user

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-logout](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-logout)
    """
    response = self._client.post(f"{self._server}{self.api_url}/logout")
    self._check_response(response)
    del self._client.headers["Authorization"]

onboard

onboard(team_id: str) -> Onboarding

Onboards a user on Boards.

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-onboard

Source code in pyfocalboard/api.py
631
632
633
634
635
636
637
638
639
640
641
642
def onboard(self, team_id: str) -> Onboarding:
    """
    Onboards a user on Boards.

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-onboard](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-onboard)
    """
    response = self._client.post(
        f"{self._server}{self.api_url}/teams/{team_id}/onboard"
    )
    self._check_response(response)
    data = response.json()
    return Onboarding.from_dict(data)

patch_block

patch_block(board_id: str, block_id: str, block: BlockBody, disable_notify: bool = False) -> None

Partially updates a block

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-patchBlock

Source code in pyfocalboard/api.py
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
def patch_block(
    self,
    board_id: str,
    block_id: str,
    block: BlockBody,
    disable_notify: bool = False,
) -> None:
    """
    Partially updates a block

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-patchBlock](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-patchBlock)
    """
    response = self._client.patch(
        f"{self._server}{self.api_url}/boards/{board_id}/blocks/{block_id}",
        json=block.to_dict(),
        params=dict(disable_notify="true" if disable_notify else "false"),
    )
    self._check_response(response)

patch_blocks

patch_blocks(board_id: str, block_ids: list[str], blocks: list[BlockBody], disable_notify: bool = False) -> None

Partially updates batch of blocks

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-patchBlocks

Source code in pyfocalboard/api.py
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
def patch_blocks(
    self,
    board_id: str,
    block_ids: list[str],
    blocks: list[BlockBody],
    disable_notify: bool = False,
) -> None:
    """
    Partially updates batch of blocks

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-patchBlocks](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-patchBlocks)
    """
    response = self._client.patch(
        f"{self._server}{self.api_url}/boards/{board_id}/blocks",
        json=dict(
            block_ids=block_ids, block_patches=[block.to_dict() for block in blocks]
        ),
        params=dict(disable_notify="true" if disable_notify else "false"),
    )
    self._check_response(response)

patch_board

patch_board(board_id: str, board: BoardBody) -> Board

Partially updates a board

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-patchBoard

Source code in pyfocalboard/api.py
274
275
276
277
278
279
280
281
282
283
284
285
286
def patch_board(self, board_id: str, board: BoardBody) -> Board:
    """
    Partially updates a board

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-patchBoard](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-patchBoard)
    """
    response = self._client.patch(
        f"{self._server}{self.api_url}/boards/{board_id}",
        json=board.to_dict(),
    )
    self._check_response(response)
    data = response.json()
    return Board.from_dict(data)

patch_boards_and_blocks

patch_boards_and_blocks(board_ids: list[str], boards: list[BoardBody], block_ids: list[str], blocks: list[BlockBody]) -> None

Patches a set of related boards and blocks

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-patchBoardsAndBlocks

Source code in pyfocalboard/api.py
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
def patch_boards_and_blocks(
    self,
    board_ids: list[str],
    boards: list[BoardBody],
    block_ids: list[str],
    blocks: list[BlockBody],
) -> None:
    """
    Patches a set of related boards and blocks

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-patchBoardsAndBlocks](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-patchBoardsAndBlocks)
    """
    response = self._client.patch(
        f"{self._server}{self.api_url}/boards-and-blocks",
        json=dict(
            boardIDs=board_ids,
            boardPatches=[board.to_dict() for board in boards],
            blockIDs=block_ids,
            blockPatches=[
                {
                    "createAt": int(datetime.now().timestamp()),
                    "updateAt": int(datetime.now().timestamp()),
                    **block.to_dict(),
                }
                for block in blocks
            ],
        ),
    )
    self._check_response(response)
    data = response.json()
    return BoardAndBlocks.from_dict(data)

patch_card

patch_card(card_id: str, card: CardPatch | None, disable_notify: bool = False) -> Card

Patches the specified card.

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-patchCard

Source code in pyfocalboard/api.py
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
def patch_card(
    self, card_id: str, card: CardPatch | None, disable_notify: bool = False
) -> Card:
    """
    Patches the specified card.

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-patchCard](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-patchCard)
    """
    response = self._client.patch(
        f"{self._server}{self.api_url}/cards/{card_id}",
        json=card.to_dict(),
        params=dict(disable_notify="true" if disable_notify else "false"),
    )
    self._check_response(response)
    data = response.json()
    return Card.from_dict(data)

post_sharing

post_sharing(board_id: str, sharing: SharingBody) -> Sharing

Sets sharing information for a board

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-postSharing

Source code in pyfocalboard/api.py
347
348
349
350
351
352
353
354
355
356
357
358
359
def post_sharing(self, board_id: str, sharing: SharingBody) -> Sharing:
    """
    Sets sharing information for a board

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-postSharing](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-postSharing)
    """
    response = self._client.post(
        f"{self._server}{self.api_url}/boards/{board_id}/sharing",
        json=sharing.to_dict(),
    )
    self._check_response(response)
    data = response.json()
    return Sharing.from_dict(data)

search_all_boards

search_all_boards(query: str = '') -> list[Board]

Returns the boards that match with a search term

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-searchAllBoards

Source code in pyfocalboard/api.py
194
195
196
197
198
199
200
201
202
203
204
205
206
def search_all_boards(self, query: str = "") -> list[Board]:
    """
    Returns the boards that match with a search term

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-searchAllBoards](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-searchAllBoards)
    """

    response = self._client.get(
        f"{self._server}{self.api_url}/boards/search", params=dict(q=query)
    )
    self._check_response(response)
    data = response.json()
    return [Board.from_dict(item) for item in data]

search_boards

search_boards(team_id: str, query: str = '') -> list[Board]

Returns the boards that match with a search term in the team

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-searchBoards

Source code in pyfocalboard/api.py
208
209
210
211
212
213
214
215
216
217
218
219
220
def search_boards(self, team_id: str, query: str = "") -> list[Board]:
    """
    Returns the boards that match with a search term in the team

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-searchBoards](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-searchBoards)
    """
    response = self._client.get(
        f"{self._server}{self.api_url}/teams/{team_id}/boards/search",
        params=dict(q=query),
    )
    self._check_response(response)
    data = response.json()
    return [Board.from_dict(item) for item in data]

search_linkable_boards

search_linkable_boards(team_id: str, query: str = '') -> list[Board]

Returns the boards that match with a search term in the team and the user has permission to manage members

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-searchLinkableBoards

Source code in pyfocalboard/api.py
222
223
224
225
226
227
228
229
230
231
232
233
234
def search_linkable_boards(self, team_id: str, query: str = "") -> list[Board]:
    """
    Returns the boards that match with a search term in the team and the user has permission to manage members

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-searchLinkableBoards](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-searchLinkableBoards)
    """
    response = self._client.get(
        f"{self._server}{self.api_url}/teams/{team_id}/boards/search/linkable",
        params=dict(q=query),
    )
    self._check_response(response)
    data = response.json()
    return [Board.from_dict(item) for item in data]

search_my_channels

search_my_channels(team_id: str, search: str = '') -> list[Channel]

Returns the user available channels

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-searchMyChannels

Source code in pyfocalboard/api.py
861
862
863
864
865
866
867
868
869
870
871
872
873
def search_my_channels(self, team_id: str, search: str = "") -> list[Channel]:
    """
    Returns the user available channels

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-searchMyChannels](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-searchMyChannels)
    """
    response = self._client.get(
        f"{self._server}{self.api_url}/teams/{team_id}/channels",
        params=dict(search=search),
    )
    self._check_response(response)
    data = response.json()
    return [Channel.from_dict(item) for item in data]

undelete_block

undelete_block(board_id: str, block_id: str) -> None

Undeletes a block

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-undeleteBlock

Source code in pyfocalboard/api.py
182
183
184
185
186
187
188
189
190
191
def undelete_block(self, board_id: str, block_id: str) -> None:
    """
    Undeletes a block

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-undeleteBlock](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-undeleteBlock)
    """
    response = self._client.post(
        f"{self._server}{self.api_url}/boards/{board_id}/blocks/{block_id}/undelete",
    )
    self._check_response(response)

undelete_board

undelete_board(board_id: str) -> None

Undeletes a board

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-undeleteBoard

Source code in pyfocalboard/api.py
444
445
446
447
448
449
450
451
452
453
def undelete_board(self, board_id: str) -> None:
    """
    Undeletes a board

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-undeleteBoard](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-undeleteBoard)
    """
    response = self._client.post(
        f"{self._server}{self.api_url}/boards/{board_id}/undelete",
    )
    self._check_response(response)

update_blocks

update_blocks(board_id: str, blocks: list[Block], disable_notify: bool = False) -> None

Insert blocks. The specified IDs will only be used to link blocks with existing ones, the rest will be replaced by server generated IDs

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-updateBlocks

Source code in pyfocalboard/api.py
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
def update_blocks(
    self,
    board_id: str,
    blocks: list[Block],
    disable_notify: bool = False,
) -> None:
    """
    Insert blocks. The specified IDs will only be used to link blocks with existing ones, the rest will be replaced by server generated IDs

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-updateBlocks](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-updateBlocks)
    """
    response = self._client.post(
        f"{self._server}{self.api_url}/boards/{board_id}/blocks",
        json=[block.to_dict() for block in blocks],
        params=dict(disable_notify="true" if disable_notify else "false"),
    )
    self._check_response(response)

update_board_category

update_board_category(team_id: str, board_id: str, category_id: str) -> None

Set the category of a board

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-updateCategoryBoard

Source code in pyfocalboard/api.py
431
432
433
434
435
436
437
438
439
440
441
442
def update_board_category(
    self, team_id: str, board_id: str, category_id: str
) -> None:
    """
    Set the category of a board

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-updateCategoryBoard](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-updateCategoryBoard)
    """
    response = self._client.post(
        f"{self._server}{self.api_url}/teams/{team_id}/categories/{category_id}/boards/{board_id}",
    )
    self._check_response(response)

update_category

update_category(team_id: str, user_id: str, category_id: str, category: CategoryBody) -> Category

Create a category for boards

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-updateCategory

Source code in pyfocalboard/api.py
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
def update_category(
    self, team_id: str, user_id: str, category_id: str, category: CategoryBody
) -> Category:
    """
    Create a category for boards

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-updateCategory](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-updateCategory)
    """
    response = self._client.put(
        f"{self._server}{self.api_url}/teams/{team_id}/categories/{category_id}",
        json=dict(
            teamID=team_id, userID=user_id, id=category_id, **category.to_dict()
        ),
    )
    self._check_response(response)
    data = response.json()
    return Category.from_dict(data)

update_member

update_member(board_id: str, user_id: str, member: MemberBody) -> Member

Updates a board member

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-updateMember

Source code in pyfocalboard/api.py
390
391
392
393
394
395
396
397
398
399
400
401
402
def update_member(self, board_id: str, user_id: str, member: MemberBody) -> Member:
    """
    Updates a board member

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-updateMember](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-updateMember)
    """
    response = self._client.put(
        f"{self._server}{self.api_url}/boards/{board_id}/members/{user_id}",
        json=member.to_dict(),
    )
    self._check_response(response)
    data = response.json()
    return Member.from_dict(data)

update_user_config

update_user_config(user_id: str, user_preference: UserPreference) -> list[UserPreference]

Updates user config

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-updateUserConfig

Source code in pyfocalboard/api.py
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
def update_user_config(
    self, user_id: str, user_preference: UserPreference
) -> list[UserPreference]:
    """
    Updates user config

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-updateUserConfig](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-updateUserConfig)
    """
    response = self._client.put(
        f"{self._server}{self.api_url}/users/{user_id}/config",
        json=user_preference.to_dict(),
    )
    self._check_response(response)
    data = response.json()
    return [UserPreference.from_dict(item) for item in data]

upload_file

upload_file(team_id: str, board_id: str, file: bytes) -> FileUploadResponse

Upload a binary file, attached to a root block

https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-uploadFile

Source code in pyfocalboard/api.py
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
def upload_file(
    self, team_id: str, board_id: str, file: bytes
) -> FileUploadResponse:
    """
    Upload a binary file, attached to a root block

    [https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-uploadFile](https://htmlpreview.github.io/?https://github.com/mattermost/focalboard/blob/main/server/swagger/docs/html/index.html#api-Default-uploadFile)
    """
    response = self._client.post(
        f"{self._server}{self.api_url}/teams/{team_id}/{board_id}/files",
        files=dict(file=file),
    )
    self._check_response(response)
    data = response.json()
    return FileUploadResponse.from_dict(data)