First module calls

After the CRM quickstart works, use these calls to exercise the other Slab5 modules in your personal workspace.

Before you call

Export the values from your Slab5 personal workspace:

export SLAB5_API_BASE_URL=https://api.slab5.com/v1
export SLAB5_MCP_URL=https://mcp.slab5.com/v1
export SLAB5_WORKSPACE_API_KEY=...
export SLAB5_WORKSPACE_MCP_TOKEN=...

Create credentials with the write scopes used below. The MCP token needs asset, integration, analytics, and BI write scopes once those workspace modules are enabled.

Asset upload intent

Creates asset metadata and returns a signed upload URL:

Create asset upload intentbash
curl -X POST "$SLAB5_API_BASE_URL/assets" \
  -H "Authorization: Bearer $SLAB5_WORKSPACE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "asset_type": "image",
    "name": "Acme hero image",
    "description": "Hero image for the Acme case study draft.",
    "file_name": "acme-hero.png",
    "mime_type": "image/png",
    "byte_size": 204800,
    "metadata": {
      "source": "quickstart_workspace"
    },
    "idempotency_key": "first_asset_acme_hero"
  }'

Slab5 returns a signed upload URL; after uploading the object, call the asset completion endpoint/tool before requesting a download URL.

Webhook endpoint

Creates a signed webhook endpoint subscription:

Create webhook endpointbash
curl -X POST "$SLAB5_API_BASE_URL/webhooks" \
  -H "Authorization: Bearer $SLAB5_WORKSPACE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Quickstart CRM webhook",
    "url": "https://example.com/slab5/webhooks",
    "event_types": ["contact.created", "task.created"],
    "max_attempts": 3,
    "metadata": {
      "source": "quickstart_workspace"
    },
    "idempotency_key": "first_webhook_crm"
  }'

The signing secret is returned only when the endpoint is created. Matching events are queued as delivery records; the outbound worker signs and posts pending deliveries to active endpoints, then records success, retry, or failure state.

Analytics event

Defines an analytics governance event:

Define analytics eventbash
curl -X POST "$SLAB5_API_BASE_URL/analytics/events" \
  -H "Authorization: Bearer $SLAB5_WORKSPACE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "first_contact_created",
    "description": "A workspace created its first CRM contact.",
    "owner": "growth",
    "properties": ["tenant_id", "workspace_id", "source"],
    "idempotency_key": "first_analytics_event_contact_created"
  }'

BI dashboard

Creates a BI dashboard definition:

Create BI dashboardbash
curl -X POST "$SLAB5_API_BASE_URL/bi/dashboards" \
  -H "Authorization: Bearer $SLAB5_WORKSPACE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "key": "activation_overview",
    "name": "Activation overview",
    "description": "Dashboard definition for activation checks.",
    "layout": {
      "widgets": [
        { "key": "first_contacts", "type": "table" }
      ]
    },
    "idempotency_key": "first_bi_dashboard_activation"
  }'

Built-in BI dataset query

Runs a built-in workspace-scoped BI dataset query and persists the query definition:

Run BI querybash
curl -X POST "$SLAB5_API_BASE_URL/bi/queries/run" \
  -H "Authorization: Bearer $SLAB5_WORKSPACE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "dataset_key": "api_usage",
    "limit": 10,
    "persist": true,
    "key": "activation_query",
    "name": "API usage query",
    "idempotency_key": "first_bi_query_activation"
  }'

Slab5-native Custom BI templates such as content_performance, crm_pipeline, support_ticket_health, usage_activation, and agentops_execution_health preview from workspace operational data. Other built-in datasets can query the configured analytics provider when the workspace has that data source enabled.

BI export

Creates a BI export artifact:

Create BI exportbash
curl -X POST "$SLAB5_API_BASE_URL/bi/exports" \
  -H "Authorization: Bearer $SLAB5_WORKSPACE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Activation CSV",
    "format": "csv",
    "idempotency_key": "first_bi_export_activation_csv"
  }'

Export artifact delivery depends on the configured BI provider and export storage path.

MCP equivalents

The same surfaces are available through MCP tools:

MCP asset upload intentbash
curl -X POST "$SLAB5_MCP_URL" \
  -H "Authorization: Bearer $SLAB5_WORKSPACE_MCP_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": "asset-1",
    "method": "tools/call",
    "params": {
      "name": "create_asset_upload_intent",
      "arguments": {
        "asset_type": "image",
        "file_name": "acme-hero.png",
        "mime_type": "image/png",
        "idempotency_key": "mcp_first_asset_acme_hero"
      }
    }
  }'
MCP webhook endpointbash
curl -X POST "$SLAB5_MCP_URL" \
  -H "Authorization: Bearer $SLAB5_WORKSPACE_MCP_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": "webhook-1",
    "method": "tools/call",
    "params": {
      "name": "create_webhook_endpoint",
      "arguments": {
        "name": "Quickstart CRM webhook",
        "url": "https://example.com/slab5/webhooks",
        "event_types": ["contact.created"],
        "idempotency_key": "mcp_first_webhook_local_crm"
      }
    }
  }'
MCP analytics eventbash
curl -X POST "$SLAB5_MCP_URL" \
  -H "Authorization: Bearer $SLAB5_WORKSPACE_MCP_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": "analytics-1",
    "method": "tools/call",
    "params": {
      "name": "define_event",
      "arguments": {
        "name": "first_contact_created",
        "description": "A workspace created its first CRM contact.",
        "owner": "growth",
        "properties": ["tenant_id", "workspace_id", "source"],
        "idempotency_key": "mcp_first_analytics_event_contact_created"
      }
    }
  }'
MCP BI dataset querybash
curl -X POST "$SLAB5_MCP_URL" \
  -H "Authorization: Bearer $SLAB5_WORKSPACE_MCP_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": "bi-1",
    "method": "tools/call",
    "params": {
      "name": "run_bi_query",
      "arguments": {
        "dataset_key": "api_usage",
        "persist": true,
        "key": "activation_query",
        "name": "API usage query",
        "idempotency_key": "mcp_first_bi_query_activation"
      }
    }
  }'

Expected side effects

Each successful write should:

  • return a response with request_id

  • write an audit event

  • write a usage event for the REST request or MCP tool call

  • enforce workspace module enablement

  • enforce the API key or MCP token scopes

  • assets use signed upload and download URLs

  • webhook delivery requires an active endpoint and a matching workspace event

  • Slab5-native Custom BI templates use workspace operational data; other BI datasets require an analytics provider for real workspace data

  • BI export artifact URLs depend on the configured provider/storage path

Was this page helpful?