Message Usage

Returns daily series and totals for used messages. Use it for consumption dashboards, internal alerts, and campaign reconciliation.

GET https://api.platica.mx/v1/usage/messages

Query parameters

ParameterTypeDescriptionRequired
workspacestringFilters the response to one workspace. If omitted, returns all accessible workspaces
startDatestringISO 8601 start date. If omitted, uses the start of the billing period
endDatestringISO 8601 end date. If omitted, uses the end of the billing period
groupByenumGrouping dimension: type (default), channel, templateCategory, or campaign
modeenumfast (default) reads daily aggregates; full scans transactions for detailed cost fields

Response

{
  "workspaces": [
    {
      "id": "g6yCA16pkWl5eXo7KszB",
      "name": "My company",
      "billingPeriod": {
        "startDate": "2026-06-01T00:00:00.000Z",
        "endDate": "2026-06-30T23:59:59.999Z"
      },
      "dataSince": "2026-05-21T06:00:00.000Z",
      "usage": {
        "planName": "Growth",
        "credits": 6500,
        "mode": "fast",
        "groupBy": "type",
        "range": {
          "startDate": "2026-06-01T00:00:00.000Z",
          "endDate": "2026-06-30T23:59:59.999Z"
        },
        "freshness": {
          "source": "daily_aggregations",
          "lastUpdated": "2026-06-29T18:31:10.000Z",
          "expectedLagSeconds": 30
        },
        "series": [
          { "date": "2026-06-29T12:00:00.000Z", "group": "Servicio", "value": 180 },
          { "date": "2026-06-29T12:00:00.000Z", "group": "Campaña", "value": 40 }
        ],
        "totalsByGroup": [
          { "group": "Servicio", "messages": 950, "creditsUsed": 950, "includedValueCentavos": 0, "overageCentavos": 0, "changePct": null },
          { "group": "Campaña", "messages": 250, "creditsUsed": 370, "includedValueCentavos": 0, "overageCentavos": 0, "changePct": null }
        ],
        "summary": {
          "totalMessages": 1200,
          "serviceCount": 950,
          "campaignCount": 250,
          "creditsUsed": 1320,
          "credits": 6500,
          "totalChangePct": -8.8,
          "serviceChangePct": -11.2,
          "campaignChangePct": 0
        }
      }
    }
  ],
  "workspacesCount": 1
}

Response fields

FieldDescription
idWorkspace ID
nameWorkspace name
billingPeriodActive billing period for the workspace
usage.planNamePlan name. For enterprise workspaces it is enterprise
usage.creditsWorkspace included credits
usage.modeCalculation mode used: fast or full
usage.groupByGrouping dimension applied
usage.rangeEffective date range evaluated
usage.seriesDaily series with date, group, and value
usage.totalsByGroupPer-group totals with messages and, on non-enterprise plans, cost fields
usage.summary.totalMessagesTotal messages used
usage.summary.serviceCountService messages
usage.summary.campaignCountCampaign or template messages
usage.summary.creditsUsedEstimated credits consumed (omitted for enterprise workspaces)
usage.freshnessLatest update and expected lag

Modes

ModeRecommended use
fastMonitoring and dashboards. Usually reflects messages with seconds of lag
fullCost and overage reconciliation. Reads transactions and is limited to short ranges