Back to API Reference

Domains API

Access domain-specific template catalogs with pre-configured data structures and generation rules.

---

Base URL

https://app.datapublisher.io/api/domains

---

Authentication

All endpoints require JWT authentication via Authorization: Bearer header.

---

Overview

The Domains API provides:

Available Domains:

Domain Features:

---

List Domains

Get all available domain templates.

Endpoint: GET /

Headers:

Authorization: Bearer 

Response (200 OK):

{

"success": true,

"domains": [

{

"id": "real-estate",

"name": "Real Estate",

"description": "Property listing templates with photos, specs, and agent info",

"icon": "🏠",

"templateCount": 5,

"tableCount": 3,

"sampleDataRows": 10,

"industries": ["real-estate", "property-management"],

"popularity": 95

},

{

"id": "ecommerce",

"name": "E-commerce",

"description": "Product catalog templates with images, specs, and pricing",

"icon": "🛒",

"templateCount": 8,

"tableCount": 4,

"sampleDataRows": 25,

"industries": ["retail", "ecommerce", "manufacturing"],

"popularity": 88

},

{

"id": "healthcare",

"name": "Healthcare",

"description": "Patient reports, medical records, and care documents",

"icon": "⚕️",

"templateCount": 6,

"tableCount": 5,

"sampleDataRows": 15,

"industries": ["healthcare", "medical"],

"popularity": 76

}

],

"totalCount": 3

}

---

Get Domain Details

Get detailed information about a specific domain.

Endpoint: GET /:domainId

Headers:

Authorization: Bearer 

Path Parameters:

Response (200 OK):

{

"success": true,

"domain": {

"id": "real-estate",

"name": "Real Estate",

"description": "Property listing templates with photos, specs, and agent info",

"longDescription": "Complete real estate documentation system with property listings, brochures, and agent profiles. Includes automatic joins between properties, agents, and photos.",

"icon": "🏠",

"dataStructure": {

"tables": [

{

"name": "Properties",

"description": "Property listings",

"primaryKey": "PropertyID",

"fields": [

{ "name": "PropertyID", "type": "string", "required": true },

{ "name": "Address", "type": "string", "required": true },

{ "name": "City", "type": "string", "required": true },

{ "name": "State", "type": "string", "required": true },

{ "name": "ZipCode", "type": "string", "required": true },

{ "name": "Price", "type": "currency", "required": true },

{ "name": "Bedrooms", "type": "number", "required": true },

{ "name": "Bathrooms", "type": "number", "required": true },

{ "name": "SquareFeet", "type": "number", "required": true },

{ "name": "YearBuilt", "type": "number", "required": false },

{ "name": "Description", "type": "text", "required": true },

{ "name": "AgentID", "type": "string", "required": true, "foreignKey": "Agents.AgentID" }

],

"rowCount": 10

},

{

"name": "Agents",

"description": "Real estate agents",

"primaryKey": "AgentID",

"fields": [

{ "name": "AgentID", "type": "string", "required": true },

{ "name": "AgentName", "type": "string", "required": true },

{ "name": "Phone", "type": "string", "required": true },

{ "name": "Email", "type": "email", "required": true },

{ "name": "Photo", "type": "url", "required": false },

{ "name": "LicenseNumber", "type": "string", "required": true },

{ "name": "YearsExperience", "type": "number", "required": false }

],

"rowCount": 5

},

{

"name": "PropertyPhotos",

"description": "Property photo gallery",

"primaryKey": "PhotoID",

"fields": [

{ "name": "PhotoID", "type": "string", "required": true },

{ "name": "PropertyID", "type": "string", "required": true, "foreignKey": "Properties.PropertyID" },

{ "name": "PhotoURL", "type": "url", "required": true },

{ "name": "Caption", "type": "string", "required": false },

{ "name": "IsFeatured", "type": "boolean", "required": false },

{ "name": "DisplayOrder", "type": "number", "required": false }

],

"rowCount": 30

}

],

"relationships": [

{

"from": "Properties",

"to": "Agents",

"type": "many-to-one",

"joinOn": "Properties.AgentID = Agents.AgentID"

},

{

"from": "PropertyPhotos",

"to": "Properties",

"type": "many-to-one",

"joinOn": "PropertyPhotos.PropertyID = Properties.PropertyID"

}

]

},

"templates": [

{

"id": "property-brochure",

"name": "Property Brochure",

"description": "Full-color property brochure with photos",

"thumbnail": "https://app.datapublisher.io/domains/real-estate/thumbnails/property-brochure.png",

"useTables": ["Properties", "Agents", "PropertyPhotos"]

},

{

"id": "property-listing",

"name": "Property Listing Sheet",

"description": "Single-page property listing",

"thumbnail": "https://app.datapublisher.io/domains/real-estate/thumbnails/property-listing.png",

"useTables": ["Properties", "Agents"]

}

],

"useCases": [

"Generate property brochures for listings",

"Create agent profile sheets",

"Produce bulk property catalogs",

"Mail merge for property mailings"

],

"industries": ["real-estate", "property-management"],

"popularity": 95,

"sampleDataIncluded": true

}

}

---

Get Domain Templates

List all templates for a specific domain.

Endpoint: GET /:domainId/templates

Headers:

Authorization: Bearer 

Path Parameters:

Response (200 OK):

