---
title: "Single-building 3D model (OBJ / GLB / CityJSON / DXF), synchronous"
description: "Proxy for the Contoor 3D API (`project_res_3D_api`, FastAPI, systemd unit `contoor-3d-api` on the RES box, published at contoor-api-contabo.gisjoe.com). RES adds the RES token, the request allowlist and RES-hosted artifact URLs so one contract and one credential cover parcels and meshes.\n\nResolves the building under `lat`/`lng` (cadastral footprint via WFS), runs the roofer LoD2.2 reconstruction on the swissSURFACE3D point cloud if no cached model exists, and returns download links per format. A cache hit answers in well under a second; a fresh reconstruction takes seconds to a few minutes (proxy timeout 180 s → 504; retry later, the upstream job keeps running and the next call is a cache hit). Pass `buildingId` from an earlier answer to skip the lookup. `package: true` also builds a ZIP with every generated format. Geometry in the OBJ/GLB is in LV95 metres with a local origin; the DXF is absolute LV95/LN02."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.aireon.ch/llms.txt
> Use this file to discover all available pages before exploring further.

Path: RES API (public) › Building3D

`POST /res_api/3d/building_model`

Proxy for the Contoor 3D API (`project_res_3D_api`, FastAPI, systemd unit `contoor-3d-api` on the RES box, published at contoor-api-contabo.gisjoe.com). RES adds the RES token, the request allowlist and RES-hosted artifact URLs so one contract and one credential cover parcels and meshes.

Resolves the building under `lat`/`lng` (cadastral footprint via WFS), runs the roofer LoD2.2 reconstruction on the swissSURFACE3D point cloud if no cached model exists, and returns download links per format. A cache hit answers in well under a second; a fresh reconstruction takes seconds to a few minutes (proxy timeout 180 s → 504; retry later, the upstream job keeps running and the next call is a cache hit). Pass `buildingId` from an earlier answer to skip the lookup. `package: true` also builds a ZIP with every generated format. Geometry in the OBJ/GLB is in LV95 metres with a local origin; the DXF is absolute LV95/LN02.

## Authentication

- `ResApiToken`, apiKey, in header, header `token`

## Request body

_Required._

- `lat` (`createBuildingModel.lat`; number, optional): WGS84 latitude (inside Switzerland).
- `lng` (`createBuildingModel.lng`; number, optional): WGS84 longitude (inside Switzerland).
- `buildingId` (`createBuildingModel.buildingId`; string, optional): Alternative to lat/lng: a building id from a previous answer.
  - pattern `^[a-f0-9]{64}$`
- `formats` (`createBuildingModel.formats`; array<string>, optional): Requested output formats.
  - one of `"cityjson"`, `"obj"`, `"glb"`, `"dxf"`; default `["obj","glb"]`
- `package` (`createBuildingModel.package`; boolean, optional)
  - default `false`
- `buffer_m` (`createBuildingModel.buffer_m`; number, optional): Footprint selection buffer in metres (upstream default).

## Example request

```json
{
  "lat": 47.640269,
  "lng": 9.193094,
  "formats": [
    "obj",
    "glb"
  ],
  "package": true
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://res.aireon.ch/res_api/3d/building_model \
  --header 'Content-Type: application/json' \
  --header 'token: <token>' \
  --data '
{
  "lat": 47.640269,
  "lng": 9.193094,
  "formats": [
    "obj",
    "glb"
  ],
  "package": true
}
'
```

### TypeScript

```typescript
const url = 'https://res.aireon.ch/res_api/3d/building_model';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', token: '<token>'},
  body: JSON.stringify({lat: 47.640269, lng: 9.193094, formats: ['obj', 'glb'], package: true})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://res.aireon.ch/res_api/3d/building_model"

payload = {
    "lat": 47.640269,
    "lng": 9.193094,
    "formats": ["obj", "glb"],
    "package": True
}
headers = {
    "Content-Type": "application/json",
    "token": "<token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Model artifacts are ready.

#### Example

```json
{
  "input": {},
  "buildingId": "string",
  "cacheHit": {
    "property1": true,
    "property2": true
  },
  "outputPaths": {
    "property1": "string",
    "property2": "string"
  },
  "downloadLinks": {
    "property1": "string",
    "property2": "string"
  },
  "files": {
    "property1": "string",
    "property2": "string"
  },
  "note": "string"
}
```

- `buildingId` (`createBuildingModel.response.200.buildingId`; string, required): Stable id of the footprint the 3D service resolved (sha256 of its geometry). Reuse it in later calls to skip the WFS lookup.
  - pattern `^[a-f0-9]{64}$`
- `cacheHit` (`createBuildingModel.response.200.cacheHit`; map<boolean>, required): Per format: whether the artifact already existed upstream.
- `outputPaths` (`createBuildingModel.response.200.outputPaths`; map<string | null>, required): Upstream repo-relative paths (informational).
- `downloadLinks` (`createBuildingModel.response.200.downloadLinks`; map<string | null>, required): Public static URLs on the 3D service host (no token needed).
- `files` (`createBuildingModel.response.200.files`; map<string>, required): RES-hosted download paths (`/res_api/3d/building_model/file/{buildingId}/{file}`, token required) keyed by format plus `zip` when `package` was requested.
- `input` (`createBuildingModel.response.200.input`; object, optional)
- `note` (`createBuildingModel.response.200.note`; string, optional)

### 400

Invalid request.

#### Example

```json
{
  "error": "string",
  "message": "string"
}
```

- `error` (`createBuildingModel.response.400.error`; string, required): Human-readable error description.
- `message` (`createBuildingModel.response.400.message`; string, optional): Optional underlying error message.

### 401

Authentication missing or invalid.

#### Example

```json
{
  "error": "string",
  "message": "string"
}
```

- `error` (`createBuildingModel.response.401.error`; string, required): Human-readable error description.
- `message` (`createBuildingModel.response.401.message`; string, optional): Optional underlying error message.

### 403

Authenticated but not permitted.

#### Example

```json
{
  "error": "string",
  "message": "string"
}
```

- `error` (`createBuildingModel.response.403.error`; string, required): Human-readable error description.
- `message` (`createBuildingModel.response.403.message`; string, optional): Optional underlying error message.

### 502

The 3D service is unreachable or answered with an error (its status and body are relayed in `upstream_status` / `upstream`).

#### Example

```json
{
  "error": "string",
  "upstream_status": 0,
  "upstream": null,
  "detail": "string"
}
```

- `error` (`createBuildingModel.response.502.error`; string, optional)
- `upstream_status` (`createBuildingModel.response.502.upstream_status`; integer, optional)
- `upstream` (`createBuildingModel.response.502.upstream`; unknown, optional)
- `detail` (`createBuildingModel.response.502.detail`; string, optional)

### 504

The 3D service did not answer within the proxy timeout.

#### Example

```json
{
  "error": "string",
  "detail": "string"
}
```

- `error` (`createBuildingModel.response.504.error`; string, optional)
- `detail` (`createBuildingModel.response.504.detail`; string, optional)


Source: https://docs.aireon.ch/res/create-building-model/index.md
