🤖 New in SPACE GASS 14.51 — the MCP server lets your AI agent build, analyse and design your models. Get started →
SpaceGass API
Getting Started

Quick Start

This guide walks you through connecting to the API, opening a built-in sample project, and reading nodes — using the SDK clients or plain HTTP. No project file of your own is required.

Prefer not to write code?

The SPACE GASS MCP server lets Claude Desktop, GitHub Copilot and other AI desktop apps open models, run analyses and read results for you.

Prerequisites

  • SPACE GASS 14.5 or later installed on your machine
  • SPACE GASS has been opened at least once to initialise the required data files
  • One of:
  1. Start the Service

    The API runs as a local server. The easiest way to start it is to double-click the SPACE GASS API shortcut under the SPACE GASS Windows application folder.

    Alternatively, open a terminal and run:

    TerminalCode
    "C:\Program Files\SPACE GASS 14.5\SpaceGassApi.exe"

    By default the service starts on http://localhost:34560. To use a different port, pass the --port flag:

    TerminalCode
    "C:\Program Files\SPACE GASS 14.5\SpaceGassApi.exe" --port=5025

    Leave the terminal or shortcut window open — the service runs until you close it.

  2. Explore the API

    Once the service is running, open your browser and navigate to:

    Code
    http://localhost:34560/swagger

    The interactive Swagger UI lets you browse every endpoint, see request and response schemas, and make live API calls directly from your browser — no SDK or code required. This is the quickest way to get familiar with the API.

    When you are ready to integrate the API into your own code, continue with the steps below.

  3. Create a Project Folder and Install the SDK

    The API includes generated SDK clients for C# and Python. These handle serialisation and give you typed methods for every endpoint. If you prefer raw HTTP, you can skip this step and use the curl tab in every snippet below.

    # In a fresh folder: dotnet new console -n SpaceGassQuickStart cd SpaceGassQuickStart dotnet add package SpaceGassApi
  4. Create the Client

    The SDK provides a CreateClient() factory that configures everything for you — it connects to the local API with no additional setup required. See Authentication for details on custom URLs and future API key support.

    using SpaceGassApi; using SpaceGassApi.Models; var client = SpaceGassApiClient.CreateClient("http://localhost:34560");
  5. Open a Sample Project

    Job.OpenSample loads one of the built-in SPACE GASS samples as a new unsaved job — perfect for getting going without your own .sg file. List available samples with GET /file/samples (or browse them in Swagger); here we'll open Portal Frame.SG, which ships with every install.

    When you have your own file, use Job.Open with FilePath instead. See File Handling for the full set of open/save/close patterns.

    await client.Job.OpenSample.PostAsync( new OpenSampleRequest { FileName = "Portal Frame.SG" });
  6. Get All Nodes

    var nodes = await client.Job.Structure.Nodes.GetAsync(); foreach (var node in nodes) { Console.WriteLine($"Node {node.Id}: ({node.X}, {node.Y}, {node.Z})"); }
  7. Close the Project

    await client.Job.Close.PostAsync();

Putting It All Together

Drop this complete program into the project you created in Step 3 and run it. It opens the Portal Frame.SG sample, lists every node, and closes cleanly.

using SpaceGassApi; using SpaceGassApi.Models; var client = SpaceGassApiClient.CreateClient("http://localhost:34560"); try { await client.Job.OpenSample.PostAsync( new OpenSampleRequest { FileName = "Portal Frame.SG" }); var nodes = await client.Job.Structure.Nodes.GetAsync(); foreach (var node in nodes!) { Console.WriteLine($"Node {node.Id}: ({node.X}, {node.Y}, {node.Z})"); } } finally { await client.Job.Close.PostAsync(); }

Run this example locally

The same code is in the repo as Example.QuickStart (C#) and quick_start (Python). Clone the repo and run it directly — no copy-paste:

git clone https://github.com/SpaceGass/space-gass-api.git cd space-gass-api/sdks/csharp/examples/Example.QuickStart dotnet run

Make sure the SPACE GASS API service is running first (step 1 above).

Next Steps

  • Simple Beam Model — Full walkthrough building a model, running analysis, and querying results
  • File Handling — Open, save, force-open, and file status checks
  • API Reference — Browse all endpoints interactively
Last modified on