Skip to content

Choose a client and command group

Use UnifiedApi for ordinary scripts. It checks command inputs and gives you Python objects for returned data. Its command groups separate Tapir commands, official Archicad commands, and higher-level utilities.

Access What it contains
api.tapir Tapir Add-On commands, grouped by task.
api.official Official Archicad JSON commands.
api.utilities Helpers for queries, properties, classifications, and result reporting.
from multiconn_archicad import UnifiedApi
from multiconn_archicad.models.official.types import ElementType

api = UnifiedApi()
walls = api.official.element_listing.get_elements_by_type(ElementType.WALL)
tapir_version = api.tapir.application.get_add_on_version()
print(f"Walls: {len(walls)} | Tapir: {tapir_version}")

Install Tapir even when a first example uses only official commands. Most of the library's command coverage comes from Tapir.

Set the target

Without connection arguments, the client uses command-line connection options, then discovers the lowest listening port if no port was supplied. Discovery probes ports 19723–19743. It checks for a listening endpoint, not project identity. The client stays bound to that endpoint; it does not follow the frontmost window.

Use an explicit port or host when you know the target:

api = UnifiedApi(port=19725)

host= accepts an API address such as http://127.0.0.1. Explicit constructor arguments override --host and --port. Pass either core= or port/host when constructing UnifiedApi; do not combine them.

For project names, readiness checks, discovery, or project switching, use the connection manager.

Send raw JSON with CoreCommands

Use CoreCommands when you need exact payload control or a command not yet covered by the generated client. It is also useful for quick dictionary-based scripts: you can read only the fields you need without building the generated Pydantic response objects. Dictionaries are sent without generated model validation.

from multiconn_archicad import CoreCommands, UnifiedApi

core = CoreCommands()
api = UnifiedApi(core)
project_info = core.post_tapir_command("GetProjectInfo")
print(project_info)

post_command() sends official JSON commands, such as API.IsAlive. post_tapir_command() sends Tapir commands. Both use the same endpoint when you share a core client with UnifiedApi.

For static checking of raw payloads, import TypedDict definitions from multiconn_archicad.dicts.tapir.commands or multiconn_archicad.dicts.official.commands; their shared types live in the corresponding types modules. TypedDicts help your editor check dictionary shapes; they do not validate values at runtime. Raw payloads use JSON strings where typed clients accept enums. See dictionaries and TypedDicts for a complete example, typed responses, and mixing the two clients in one script.

Reuse the official Python wrapper

A connection header also exposes header.standard, the official Archicad Python wrapper. Use it when integrating scripts already written for that wrapper:

from multiconn_archicad import ConnHeader, is_session_ready


def read_with_existing_wrapper(header: ConnHeader):
    if not is_session_ready(header):
        raise RuntimeError("Wait for a ready Archicad connection.")
    return header.standard.commands.GetAllElements()

The three header clients are header.unified, header.core, and header.standard. Pass the clients needed by an operation rather than making every operation discover its own connection.