Semaphor

Commit template to GitHub

Pushes the current saved template to your organization's connected GitHub repository. This lets you version-control your semantic domain definitions alongside your application code.

Important: This endpoint commits what is already saved -- it does not accept template changes. Save your template first using PUT /api/v1/domains/{domainId}/template, then commit.

The response includes both the commit result (SHA and URL) and the current template. If the template can't be parsed, template will be null and templateError will explain the issue.

Your organization must have a GitHub integration configured for this endpoint to work. See the errorCode field in failure responses for specific troubleshooting guidance.

POST
/api/v1/domains/{domainId}/template/commit

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.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X post "https://semaphor.cloud/api/v1/domains/domain_abc123/template/commit" \  -H "Content-Type: application/json" \  -d '{    "commitMessage": "Update sales domain template"  }'
{
  "commit": {
    "success": true,
    "commitSha": "abc123def456",
    "commitUrl": "https://github.com/example/repo/commit/abc123def456"
  },
  "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": [
      {}
    ]
  },
  "templateError": "string"
}
{
  "commit": {
    "success": false,
    "error": "string",
    "errorCode": "NOT_CONFIGURED"
  },
  "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": [
      {}
    ]
  },
  "templateError": "string"
}
{
  "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": {}
    }
  ]
}
{
  "commit": {
    "success": false,
    "error": "string",
    "errorCode": "NOT_CONFIGURED"
  },
  "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": [
      {}
    ]
  },
  "templateError": "string"
}
{
  "commit": {
    "success": false,
    "error": "string",
    "errorCode": "NOT_CONFIGURED"
  },
  "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": [
      {}
    ]
  },
  "templateError": "string"
}
{
  "commit": {
    "success": false,
    "error": "string",
    "errorCode": "NOT_CONFIGURED"
  },
  "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": [
      {}
    ]
  },
  "templateError": "string"
}
{
  "commit": {
    "success": false,
    "error": "string",
    "errorCode": "NOT_CONFIGURED"
  },
  "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": [
      {}
    ]
  },
  "templateError": "string"
}
{
  "commit": {
    "success": false,
    "error": "string",
    "errorCode": "NOT_CONFIGURED"
  },
  "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": [
      {}
    ]
  },
  "templateError": "string"
}