Skip to content

dashboard

← All modules

3 endpoints.

GET /api/v1/dashboard/stats

Get Dashboard Stats

200 — Successful Response

json
{}

GET /api/v1/dashboard/erp-leads

Get Erp Lead Counts

Linked-ERP lead count and total sales for the active account.

Each ad account links to its own ERP (Telecloud Ads → TC ERP, Movie Magic Ads → MM ERP; see settings.erp_by_account). The cards show the ERP for whichever account is the active cascade selection (X-Account-ID), so applicable: false for any other account or the all-accounts view. Both figures are windowed by days — leads via the Lead creation filter, sales via the Sales Invoice posting_date filter — and are fetched concurrently (two Frappe calls to the same site, so latency ≈ one call).

The (slow, live-Meta) lead-form count is a separate endpoint so the cards render immediately with the ERP numbers while the lead-form figure streams in.

Parameters

NameInRequiredTypeDescription
daysquerynointeger

200 — Successful Response

json
{}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

GET /api/v1/dashboard/lead-form-leads

Get Lead Form Leads

Meta lead-form lead count for the active account, windowed by days.

Split from /erp-leads because it pulls leads live from Meta (a few seconds for accounts with many forms), so the dashboard loads it separately and shows a spinner while it resolves. Returns {"count": int|None, "error": str|None}; applicable: false for non-ERP accounts.

Parameters

NameInRequiredTypeDescription
daysquerynointeger

200 — Successful Response

json
{}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

Lubb ERP Documentation