Agency Website API Integration Guide

This guide is for frontend/consumer developers integrating the agency website platform APIs introduced in the latest backend changes.

It covers:

  • admin-side website configuration APIs
  • consumer/public rendering APIs
  • collections/pages/builders integration
  • lead capture from public property pages
  • property visibility masking behavior

1) Base URLs and auth

Admin APIs (agency dashboard use)

  • Base path: /admin/websites/
  • Auth: Authorization: Bearer <partner_access_token>
  • Tenant scope: inferred from token (agency_id)

Public APIs (consumer website use)

  • Base path: /public/websites/
  • Auth: none
  • Tenant resolution: by request host header/domain (AgencyWebsite.domain_name)

  1. Admin creates website settings (domain, title, publish status)
  2. Admin creates sections for homepage (ordered)
  3. Admin creates social links, pages, collections, builders, and links properties
  4. Consumer site calls bootstrap API
  5. Consumer site renders sections and calls relevant detail APIs
  6. Consumer submits inquiry from property page
  7. Admin sees lead + activity metadata with consent/context

3) Admin APIs (what each API is for)

All below are DRF viewsets and support standard CRUD routes:

  • GET /admin/websites/<resource>/
  • POST /admin/websites/<resource>/
  • GET /admin/websites/<resource>/{id}/
  • PATCH /admin/websites/<resource>/{id}/
  • DELETE /admin/websites/<resource>/{id}/

List endpoints return:

  • items, results, nextCursor, hasMore, total, meta

3.1 Website settings

  • Resource: settings
  • Why: one website record per agency with domain + SEO/footer metadata

Create example:

{
  "domain_name": "acme-realty.example.com",
  "website_title": "Acme Realty",
  "is_published": true,
  "seo_title": "Acme Realty | Properties",
  "seo_description": "Find the best homes and offices",
  "footer_text": "Acme Realty Pvt Ltd"
}

3.2 Homepage sections

  • Resource: sections
  • Why: compose homepage in ordered blocks
  • Key fields:
  • page_type: currently home
  • section_type: header, hero, banners, property_list, property_collection, about_agency, builder_partnerships, footer
  • layout_type: default, banner_4, banner_2_horizontal, banner_2_vertical, banner_6, carousel
  • sort_order, is_enabled, config

Create property-collection section example:

{
  "website": 1,
  "page_type": "home",
  "section_type": "property_collection",
  "layout_type": "default",
  "sort_order": 5,
  "heading": "Featured Homes",
  "is_enabled": true,
  "config": {
    "collection_slug": "featured-homes"
  }
}

Validation note:

  • property_collection requires config.collection_slug
  • property_list may include config.filters object
  • Resource: social-links
  • Why: configurable footer/header social links without hardcoding platforms

Create example:

{
  "website": 1,
  "platform_key": "instagram",
  "label": "Instagram",
  "url": "https://instagram.com/acmerealty",
  "icon_hint": "instagram",
  "sort_order": 1,
  "is_enabled": true
}

3.4 Pages (raw HTML)

  • Resource: pages
  • Why: simple CMS-like pages (About, Terms, Privacy) using raw HTML

Create example:

{
  "website": 1,
  "slug": "about-us",
  "title": "About Us",
  "raw_html": "<h1>About Acme Realty</h1><p>Trusted advisors.</p>",
  "is_published": true,
  "seo_title": "About Acme Realty",
  "seo_description": "Learn about Acme Realty"
}

3.5 Property collections

  • Resource: collections
  • Why: curated property groups for homepage blocks

Create collection:

{
  "website": 1,
  "slug": "featured-homes",
  "title": "Featured Homes",
  "description": "Handpicked listings",
  "is_published": true,
  "sort_order": 1
}

Collection items resource: collection-items

  • Why: attach properties to collection in explicit order

Create item example:

{
  "collection": 10,
  "property": 1124,
  "sort_order": 1
}
  • Builders resource: builders
  • Links resource: property-builder-links
  • Why: show builder partnerships and filter properties by builder

Create builder:

{
  "name": "Skyline Builders",
  "slug": "skyline-builders",
  "logo_url": "https://cdn.example.com/builders/skyline.png",
  "website_url": "https://skyline.example.com",
  "description": "Premium developer",
  "is_active": true,
  "sort_order": 1
}

Link property to builder:

{
  "property": 1124,
  "builder": 3
}

3.7 Legacy website endpoint

  • Resource: legacy
  • Why: backward compatibility with old SellerCompany website model
  • New integrations should not use this.

