Goal
Build a working C# console app that loads a published Speckle model, counts elements by category, and writes a CSV report you can open in Excel.What you will build
A console application that:- Reads credentials and target IDs from environment variables
- Loads the latest version of a model from Speckle Server
- Groups the model’s objects by category
- Writes
model-health-report.csvwith category names and counts
When to use this
Use this pattern when you need a first real automation — BIM QA summaries, quantity checks, or a starting point for door schedules and property audits. This is the recommended onboarding path before connector development or advanced architecture.Recommended approach
The simplest path for most AEC automation scripts:- Paste the one-time
AddSpeckleSdkbootstrap (see Automate with scripts) - Authenticate with a personal access token from
SPECKLE_TOKEN - Fetch the latest version with
client.Version.GetVersions - Load the version with
Receive3 - Query
model.Objectsand read properties withGetString - Write results to CSV with
StreamWriter
Updating a version of this tool written for
Receive2 and Flatten()? See Migrate to
2026.9.Prerequisites
- .NET SDK installed
- A personal access token from Speckle
- A published model on Speckle Server (from a connector or prior publish)
- Project ID and model ID from the Speckle web app URL:
https://app.speckle.systems/projects/{projectId}/models/{modelId}
Complete example
Complete example
How it works
Bootstrap.AddSpeckleSdk registers IOperations, IClientFactory, and IAccountFactory. You paste this once per app — see Automate with scripts.
Authentication. IAccountFactory.CreateAccount builds an in-memory Account from your PAT. No local account database is required for scripts.
Latest version. client.Version.GetVersions returns versions for a model; the API returns the newest first when limit is 1.
Receive. Receive3 downloads the version’s bundle and returns a Model. using deletes the downloaded files when the script ends.
Query. model.Objects is a flat list of every object in the version. GetString("category") reads the category whether the producer stored it as an instance property, a type property, or a root value. See Object model for how properties are stored.
Report. Grouping by category produces a simple model health summary. Extend the same pattern for door schedules or property audits: filter with model.ObjectsWith("path"), read values with GetString / GetDouble, and follow relations such as obj.Level?.Name.
Common mistakes
Next steps
Object model
How properties and relations are stored
Relations
Group by level, host, material, or system
Migrate to 2026.9
Side-by-side changes for existing scripts