Semaphor

Get domain template

Returns the full template for a semantic domain, including its datasets, field classifications, relationships, calculated metrics, and calculated dimensions.

This endpoint requires write access to the domain (Author role or above), since templates are typically read in the context of editing.

If the stored template is corrupted or uses an unrecognized format, the endpoint returns 400 so you can replace it with a valid template.

GET
/api/v1/domains/{domainId}/template

Authorization

BearerAuth
AuthorizationBearer <token>

A project-scoped access token. Generate one via the Token API with your projectId and projectSecret.

In: header

Path Parameters

domainId*string

The unique identifier of the semantic domain.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X get "https://semaphor.cloud/api/v1/domains/domain_abc123/template"
{
  "template": {
    "schemaVersion": "2.0",
    "id": "domain_abc123",
    "name": "sales_metrics",
    "label": "Sales Metrics",
    "description": "Revenue and order tracking",
    "datasets": [
      {
        "name": "orders",
        "label": "Orders",
        "type": "physical",
        "connectionId": "conn_1",
        "connectionType": "PostgreSQL",
        "catalog": "string",
        "schema": "public",
        "table": "orders",
        "sql": "string",
        "primaryKey": [
          "order_id"
        ],
        "fields": {
          "identifiers": [
            {}
          ],
          "dimensions": [
            {}
          ],
          "metrics": [
            {}
          ]
        }
      }
    ],
    "relationships": [
      {
        "id": "string",
        "name": "orders_to_customers",
        "sourceDataset": "orders",
        "sourceFields": [
          "customer_id"
        ],
        "targetDataset": "customers",
        "targetFields": [
          "id"
        ],
        "cardinality": "many_to_one",
        "defaultJoinType": "LEFT",
        "isAutoJoin": true,
        "joinPriority": 10,
        "discoveredBy": "ai",
        "confidence": "high",
        "isActive": true,
        "description": "string"
      }
    ],
    "calculatedMetrics": {},
    "calculatedDimensions": {},
    "grainMappings": [
      {}
    ]
  }
}
{
  "error": "string",
  "details": {},
  "errors": [
    {
      "code": "SCHEMA",
      "message": "Template schema error at datasets.0.name: Required",
      "severity": "error",
      "hint": "Update the domain template shape to match the semantic schema.",
      "context": {}
    }
  ],
  "warnings": [
    {
      "code": "SCHEMA",
      "message": "Template schema error at datasets.0.name: Required",
      "severity": "error",
      "hint": "Update the domain template shape to match the semantic schema.",
      "context": {}
    }
  ]
}
{
  "error": "string",
  "details": {},
  "errors": [
    {
      "code": "SCHEMA",
      "message": "Template schema error at datasets.0.name: Required",
      "severity": "error",
      "hint": "Update the domain template shape to match the semantic schema.",
      "context": {}
    }
  ],
  "warnings": [
    {
      "code": "SCHEMA",
      "message": "Template schema error at datasets.0.name: Required",
      "severity": "error",
      "hint": "Update the domain template shape to match the semantic schema.",
      "context": {}
    }
  ]
}
{
  "error": "string",
  "details": {},
  "errors": [
    {
      "code": "SCHEMA",
      "message": "Template schema error at datasets.0.name: Required",
      "severity": "error",
      "hint": "Update the domain template shape to match the semantic schema.",
      "context": {}
    }
  ],
  "warnings": [
    {
      "code": "SCHEMA",
      "message": "Template schema error at datasets.0.name: Required",
      "severity": "error",
      "hint": "Update the domain template shape to match the semantic schema.",
      "context": {}
    }
  ]
}
{
  "error": "string",
  "details": {},
  "errors": [
    {
      "code": "SCHEMA",
      "message": "Template schema error at datasets.0.name: Required",
      "severity": "error",
      "hint": "Update the domain template shape to match the semantic schema.",
      "context": {}
    }
  ],
  "warnings": [
    {
      "code": "SCHEMA",
      "message": "Template schema error at datasets.0.name: Required",
      "severity": "error",
      "hint": "Update the domain template shape to match the semantic schema.",
      "context": {}
    }
  ]
}