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 |
A whole package at once
Section titled “A whole package at once”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
Section titled “Packages”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.
Elements and their values
Section titled “Elements and their values”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 }}valueis in its natural type: a number for Integer, Real and UnlimitedNatural ("*"means no limit),trueorfalsefor Boolean,YYYY-MM-DDfor Date, ISO 8601 in UTC for DateTime, and text otherwise (Markdown whenformatisrichtext). 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 instoredValue, which never changes when the value is renamed. Match onstoredValue. - 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). fitsis 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.
Filters
Section titled “Filters”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.
Keeping another system in step
Section titled “Keeping another system in step”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:
- The first time, read everything, and note when you started.
- Each time after, ask for
updatedSincethe time you noted last, and note the new time before you start. - Apply what comes back in order. Reading from slightly before the last time does no harm: changes come again, never get lost.
import os, requestsfrom 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.
Relationships
Section titled “Relationships”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.
Attachments
Section titled “Attachments”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:
curl -OJ https://api.farkitect.com/v1/elements/ELEMENT_ID/attachment -H "Authorization: Bearer $FARKITECT_API_KEY"