4) Public APIs (consumer website rendering)

4.1 Bootstrap

  • GET /public/websites/site/bootstrap/
  • Why: first API call on website load; returns site metadata, enabled ordered sections, social links

Example response shape:

{
  "website": {
    "id": 1,
    "title": "Acme Realty",
    "domain_name": "acme-realty.example.com",
    "seo_title": "Acme Realty | Properties",
    "seo_description": "Find the best homes and offices",
    "footer_text": "Acme Realty Pvt Ltd"
  },
  "sections_count": 6,
  "sections": [
    {
      "id": 11,
      "section_type": "hero",
      "layout_type": "default",
      "sort_order": 2,
      "heading": "Find your next property",
      "config": {
        "image": "https://cdn.example.com/hero.jpg"
      }
    }
  ],
  "social_links": [
    {
      "platform_key": "instagram",
      "url": "https://instagram.com/acmerealty"
    }
  ]
}

4.2 Page by slug

  • GET /public/websites/site/pages/{slug}/
  • Why: render raw HTML static page

Example:

  • GET /public/websites/site/pages/about-us/

4.3 Collection by slug

  • GET /public/websites/site/collections/{slug}/
  • Why: render curated collection block with masked property payloads

Example:

  • GET /public/websites/site/collections/featured-homes/

4.4 Property list

  • GET /public/websites/properties/
  • Why: listing/search/filter endpoint for consumer property pages
  • Filters:
  • property_category
  • transaction_type
  • city
  • builder (builder slug)
  • collection (collection slug)
  • Pagination:
  • request: limit, cursor
  • response: items, nextCursor, hasMore, total

Example:

  • GET /public/websites/properties/?city=Pune&builder=skyline-builders&limit=24

4.5 Property detail by public slug

  • GET /public/websites/properties/{public_slug}/
  • Why: property details page for website route
  • Includes masked fields + active builders array.

Example:

  • GET /public/websites/properties/marina-heights/

5) Lead capture (public inquiry)

  • POST /public/websites/inquiries/
  • Why: convert website visitor inquiry into CRM lead

Request example:

{
  "property_slug": "marina-heights",
  "first_name": "Riya",
  "last_name": "Patil",
  "email": "riya@example.com",
  "phone": "+919811112222",
  "message": "Need site visit",
  "contact_consent": true,
  "contact_via_sms": true,
  "contact_via_email": true,
  "page_path": "/properties/marina-heights",
  "utm": {
    "source": "google",
    "campaign": "summer-sale"
  }
}

Response example:

{
  "id": 2429,
  "status": "new",
  "source": "website",
  "created_at": "2026-04-25T07:59:06+0000"
}

Backend behavior:

  • creates Lead with source=website
  • creates LeadActivity with metadata:
  • consent flags
  • domain
  • page_path
  • utm
  • user-agent
  • IP

6) Property visibility masking (important for frontend)

Public APIs apply visibility rules before returning property data:

  • Legacy booleans on property:
  • show_address, show_price, show_brokerage
  • New public_visibility flags:
  • showPhotos
  • showDescription
  • showAddress
  • showPricing
  • showBrokerage
  • showAmenities
  • showLeaseTerms
  • showRentalDetails
  • showCommercialDetails

Meaning:

  • If pricing is hidden, pricing_rows can be empty even if pricing exists in admin.
  • If address is hidden, address can be null.
  • If amenities are hidden, amenities returns empty.

Frontend should trust API payload as final publishable shape.


7) Common frontend pitfalls

  • Always call bootstrap with correct domain/host context.
  • Do not assume all sections exist; render based on sections list.
  • Use section_type + layout_type to choose component variant.
  • For property_collection sections, use config.collection_slug and call collection API.
  • For pages, use slug route and render returned raw_html carefully.
  • For inquiry form, enforce required fields (property_slug, phone, contact_consent).

8) Quick endpoint checklist

Admin:

  • /admin/websites/settings/
  • /admin/websites/sections/
  • /admin/websites/social-links/
  • /admin/websites/pages/
  • /admin/websites/collections/
  • /admin/websites/collection-items/
  • /admin/websites/builders/
  • /admin/websites/property-builder-links/

Public:

  • /public/websites/site/bootstrap/
  • /public/websites/site/pages/{slug}/
  • /public/websites/site/collections/{slug}/
  • /public/websites/properties/
  • /public/websites/properties/{public_slug}/
  • /public/websites/inquiries/