{

"success": true,

"domainId": "real-estate",

"domainName": "Real Estate",

"templates": [

{

"id": "property-brochure",

"name": "Property Brochure",

"description": "Full-color property brochure with photos",

"thumbnail": "https://app.datapublisher.io/domains/real-estate/thumbnails/property-brochure.png",

"previewPdf": "https://app.datapublisher.io/domains/real-estate/previews/property-brochure.pdf",

"useTables": ["Properties", "Agents", "PropertyPhotos"],

"features": [

"Featured photo on cover",

"Property details grid",

"Photo gallery (up to 10 photos)",

"Agent contact info with photo",

"Map placeholder"

],

"complexity": "medium",

"pageCount": 2

}

],

"totalCount": 1

}

---

Get Sample Data

Preview sample data for a domain.

Endpoint: GET /:domainId/sample-data

Headers:

Authorization: Bearer 

Path Parameters:

Query Parameters:

Response (200 OK):

{

"success": true,

"domainId": "real-estate",

"domainName": "Real Estate",

"sampleData": {

"Properties": [

{

"PropertyID": "PROP001",

"Address": "123 Oak Street",

"City": "San Francisco",

"State": "CA",

"ZipCode": "94102",

"Price": "$1,250,000",

"Bedrooms": 3,

"Bathrooms": 2.5,

"SquareFeet": 2100,

"YearBuilt": 2015,

"Description": "Beautiful modern home in prime location...",

"AgentID": "AGT001"

}

],

"Agents": [

{

"AgentID": "AGT001",

"AgentName": "Sarah Johnson",

"Phone": "(415) 555-1234",

"Email": "sarah@realestate.com",

"Photo": "https://app.datapublisher.io/domains/real-estate/sample-data/agents/sarah.jpg",

"LicenseNumber": "CA-DRE-01234567",

"YearsExperience": 12

}

],

"PropertyPhotos": [

{

"PhotoID": "PHOTO001",

"PropertyID": "PROP001",

"PhotoURL": "https://app.datapublisher.io/domains/real-estate/sample-data/photos/prop001-1.jpg",

"Caption": "Front exterior view",

"IsFeatured": true,

"DisplayOrder": 1

}

]

},

"dataInfo": {

"Properties": { "rowCount": 10 },

"Agents": { "rowCount": 5 },

"PropertyPhotos": { "rowCount": 30 }

}

}

---

Clone Domain to Account

Copy domain structure and templates to user account.

Endpoint: POST /:domainId/clone

Headers:

Authorization: Bearer 

Content-Type: application/json

Path Parameters:

Request Body:

{

"includeSampleData": true,

"includeAllTemplates": true,

"customPrefix": "MyRealEstate"

}

Response (200 OK):

{

"success": true,

"clonedResources": {

"dataSetId": "dataset-uuid",

"csvFiles": [

{

"id": "csv-uuid-1",

"fileName": "MyRealEstate-Properties.csv",

"rowCount": 10,

"tableName": "Properties"

},

{

"id": "csv-uuid-2",

"fileName": "MyRealEstate-Agents.csv",

"rowCount": 5,

"tableName": "Agents"

},

{

"id": "csv-uuid-3",

"fileName": "MyRealEstate-PropertyPhotos.csv",

"rowCount": 30,

"tableName": "PropertyPhotos"

}

],

"templates": [

{

"id": "template-uuid-1",

"name": "Property Brochure",

"fileName": "property-brochure.docx"

}

],

"autoJoinConfig": {

"enabled": true,

"relationships": [

{

"from": "Properties",

"to": "Agents",

"joinOn": "Properties.AgentID = Agents.AgentID"

}

]

}

},

"message": "Domain cloned successfully to your account",

"nextSteps": [

"Replace sample data with your actual data",

"Generate documents using the templates",

"Customize templates as needed"

]

}

---

Rate Limiting

---

Common Error Codes

| Status Code | Description |

|-------------|-------------|

| 400 | Invalid domain ID or clone options |

| 401 | Unauthorized - invalid JWT |

| 404 | Domain not found |

| 429 | Rate limit exceeded |

| 500 | Clone operation failed |

---

Usage Examples

JavaScript

// List all domains

async function listDomains() {

const response = await fetch('https://app.datapublisher.io/api/domains', {

headers: { 'Authorization': Bearer ${jwtToken} }

});

const { domains } = await response.json();

return domains;

}

// Get domain details

async function getDomainDetails(domainId) {

const response = await fetch(https://app.datapublisher.io/api/domains/${domainId}, {

headers: { 'Authorization': Bearer ${jwtToken} }

});

const { domain } = await response.json();

return domain;

}

// Get domain templates

async function getDomainTemplates(domainId) {

const response = await fetch(https://app.datapublisher.io/api/domains/${domainId}/templates, {

headers: { 'Authorization': Bearer ${jwtToken} }

});

const { templates } = await response.json();

return templates;

}

// Preview sample data

async function getSampleData(domainId) {

const response = await fetch(https://app.datapublisher.io/api/domains/${domainId}/sample-data, {

headers: { 'Authorization': Bearer ${jwtToken} }

});

const { sampleData } = await response.json();

return sampleData;

}

// Clone domain to account

async function cloneDomain(domainId) {

const response = await fetch(https://app.datapublisher.io/api/domains/${domainId}/clone, {

method: 'POST',

headers: {

'Authorization': Bearer ${jwtToken},

'Content-Type': 'application/json'

},

body: JSON.stringify({

includeSampleData: true,

includeAllTemplates: true,

customPrefix: 'My'

})

});

const { clonedResources } = await response.json();

return clonedResources;

}

---

Best Practices

  • Preview First: Review domain structure and sample data before cloning
  • Sample Data: Keep sample data initially for testing
  • Customization: Customize templates after cloning
  • Data Replacement: Replace sample data with real data progressively
  • Relationships: Understand table relationships for proper joins
  • Templates: Start with provided templates, then customize
  • Testing: Generate test documents before production use
  • ---

    Related Documentation