Skip to main content

Code snippets

Not an SDK

These snippets are a starting point, not a supported SDK. No SDK exists today — you use the HTTP API directly, which is stable and fully documented in the reference.

First API call — Python

import os
import requests
BASE = "https://api.etg24.de/propertymanagement/v2"
headers = {"Authorization": f"Bearer {os.environ['ETG24_API_KEY']}"}
response = requests.get(f"{BASE}/query/contacts", headers=headers)
response.raise_for_status()
print(response.json())

First API call — JavaScript (Node.js)

const BASE = 'https://api.etg24.de/propertymanagement/v2'
const headers = {Authorization: `Bearer ${process.env.ETG24_API_KEY}`}
const response = await fetch(`${BASE}/query/contacts`, {headers})
if (!response.ok) throw new Error(`HTTP ${response.status}`)
console.log(await response.json())

MCP connection — Python

import os
from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client
MCP_URL = "https://api.etg24.de/propertymanagement/v2/mcp"
headers = {"Authorization": f"Bearer {os.environ['ETG24_API_KEY']}"}
async with streamablehttp_client(MCP_URL, headers=headers) as (read, write, _):
async with ClientSession(read, write) as session:
tools = await session.list_tools()
print([tool.name for tool in tools.tools])

MCP connection — JavaScript (Node.js)

import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
const transport = new SSEClientTransport(
new URL('https://api.etg24.de/propertymanagement/v2/mcp'),
{
requestInit: {
headers: { Authorization: `Bearer ${process.env.ETG24_API_KEY}` }
}
}
);
const client = new Client({ name: 'etg24-integration', version: '1.0.0' }, { capabilities: {} });
await client.connect(transport);
const result = await client.listTools();
console.log(result.tools.map((tool) => tool.name));

The examples above use the Property Management API endpoint with a tenant-bound (company) key. Agents acting for a user connect to the Internal API endpoint (https://api.etg24.de/api/internal/v1/mcp) with a user-bound key — see which MCP endpoint to use.

Prefer a guided setup inside your favorite app? See Connect MCP to your AI agent for Claude, ChatGPT, Mistral, Perplexity, opencode and more.

Creating a contact (command example)

Commands are POST requests to /command/<type>:

Terminal window
curl -s -X POST "https://api.etg24.de/propertymanagement/v2/command/contacts.create" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"contact": {"firstName": "Ada", "lastName": "Lovelace"}}'

Remember the CQRS split: commands change state, queries read it — and read-only keys can only run queries.