EstateHub

Administrator Announcements API

Base URL: http://localhost:8000/api/v1
Prefix: /admins/announcements
Auth: JWT Bearer token for an active admin
Headers: Content-Type: application/json


1. List Announcements

Retrieve announcements created for platform administration.

GET/admins/announcements/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

HTTP 200 OK

JSON
{
  "success": true,
  "message": "Announcements retrieved successfully.",
  "data": {
    "announcements": {
      "count": 1,
      "next": null,
      "previous": null,
      "results": [
        {
          "id": "7e8d7f4d-5f5c-4c78-9d95-6c5308d2c9c1",
          "title": "Maintenance notice",
          "message": "The platform will be unavailable briefly.",
          "audience": {
            "roles": [
              "buyer",
              "renter"
            ]
          },
          "priority": "normal",
          "channels": [
            "in_app"
          ],
          "status": "draft",
          "scheduled_at": null,
          "published_at": null,
          "created_by": "f9c8f4a4-1e32-4c2b-9f5c-14c5a965c3ef",
          "created_at": "2026-09-26T10:30:00Z",
          "updated_at": "2026-09-26T10:30:00Z"
        }
      ]
    }
  }
}

Notes

Default page size: 20. Maximum page size: 100.

Optional query parameters:

ParameterExamplePurpose
page1Pagination
page_size20Items per page
statusdraftFilter by status
priorityhighFilter by priority

Example:

HTTP
GET {{base_url}}/admins/announcements/?status=draft&priority=high&page=1&page_size=20

Valid statuses: draft, scheduled, published, failed.

Valid priorities: low, normal, high, urgent.


2. Create Announcement

Create a new announcement.

POST/admins/announcements/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}
Content-Type: application/json

Request Body

JSON
{
  "title": "Maintenance notice",
  "message": "The platform will be unavailable briefly.",
  "audience": {
    "roles": [
      "buyer",
      "renter"
    ]
  },
  "priority": "normal",
  "channels": [
    "in_app"
  ],
  "status": "draft",
  "scheduled_at": null
}

Success Example

HTTP 201 Created

JSON
{
  "success": true,
  "message": "Announcement created successfully.",
  "data": {
    "announcement": {
      "id": "7e8d7f4d-5f5c-4c78-9d95-6c5308d2c9c1",
      "title": "Maintenance notice",
      "message": "The platform will be unavailable briefly.",
      "audience": {
        "roles": [
          "buyer",
          "renter"
        ]
      },
      "priority": "normal",
      "channels": [
        "in_app"
      ],
      "status": "draft",
      "scheduled_at": null,
      "published_at": null,
      "created_by": "f9c8f4a4-1e32-4c2b-9f5c-14c5a965c3ef",
      "created_at": "2026-09-26T10:30:00Z",
      "updated_at": "2026-09-26T10:30:00Z"
    }
  }
}

Notes

Valid audience roles:

TEXT
buyer
renter
seller_owner
investor
agent
admin
all

The all role cannot be combined with other roles.

Valid channels:

TEXT
in_app
email
push
sms

status: "published" cannot be submitted directly. Use the publish endpoint.

If status is scheduled, scheduled_at is required.


3. Announcement Details

Retrieve one announcement.

GET/admins/announcements/{announcement_id}/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

HTTP 200 OK

JSON
{
  "success": true,
  "message": "Announcement retrieved successfully.",
  "data": {
    "announcement": {
      "id": "7e8d7f4d-5f5c-4c78-9d95-6c5308d2c9c1",
      "title": "Maintenance notice",
      "message": "The platform will be unavailable briefly.",
      "audience": {
        "roles": [
          "buyer",
          "renter"
        ]
      },
      "priority": "normal",
      "channels": [
        "in_app"
      ],
      "status": "draft",
      "scheduled_at": null,
      "published_at": null,
      "created_by": "f9c8f4a4-1e32-4c2b-9f5c-14c5a965c3ef",
      "created_at": "2026-09-26T10:30:00Z",
      "updated_at": "2026-09-26T10:30:00Z"
    }
  }
}

Notes

Missing announcement IDs return HTTP 404.


