Skip to content

Farkitect is in early access. New features arrive most weeks, and these pages are updated with them. See What's New for the latest.

Reading models

A project’s models hold its packages, elements and the relationships between them. This page is about reading them, with a key of any role; Changing models is about changing them. Each element and relationship is of a type from a metamodel, and carries property values for that type’s property types. Read Metamodels first for the types, and Lists and paging for how lists are paged.

Call Gives
GET /v1/projects/{projectId}/packages The model packages, as a flat list
GET /v1/projects/{projectId}/elements Elements, filtered as you choose
GET /v1/elements/{elementId} One element, with all its values
GET /v1/elements/{elementId}/attachment The file attached to an element
GET /v1/projects/{projectId}/relationships Relationships, filtered as you choose
GET /v1/relationships/{relationshipId} One relationship, with all its values
GET /v1/packages/{packageId}/contents A whole package at once: everything below it, values included
GET /v1/packages/{packageId}/markdown A whole package as one Markdown document

For a report, a document or an analysis, it’s usually simplest to read a whole package in one call. GET /v1/packages/{packageId}/contents gives the package and everything below it: packages, elements and relationships, each exactly as the single-item calls give it, values included. Give a model’s own id to read the whole model. include=metamodel adds the types the items are of, and the enumerations their property types use.

GET /v1/packages/{packageId}/markdown gives the same package as one Markdown document, as Export as Markdown writes it in the app: ready for a document, or to hand to an AI.

These are heavy calls: an organisation may make a few a minute, one at a time (Rate limits). A package too large for one call, over 10 MB or 45 seconds to gather, gets 413 use_export_job: export it instead, or read it a page at a time with the calls below. The answer isn’t one snapshot: changes made while it’s gathered may or may not be in it. Its startedAt says when it began, so follow up with updatedSince set to that to catch them.

Packages come as a flat list. Each names its parentId, which is null for a model, a top-level package. Build the tree by grouping on parentId. rootId keeps only one package and those below it.

A list of elements gives each one’s name, package, type (with its metamodel), notes and dates. Add include=properties for their values too. Lists with values hold at most 50 elements a page, since each reads more. A single element (GET /v1/elements/{elementId}) always comes with its values and its attachment’s details.

properties holds every property type of the element’s type, by name, with the element’s value:

"properties": {
"Annual Cost": { "propertyTypeId": "r10…", "dataType": "Real", "format": "currency:NZD", "value": 125000, "storedValue": null, "fits": true },
"Lifecycle": { "propertyTypeId": "r09…", "dataType": "Enumeration", "format": null, "value": "In production", "storedValue": "production", "fits": true },
"Go Live": { "propertyTypeId": "r11…", "dataType": "Date", "format": null, "value": "2025-03-01", "storedValue": null, "fits": true },
"Owner": { "propertyTypeId": "r12…", "dataType": "String", "format": null, "value": null, "storedValue": null, "fits": true }
}
  • value is in its natural type: a number for Integer, Real and UnlimitedNatural ("*" means no limit), true or false for Boolean, YYYY-MM-DD for Date, ISO 8601 in UTC for DateTime, and text otherwise (Markdown when format is richtext). It’s null when the element has no value.
  • Enumerations give the value’s name in value, as people see it, and the value as stored in storedValue, which never changes when the value is renamed. Match on storedValue.
  • Values are listed by property type name, which is easy to read, but a name can change: when someone renames a property type in the app, its value comes under the new name. A program that keeps values should match on propertyTypeId, which never changes, and use the name only to show people. Setting values works with either (see Changing models).
  • fits is false when a stored value doesn’t fit its data type, such as text in a number after the metamodel changed. The value then comes as stored text. Show it, but don’t calculate with it.

Elements filter by type (an element type’s id), packageId (the elements directly in a package) and updatedSince. Relationships filter by type, sourceId, targetId, elementId (either end) and updatedSince. How filters and pages work for every list: Lists and paging.

updatedSince gives what changed at or after a time, oldest change first. An element counts as changed when anything about it changes, its values included, whoever or whatever changed them. To keep another system in step:

  1. The first time, read everything, and note when you started.
  2. Each time after, ask for updatedSince the time you noted last, and note the new time before you start.
  3. Apply what comes back in order. Reading from slightly before the last time does no harm: changes come again, never get lost.
import os, requests
from datetime import datetime, timezone
API = "https://api.farkitect.com/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['FARKITECT_API_KEY']}"}
def changed_since(project_id, since):
started = datetime.now(timezone.utc).isoformat()
params, items = {"updatedSince": since, "include": "properties", "limit": 50}, []
while True:
page = requests.get(f"{API}/projects/{project_id}/elements", params=params, headers=HEADERS)
page.raise_for_status()
body = page.json()
items += body["data"]
if not body["hasMore"]:
return items, started # keep `started` for next time
params["cursor"] = body["nextCursor"]

Deletions don’t appear in updatedSince: a deleted item isn’t there to list. Ask GET /v1/projects/{projectId}/deletions?since=… with the same time instead. It lists every package, element, relationship and view deleted since then, oldest first, however it was deleted: in the app, by a program, by an import or a metamodel upgrade.

{ "object": "deletion", "kind": "element", "id": "j57c9w3…", "deletedAt": "2026-11-09T03:12:40.000Z" }

Deletions are remembered for 30 days. A since further back gets 410 resync_required: some deletions are no longer known, so read everything again, note the time you started, and carry on from there.

Each relationship gives its type, its source and target elements by id and name, and with include=properties its values. elementId gives every relationship at either end of an element; a relationship from an element to itself is listed once.

An element with an attached file says so in attachment (file name, type and size). GET /v1/elements/{elementId}/attachment returns the file itself, with its type in Content-Type and its name in Content-Disposition:

Terminal window
curl -OJ https://api.farkitect.com/v1/elements/ELEMENT_ID/attachment -H "Authorization: Bearer $FARKITECT_API_KEY"

Farkitect

Model anything.

“Welcome back — your diagrams have been plotting without you.”


Release 385 · 27 Nov 2026

Top packages: Inclusion and Sharing; Create New Version; Delete from Project

Release
385
Released
27 Nov 2026, 21:29 UTC
Built
27 Nov 2026, 21:30 UTC
Environment
Production
Surface
Docs
Commit
a5968f3
Branch
main