Skip to main content

Trigger Data Sync

Manually trigger a data synchronization process for your workspace.
workspaceId
string
required
Your workspace domain (e.g., yourcompany.com)
syncType
string
Type of sync to run: quick (default) or full
sources
array
Specific integration sources to sync (optional). If not provided, all connected integrations will sync.

Request

curl -X POST "https://api.gostanna.com/api/ingest/run?workspaceId=yourcompany.com" \
  -H "Authorization: Bearer sk-your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "syncType": "quick",
    "sources": ["google", "hubspot"]
  }'

Response

{
  "success": true,
  "jobId": "ingest_job_abc123",
  "status": "started",
  "estimatedDuration": "5-10 minutes",
  "sources": ["google", "hubspot"]
}

Get Sync Status

Check the status of data synchronization processes.
workspaceId
string
required
Your workspace domain
jobId
string
Specific job ID to check (optional). If not provided, returns status of all recent sync jobs.

Request

curl -X GET "https://api.gostanna.com/api/ingest/status?workspaceId=yourcompany.com" \
  -H "Authorization: Bearer sk-your-api-key-here"

Response

{
  "currentJob": {
    "jobId": "ingest_job_abc123",
    "status": "running",
    "progress": 65,
    "startedAt": "2024-01-31T10:00:00Z",
    "estimatedCompletion": "2024-01-31T10:15:00Z",
    "sources": {
      "google": {
        "status": "completed",
        "itemsProcessed": 245,
        "lastSyncAt": "2024-01-31T10:05:00Z"
      },
      "hubspot": {
        "status": "running",
        "itemsProcessed": 128,
        "totalItems": 200,
        "progress": 64
      }
    }
  },
  "recentJobs": [
    {
      "jobId": "ingest_job_xyz789",
      "status": "completed",
      "completedAt": "2024-01-30T15:30:00Z",
      "duration": "8 minutes",
      "itemsProcessed": 892
    }
  ]
}

Get Sync History

Retrieve historical data synchronization logs and statistics.
workspaceId
string
required
Your workspace domain
limit
number
Maximum number of sync records to return (default: 20, max: 100)
source
string
Filter by integration source: google, hubspot, intercom
status
string
Filter by sync status: completed, failed, running

Request

curl -X GET "https://api.gostanna.com/api/ingest/history?workspaceId=yourcompany.com&limit=10&source=google" \
  -H "Authorization: Bearer sk-your-api-key-here"

Response

{
  "syncHistory": [
    {
      "jobId": "ingest_job_abc123",
      "source": "google",
      "status": "completed",
      "startedAt": "2024-01-31T10:00:00Z",
      "completedAt": "2024-01-31T10:08:00Z",
      "duration": "8 minutes",
      "itemsProcessed": 245,
      "itemsAdded": 12,
      "itemsUpdated": 233,
      "itemsSkipped": 0,
      "errors": []
    },
    {
      "jobId": "ingest_job_def456",
      "source": "google",
      "status": "completed",
      "startedAt": "2024-01-30T10:00:00Z",
      "completedAt": "2024-01-30T10:12:00Z",
      "duration": "12 minutes",
      "itemsProcessed": 289,
      "itemsAdded": 15,
      "itemsUpdated": 274,
      "itemsSkipped": 2,
      "errors": [
        {
          "message": "Email parsing failed for 2 items",
          "count": 2,
          "severity": "warning"
        }
      ]
    }
  ],
  "pagination": {
    "total": 45,
    "limit": 10,
    "offset": 0,
    "hasMore": true
  }
}

Start Full Backfill

Initiate a comprehensive data backfill from your integrations.
workspaceId
string
required
Your workspace domain
source
string
required
Integration source to backfill: google, hubspot, or intercom
fromDate
string
required
Start date for backfill in ISO 8601 format (e.g., 2024-01-01T00:00:00Z)
toDate
string
End date for backfill (defaults to current date)
dataTypes
array
Specific data types to backfill (e.g., ["emails", "meetings", "contacts"])

Request

curl -X POST "https://api.gostanna.com/api/ingest/backfill?workspaceId=yourcompany.com" \
  -H "Authorization: Bearer sk-your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "source": "google",
    "fromDate": "2024-01-01T00:00:00Z",
    "toDate": "2024-01-31T23:59:59Z",
    "dataTypes": ["emails", "meetings"]
  }'

Response

{
  "success": true,
  "backfillId": "backfill_ghi789",
  "estimatedItems": 2500,
  "estimatedDuration": "45-60 minutes",
  "status": "queued",
  "source": "google",
  "dateRange": {
    "from": "2024-01-01T00:00:00Z",
    "to": "2024-01-31T23:59:59Z"
  },
  "dataTypes": ["emails", "meetings"]
}
Full backfills can take significant time depending on the amount of historical data. Large backfills are processed in the background and won’t affect your current workspace usage.

Get Email Ingestion Stats

Retrieve statistics about email data ingestion and processing.
workspaceId
string
required
Your workspace domain
windowDays
number
Time window for statistics in days (default: 30, max: 90)

Request

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

Response

{
  "windowDays": 30,
  "emailsProcessed": 3450,
  "emailsInbound": 2100,
  "emailsOutbound": 1350,
  "openTrackingEnabled": true,
  "openRate": 0.72,
  "responseRate": 0.45,
  "avgSentimentScore": 0.68,
  "topClients": [
    {
      "clientName": "Acme Corp",
      "emailCount": 89,
      "avgSentiment": 0.85,
      "openRate": 0.95
    },
    {
      "clientName": "TechStart Inc",
      "emailCount": 67,
      "avgSentiment": 0.72,
      "openRate": 0.88
    }
  ],
  "processingErrors": {
    "parseErrors": 5,
    "attachmentErrors": 2,
    "sentimentErrors": 0
  }
}