4. Update Announcement

Update an existing announcement.

PATCH/admins/announcements/{announcement_id}/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}
Content-Type: application/json

Request Body

JSON
{
  "title": "Updated maintenance notice",
  "priority": "high",
  "status": "scheduled",
  "scheduled_at": "2026-09-30T22:00:00Z"
}

Success Example

HTTP 200 OK

JSON
{
  "success": true,
  "message": "Announcement updated successfully.",
  "data": {
    "announcement": {
      "id": "7e8d7f4d-5f5c-4c78-9d95-6c5308d2c9c1",
      "title": "Updated maintenance notice",
      "message": "The platform will be unavailable briefly.",
      "audience": {
        "roles": [
          "buyer",
          "renter"
        ]
      },
      "priority": "high",
      "channels": [
        "in_app"
      ],
      "status": "scheduled",
      "scheduled_at": "2026-09-30T22:00:00Z",
      "published_at": null,
      "created_by": "f9c8f4a4-1e32-4c2b-9f5c-14c5a965c3ef",
      "created_at": "2026-09-26T10:30:00Z",
      "updated_at": "2026-09-26T10:45:00Z"
    }
  }
}

Notes

The following fields are read-only:

TEXT
id
published_at
created_by
created_at
updated_at

Published status cannot be set through this endpoint.


5. Publish Announcement

Publish an announcement and deliver it through the selected channels.

POST/admins/announcements/{announcement_id}/publish/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

No request body is required.

Success Example

HTTP 200 OK

JSON
{
  "success": true,
  "message": "Announcement published successfully.",
  "data": {
    "announcement": {
      "id": "7e8d7f4d-5f5c-4c78-9d95-6c5308d2c9c1",
      "title": "Maintenance notice",
      "message": "The platform will be unavailable briefly.",
      "audience": {
        "roles": [
          "buyer",
          "renter"
        ]
      },
      "priority": "normal",
      "channels": [
        "in_app"
      ],
      "status": "published",
      "scheduled_at": null,
      "published_at": "2026-09-26T11:00:00Z",
      "created_by": "f9c8f4a4-1e32-4c2b-9f5c-14c5a965c3ef",
      "created_at": "2026-09-26T10:30:00Z",
      "updated_at": "2026-09-26T11:00:00Z"
    },
    "delivery": {
      "in_app": {
        "status": "sent",
        "recipient_count": 25
      }
    }
  }
}

Multiple Channels Example

JSON
{
  "delivery": {
    "in_app": {
      "status": "sent",
      "recipient_count": 25
    },
    "email": {
      "status": "coming_soon",
      "message": "Email delivery coming soon."
    },
    "push": {
      "status": "coming_soon",
      "message": "Push delivery coming soon."
    },
    "sms": {
      "status": "coming_soon",
      "message": "SMS delivery coming soon."
    }
  }
}

Notes

  • Publishing changes the announcement status to published.

  • published_at is set automatically.

  • In-app notifications are created for users matching the configured audience roles.

  • An already published announcement cannot be published again.

  • A failed announcement cannot be published.

  • Email, push, and SMS delivery are currently placeholders.


Common Success Format

JSON
{
  "success": true,
  "message": "Operation completed successfully.",
  "data": {}
}

Common Error Format

HTTP 400 — Validation Error

JSON
{
  "success": false,
  "message": "Validation failed.",
  "errors": {
    "scheduled_at": [
      "This field is required when scheduled."
    ]
  }
}

HTTP 401 — Missing Authentication

JSON
{
  "success": false,
  "message": "Authentication credentials were not provided.",
  "errors": {}
}

Invalid or expired tokens also return HTTP 401.

HTTP 403 — Insufficient Permissions

JSON
{
  "success": false,
  "message": "You do not have permission to perform this action.",
  "errors": {}
}

Non-admin, inactive, blocked, and deleted accounts cannot access these APIs.

HTTP 404 — Announcement Not Found

JSON
{
  "success": false,
  "message": "Announcement not found.",
  "errors": {}
}

Malformed JSON returns HTTP 400. Unsupported methods return HTTP 405.