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

# Import table group

> Create a new table group from a data model

## OpenAPI

````json POST /table/group/import
{
  "openapi": "3.0.3",
  "info": {
    "title": "Management API Reference",
    "version": "2.0.0",
    "description": "API Documentation for the Supermetrics Management API. For more information, visit https://supermetrics.com.",
    "termsOfService": "https://supermetrics.com/terms-of-service",
    "contact": {
      "name": "Supermetrics Suppot",
      "email": "support@supermetrics.com",
      "url": "https://supermetrics.com/support"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    },
    "x-api-id": "sm-management-api",
    "x-audience": "public"
  },
  "servers": [
    {
      "url": "https://api.supermetrics.com/v2",
      "description": "Global production public Supermetrics Management API base path.",
      "x-internal": "false"
    }
  ],
  "tags": [
    {
      "name": "API Keys",
      "description": "Manage API keys to access Supermetrics API"
    },
    {
      "name": "Data Source Logins",
      "description": "Access your data source authentications"
    },
    {
      "name": "Data Source Login Links",
      "description": "Create single-use data source login links"
    },
    {
      "name": "Saved Queries",
      "description": "Manage queries saved in Query Manager"
    },
    {
      "name": "Table Groups",
      "description": "Manage your team's table groups"
    },
    {
      "name": "Team Lists",
      "description": "Manage centralized team lists for your queries"
    },
    {
      "name": "Team Settings",
      "description": "Configure general settings for your team"
    },
    {
      "name": "Data Transfers",
      "description": "Create, configure, and manage Data Warehouse transfers"
    },
    {
      "name": "Transfer Runs",
      "description": "Monitor execution history of Data Warehouse transfers"
    },
    {
      "name": "Data Backfills",
      "description": "Manage historical data backfills for your Data Warehouse transfers"
    },
    {
      "name": "Data Destinations",
      "description": "Create, configure, and manage Data Warehouse destinations"
    },
    {
      "name": "Data Source Connections",
      "description": "Create and manage data source connections for Data Warehouse transfers"
    },
    {
      "name": "Data Blending",
      "description": "Create and manage Data Blending"
    },
    {
      "name": "Custom Fields",
      "description": "Create and manage Custom Fields"
    }
  ],
  "externalDocs": {
    "description": "Find out more about Supermetrics Management API",
    "url": "https://docs.supermetrics.com/apidocs/management-api"
  },
  "paths": {
    "/table/group/import": {
      "post": {
        "summary": "Import table group",
        "description": "Create a new table group from a data model",
        "operationId": "importTableGroup",
        "tags": [
          "Table Groups"
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "description": "Table group import data including version, group configuration, and table definitions",
          "required": "true",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "version",
                  "group",
                  "tables"
                ],
                "properties": {
                  "version": {
                    "type": "integer",
                    "format": "int32",
                    "minimum": "1",
                    "maximum": "100",
                    "description": "Data model version for the received data"
                  },
                  "group": {
                    "$ref": "#/components/schemas/TableGroupImport"
                  },
                  "tables": {
                    "type": "array",
                    "maxItems": "1000",
                    "description": "List of table objects",
                    "items": {
                      "$ref": "#/components/schemas/TableDefinition"
                    }
                  },
                  "fields": {
                    "type": "array",
                    "maxItems": "10000",
                    "description": "List of field objects",
                    "items": {
                      "$ref": "#/components/schemas/FieldDefinition"
                    }
                  }
                }
              },
              "example": {
                "version": "1",
                "group": {
                  "group_name": "Marketing Analytics",
                  "ds_id": "GAWA",
                  "table_prefix": "MKT"
                },
                "tables": [
                  {
                    "table_name": "SESSIONS",
                    "table_partition": "date",
                    "fields": [
                      "session_id",
                      "date",
                      "users"
                    ]
                  }
                ],
                "fields": [
                  {
                    "field_id": "session_id",
                    "target_name": "session_id"
                  },
                  {
                    "field_id": "date",
                    "target_name": "session_date"
                  },
                  {
                    "field_id": "users",
                    "target_name": "user_count"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Table group imported successfully",
            "headers": {
              "Content-Type": {
                "$ref": "#/components/headers/Content-Type"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "Access-Control-Allow-Origin": {
                "$ref": "#/components/headers/Access-Control-Allow-Origin"
              },
              "Location": {
                "$ref": "#/components/headers/Location"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TableGroupResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/TableGroupImportError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/TableGroupNotFound"
          },
          "409": {
            "$ref": "#/components/responses/TableGroupNameConflict"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/TableGroupCreateFailed"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "TableGroupImport": {
        "type": "object",
        "required": [
          "group_name",
          "ds_id"
        ],
        "properties": {
          "group_name": {
            "type": "string",
            "maxLength": "255",
            "description": "Table group name"
          },
          "ds_id": {
            "type": "string",
            "maxLength": "50",
            "description": "Data source ID"
          },
          "table_prefix": {
            "type": "string",
            "maxLength": "15",
            "description": "Prefix to table names. Enforced into upper snake case. Maximum length is 15 characters. Appended with an underscore."
          }
        }
      },
      "TableDefinition": {
        "type": "object",
        "required": [
          "table_name",
          "fields"
        ],
        "properties": {
          "table_name": {
            "type": "string",
            "maxLength": "255",
            "description": "Table name. Enforced into upper snake case."
          },
          "table_partition": {
            "type": "string",
            "maxLength": "50",
            "description": "Table partition. Either date or none.",
            "enum": [
              "date",
              "none"
            ],
            "default": "date"
          },
          "report_type": {
            "type": "string",
            "nullable": "true",
            "maxLength": "255",
            "description": "Data source report type. Required for some data sources."
          },
          "fields": {
            "type": "array",
            "maxItems": "1000",
            "description": "List of field IDs for the table",
            "items": {
              "type": "string",
              "maxLength": "100"
            }
          }
        }
      },
      "FieldDefinition": {
        "type": "object",
        "required": [
          "field_id"
        ],
        "properties": {
          "field_id": {
            "type": "string",
            "maxLength": "100",
            "description": "Field ID that appears in one of the table objects"
          },
          "field_name": {
            "type": "string",
            "maxLength": "255",
            "description": "Data source field name",
            "readOnly": "true"
          },
          "display_name": {
            "type": "string",
            "maxLength": "255",
            "description": "Field display name",
            "readOnly": "true"
          },
          "target_name": {
            "type": "string",
            "maxLength": "255",
            "description": "Field name in target table. Defaults to field ID in lower snake case."
          },
          "data_type": {
            "type": "string",
            "maxLength": "100",
            "description": "Field data type",
            "readOnly": "true"
          }
        }
      },
      "TableGroupResponse": {
        "type": "object",
        "properties": {
          "meta": {
            "$ref": "#/components/schemas/ResponseMeta"
          },
          "data": {
            "$ref": "#/components/schemas/TableGroup"
          }
        }
      },
      "ResponseMeta": {
        "type": "object",
        "properties": {
          "request_id": {
            "type": "string",
            "maxLength": "50",
            "pattern": "^[A-Za-z0-9_-]+$",
            "description": "API request ID"
          }
        }
      },
      "TableGroup": {
        "type": "object",
        "properties": {
          "@type": {
            "type": "string",
            "enum": [
              "table_group"
            ]
          },
          "group_id": {
            "type": "string",
            "maxLength": "50",
            "description": "Supermetrics table group ID"
          },
          "name": {
            "type": "string",
            "maxLength": "255",
            "description": "Table group name"
          },
          "links": {
            "type": "object",
            "properties": {
              "enclosure": {
                "$ref": "#/components/schemas/ResourceURL"
              }
            }
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "meta": {
            "$ref": "#/components/schemas/ResponseMeta"
          },
          "error": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "ResourceURL": {
        "type": "object",
        "properties": {
          "href": {
            "type": "string",
            "maxLength": "500",
            "description": "Full URL to the resource"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "maxLength": "100",
            "description": "Error code"
          },
          "message": {
            "type": "string",
            "maxLength": "255",
            "description": "Error message"
          },
          "description": {
            "type": "string",
            "maxLength": "255",
            "description": "Error description"
          }
        }
      }
    },
    "headers": {
      "Content-Type": {
        "description": "HTTP response content type",
        "schema": {
          "type": "string",
          "maxLength": "255",
          "enum": [
            "application/json"
          ],
          "example": "application/json"
        }
      },
      "X-RateLimit-Limit": {
        "description": "Request limit per hour",
        "schema": {
          "type": "integer",
          "format": "int32",
          "minimum": "1",
          "maximum": "10000",
          "example": "100"
        }
      },
      "X-RateLimit-Remaining": {
        "description": "Remaining requests in current window",
        "schema": {
          "type": "integer",
          "format": "int32",
          "minimum": "0",
          "maximum": "10000",
          "example": "49"
        }
      },
      "Access-Control-Allow-Origin": {
        "description": "CORS header",
        "schema": {
          "type": "string",
          "maxLength": "255",
          "enum": [
            "*"
          ],
          "example": "*"
        }
      },
      "Location": {
        "description": "API URL of the created item",
        "schema": {
          "type": "string",
          "maxLength": "255",
          "example": "items/{id}"
        }
      }
    },
    "responses": {
      "TableGroupImportError": {
        "description": "Table Group Import Error",
        "headers": {
          "Content-Type": {
            "$ref": "#/components/headers/Content-Type"
          },
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          },
          "Access-Control-Allow-Origin": {
            "$ref": "#/components/headers/Access-Control-Allow-Origin"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "string",
                  "maxLength": "100",
                  "enum": [
                    "TABLE_GROUP_IMPORT_ERROR"
                  ]
                },
                "message": {
                  "type": "string",
                  "maxLength": "255"
                }
              }
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Unauthorized - invalid or missing authentication",
        "headers": {
          "Content-Type": {
            "$ref": "#/components/headers/Content-Type"
          },
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          },
          "Access-Control-Allow-Origin": {
            "$ref": "#/components/headers/Access-Control-Allow-Origin"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "TableGroupNotFound": {
        "description": "Table Group Not Found",
        "headers": {
          "Content-Type": {
            "$ref": "#/components/headers/Content-Type"
          },
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          },
          "Access-Control-Allow-Origin": {
            "$ref": "#/components/headers/Access-Control-Allow-Origin"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "string",
                  "maxLength": "100",
                  "enum": [
                    "TABLE_GROUP_NOT_FOUND"
                  ]
                },
                "message": {
                  "type": "string",
                  "maxLength": "255"
                }
              }
            }
          }
        }
      },
      "TableGroupNameConflict": {
        "description": "Table Group Name Conflict",
        "headers": {
          "Content-Type": {
            "$ref": "#/components/headers/Content-Type"
          },
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          },
          "Access-Control-Allow-Origin": {
            "$ref": "#/components/headers/Access-Control-Allow-Origin"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "string",
                  "maxLength": "100",
                  "enum": [
                    "TABLE_GROUP_NAME_CONFLICT"
                  ]
                },
                "message": {
                  "type": "string",
                  "maxLength": "255"
                }
              }
            }
          }
        }
      },
      "UnprocessableEntity": {
        "description": "Unprocessable Entity - request validation failed",
        "headers": {
          "Content-Type": {
            "$ref": "#/components/headers/Content-Type"
          },
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          },
          "Access-Control-Allow-Origin": {
            "$ref": "#/components/headers/Access-Control-Allow-Origin"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "Too Many Requests - rate limit exceeded",
        "headers": {
          "Content-Type": {
            "$ref": "#/components/headers/Content-Type"
          },
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          },
          "Retry-After": {
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": "1",
              "maximum": "3600"
            },
            "description": "Number of seconds to wait before making another request"
          },
          "Access-Control-Allow-Origin": {
            "$ref": "#/components/headers/Access-Control-Allow-Origin"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "TableGroupCreateFailed": {
        "description": "Table Group Create Failed",
        "headers": {
          "Content-Type": {
            "$ref": "#/components/headers/Content-Type"
          },
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          },
          "Access-Control-Allow-Origin": {
            "$ref": "#/components/headers/Access-Control-Allow-Origin"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "string",
                  "maxLength": "100",
                  "enum": [
                    "TABLE_GROUP_CREATE_FAILED"
                  ]
                },
                "message": {
                  "type": "string",
                  "maxLength": "255"
                }
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Bearer token authentication. Include the token in the Authorization header:\n`Authorization: Bearer <your-token>`\n"
      }
    }
  }
}
````

