Skip to main content

Get Metrics Summary

Retrieve a comprehensive summary of workspace metrics including client health, revenue, and engagement statistics.
workspaceId
string
required
Your workspace domain (e.g., yourcompany.com)
windowDays
number
Time window in days for metrics calculation (default: 7, max: 90)
riskThreshold
number
Score threshold for identifying at-risk clients (default: 40, range: 0-100)

Request

curl -X GET "https://api.gostanna.com/api/metrics/summary?workspaceId=yourcompany.com&windowDays=30" \
  -H "Authorization: Bearer sk-your-api-key-here"

Response

{
  "totals": {
    "clients": 125,
    "contacts": 450,
    "interactionsWindow": 1250,
    "renewals30d": 15,
    "openTasks": 8
  },
  "revenue": {
    "mrrTotal": 625000,
    "mrrAtRisk": 45000,
    "renewals30dValue": 85000,
    "avgClientValue": 5000
  },
  "health": {
    "avgScore": 72.5,
    "change7": 2.3,
    "change7Pct": 3.2,
    "threshold": 40,
    "atRiskCount": 18,
    "improvingCount": 42
  },
  "lists": {
    "topRisks": [
      {
        "clientId": "client_123",
        "name": "Example Corp",
        "score": 25,
        "mrr": 8000,
        "reason": "No interaction in 30 days"
      }
    ],
    "topImproving": [
      {
        "clientId": "client_456",
        "name": "Growth Inc",
        "score": 88,
        "scoreChange": 15,
        "mrr": 12000
      }
    ],
    "renewals": [
      {
        "clientId": "client_789",
        "name": "Renewal Co",
        "renewalDate": "2024-02-15",
        "mrr": 5000,
        "daysUntil": 14
      }
    ]
  },
  "asOf": "2024-01-31T23:59:59Z"
}

Retrieve historical health score trends for your workspace.
workspaceId
string
required
Your workspace domain
windowDays
number
Number of days of history to retrieve (default: 30, max: 365)
interval
string
Data point interval: daily, weekly, or monthly (default: daily)

Request

curl -X GET "https://api.gostanna.com/api/metrics/trends/health?workspaceId=yourcompany.com&windowDays=30&interval=daily" \
  -H "Authorization: Bearer sk-your-api-key-here"

Response

[
  {
    "date": "2024-01-01",
    "avgScore": 70.2,
    "clientCount": 120
  },
  {
    "date": "2024-01-02",
    "avgScore": 70.5,
    "clientCount": 120
  },
  {
    "date": "2024-01-03",
    "avgScore": 71.1,
    "clientCount": 121
  }
]

Track sentiment analysis trends over time.
workspaceId
string
required
Your workspace domain
windowDays
number
Number of days of history (default: 30)

Request

curl -X GET "https://api.gostanna.com/api/metrics/trends/sentiment?workspaceId=yourcompany.com&windowDays=30" \
  -H "Authorization: Bearer sk-your-api-key-here"

Response

[
  {
    "date": "2024-01-01",
    "avgSentiment": 0.72,
    "volume": 45,
    "positive": 32,
    "neutral": 10,
    "negative": 3
  },
  {
    "date": "2024-01-02",
    "avgSentiment": 0.75,
    "volume": 52,
    "positive": 40,
    "neutral": 8,
    "negative": 4
  }
]

Get Interaction Mix

Analyze the distribution of interaction types.
workspaceId
string
required
Your workspace domain
windowDays
number
Time window for analysis (default: 30)

Request

curl -X GET "https://api.gostanna.com/api/metrics/trends/interactions?workspaceId=yourcompany.com&windowDays=30" \
  -H "Authorization: Bearer sk-your-api-key-here"

Response

[
  {
    "source": "email",
    "count": 450,
    "percentage": 45
  },
  {
    "source": "slack",
    "count": 280,
    "percentage": 28
  },
  {
    "source": "meeting",
    "count": 150,
    "percentage": 15
  },
  {
    "source": "support_ticket",
    "count": 120,
    "percentage": 12
  }
]

Get Score Deltas

Analyze significant changes in client health scores.
workspaceId
string
required
Your workspace domain
windowDays
number
Time window for delta calculation (default: 7)
minDelta
number
Minimum score change to include (default: 10)

Request

curl -X GET "https://api.gostanna.com/api/metrics/deltas?workspaceId=yourcompany.com&windowDays=7&minDelta=10" \
  -H "Authorization: Bearer sk-your-api-key-here"

Response

[
  {
    "reason": "Increased positive interactions",
    "totalDelta": 125,
    "count": 15,
    "avgDelta": 8.3,
    "clients": [
      {
        "id": "client_123",
        "name": "Example Corp",
        "delta": 15,
        "currentScore": 85,
        "previousScore": 70
      }
    ]
  },
  {
    "reason": "Reduced response times",
    "totalDelta": -45,
    "count": 5,
    "avgDelta": -9,
    "clients": []
  }
]

Get Email Engagement Stats

Analyze email engagement metrics across your client base.
workspaceId
string
required
Your workspace domain
windowDays
number
Time window for statistics (default: 30)

Request

curl -X GET "https://api.gostanna.com/api/metrics/email-stats?workspaceId=yourcompany.com&windowDays=30" \
  -H "Authorization: Bearer sk-your-api-key-here"

Response

{
  "avgOpenRate": 0.68,
  "avgResponseRate": 0.42,
  "totalEmailsSent": 1250,
  "totalEmailsReceived": 980,
  "topEngaged": [
    {
      "clientId": "client_123",
      "name": "Engaged Corp",
      "openRate": 0.95,
      "responseRate": 0.78,
      "emailCount": 45
    }
  ],
  "leastEngaged": [
    {
      "clientId": "client_456",
      "name": "Silent Co",
      "openRate": 0.12,
      "responseRate": 0.05,
      "emailCount": 20
    }
  ],
  "totalClients": 125
}