{ }API Reference

API Reference

Complete reference for the EnterCRM REST API. All endpoints require authentication.

Base URL

https://api.entercrm.io/v1

Rate Limit

1,000 req / min

Response Format

JSON

Authentication

EnterCRM supports two authentication methods: Bearer tokens (for user sessions) and API keys (for server-to-server integrations).

Bearer Token (user session)

Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...

API Key (server-to-server)

X-API-Key: eck_your_api_key_here

Pagination

List endpoints return paginated results. Use the page and per_page query parameters to navigate.

GET /customers?page=1&per_page=25&sort=created_at&order=desc

// Response envelope
{
  "data": [...],
  "meta": {
    "current_page": 1,
    "per_page": 25,
    "total": 342,
    "last_page": 14
  }
}

Authentication

POST/auth/login

Authenticate a user and return a Bearer token for subsequent requests.

Example Request

curl -X POST https://api.entercrm.io/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "demo@entercrm.io",
    "password": "password"
  }'

Example Response

{
  "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
  "user": {
    "id": 1,
    "name": "Demo User",
    "email": "demo@entercrm.io",
    "created_at": "2026-01-15T10:00:00Z"
  },
  "tenant": {
    "id": 1,
    "name": "Demo Workspace",
    "slug": "demo"
  }
}
POST/auth/register

Register a new user and workspace. Returns a token on success.

Example Request

curl -X POST https://api.entercrm.io/v1/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Jane Smith",
    "email": "jane@company.com",
    "password": "secret123",
    "workspace_name": "Company Workspace"
  }'

Example Response

{
  "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
  "user": {
    "id": 42,
    "name": "Jane Smith",
    "email": "jane@company.com"
  },
  "tenant": {
    "id": 12,
    "name": "Company Workspace",
    "slug": "company-workspace"
  }
}
POST/auth/logout

Revoke the current Bearer token. The token will be invalidated immediately.

Example Request

curl -X POST https://api.entercrm.io/v1/auth/logout \
  -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."

Example Response

{
  "message": "Logged out successfully."
}

Customers

GET/customers

List all customers in the workspace with optional filters and pagination.

Example Request

curl https://api.entercrm.io/v1/customers?page=1&per_page=25 \
  -H "Authorization: Bearer <token>"

Example Response

{
  "data": [
    {
      "id": 1,
      "name": "Ana Kovač",
      "email": "ana.kovac@example.com",
      "phone": "+385911234567",
      "rfm_score": 14,
      "rfm_segment": "Champions",
      "clv_total": 4850.00,
      "clv_predicted": 6200.00,
      "last_seen_at": "2026-03-10T14:22:00Z",
      "created_at": "2025-06-01T08:00:00Z"
    }
  ],
  "meta": { "current_page": 1, "per_page": 25, "total": 342, "last_page": 14 }
}
GET/customers/{id}

Retrieve full profile of a single customer including events and CLV metrics.

Example Request

curl https://api.entercrm.io/v1/customers/1 \
  -H "Authorization: Bearer <token>"

Example Response

{
  "id": 1,
  "name": "Ana Kovač",
  "email": "ana.kovac@example.com",
  "rfm_score": 14,
  "rfm_segment": "Champions",
  "clv_total": 4850.00,
  "clv_predicted": 6200.00,
  "clv_average_order": 242.50,
  "clv_order_count": 20,
  "events_count": 87,
  "segments": ["Champions", "High Value", "Recent Buyers"]
}
POST/customers

Create a new customer profile in the workspace.

Example Request

curl -X POST https://api.entercrm.io/v1/customers \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Marko Horvatić",
    "email": "marko@example.com",
    "phone": "+385921234567",
    "city": "Zagreb",
    "country": "HR"
  }'

Example Response

{
  "id": 343,
  "name": "Marko Horvatić",
  "email": "marko@example.com",
  "phone": "+385921234567",
  "city": "Zagreb",
  "country": "HR",
  "created_at": "2026-03-16T09:41:00Z"
}
PUT/customers/{id}

Update an existing customer profile. Only provided fields are updated.

Example Request

curl -X PUT https://api.entercrm.io/v1/customers/343 \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{ "city": "Split", "phone": "+385981234567" }'

Example Response

{
  "id": 343,
  "name": "Marko Horvatić",
  "email": "marko@example.com",
  "city": "Split",
  "phone": "+385981234567",
  "updated_at": "2026-03-16T10:05:00Z"
}

Events (Tracking)

POST/track/event

Track a custom event for a customer. Use your API key for server-side event tracking.

Example Request

curl -X POST https://api.entercrm.io/v1/track/event \
  -H "X-API-Key: eck_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "customer_email": "ana.kovac@example.com",
    "event": "purchase",
    "properties": {
      "amount": 149.99,
      "currency": "EUR",
      "product_id": "prod_abc123",
      "product_name": "Premium Plan"
    }
  }'

Example Response

{
  "recorded": true,
  "event_id": "evt_9f8e7d6c5b4a3210",
  "customer_id": 1
}
POST/track/pageview

Track a pageview event. Usually sent automatically by the JS tracking snippet.

Example Request

curl -X POST https://api.entercrm.io/v1/track/pageview \
  -H "X-API-Key: eck_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "customer_email": "ana.kovac@example.com",
    "url": "https://yoursite.com/pricing",
    "referrer": "https://google.com",
    "user_agent": "Mozilla/5.0..."
  }'

Example Response

{
  "recorded": true,
  "event_id": "evt_0a1b2c3d4e5f6789"
}

Segments

GET/segments

List all customer segments defined in the workspace.

Example Request

curl https://api.entercrm.io/v1/segments \
  -H "Authorization: Bearer <token>"

Example Response

{
  "data": [
    {
      "id": 1,
      "name": "Champions",
      "description": "High RFM score customers who purchase frequently",
      "color": "#34d399",
      "customers_count": 48,
      "created_at": "2026-01-01T00:00:00Z"
    },
    {
      "id": 2,
      "name": "At Risk",
      "description": "Previously loyal customers who haven't engaged recently",
      "color": "#fbbf24",
      "customers_count": 23
    }
  ]
}
GET/segments/{id}

Get a segment with its full customer list and filter criteria.

Example Request

curl https://api.entercrm.io/v1/segments/1 \
  -H "Authorization: Bearer <token>"

Example Response

{
  "id": 1,
  "name": "Champions",
  "filters": {
    "rfm_score_min": 12,
    "purchase_count_min": 10
  },
  "customers_count": 48,
  "customers": [
    { "id": 1, "name": "Ana Kovač", "rfm_score": 14, "clv_total": 4850.00 },
    { "id": 7, "name": "Ivan Blažević", "rfm_score": 13, "clv_total": 3920.00 }
  ]
}

Campaigns

GET/campaigns

List all campaigns with their status and delivery statistics.

Example Request

curl https://api.entercrm.io/v1/campaigns \
  -H "Authorization: Bearer <token>"

Example Response

{
  "data": [
    {
      "id": 1,
      "name": "March Newsletter",
      "type": "email",
      "status": "sent",
      "total_sent": 1240,
      "total_opened": 682,
      "total_clicked": 213,
      "open_rate": 55.0,
      "click_rate": 17.2,
      "sent_at": "2026-03-01T10:00:00Z"
    }
  ]
}
POST/campaigns

Create a new email, SMS, or ad campaign targeting a specific segment.

Example Request

curl -X POST https://api.entercrm.io/v1/campaigns \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Spring Sale",
    "type": "email",
    "segment_id": 1,
    "subject": "Exclusive offer for our best customers",
    "body": "<h1>Spring Sale</h1><p>Use code SPRING25 for 25% off.</p>",
    "scheduled_at": "2026-03-20T09:00:00Z"
  }'

Example Response

{
  "id": 8,
  "name": "Spring Sale",
  "type": "email",
  "status": "scheduled",
  "segment_id": 1,
  "scheduled_at": "2026-03-20T09:00:00Z",
  "created_at": "2026-03-16T11:00:00Z"
}
GET/campaigns/{id}

Get campaign detail with full analytics breakdown.

Example Request

curl https://api.entercrm.io/v1/campaigns/1 \
  -H "Authorization: Bearer <token>"

Example Response

{
  "id": 1,
  "name": "March Newsletter",
  "type": "email",
  "status": "sent",
  "segment": { "id": 1, "name": "Champions" },
  "total_sent": 1240,
  "total_opened": 682,
  "total_clicked": 213,
  "total_bounced": 14,
  "total_unsubscribed": 3,
  "open_rate": 55.0,
  "click_rate": 17.2,
  "messages": [
    { "id": 1, "customer_id": 1, "status": "opened", "opened_at": "2026-03-01T10:12:00Z" }
  ]
}
POST/campaigns/{id}/send

Trigger immediate sending of a draft or scheduled campaign.

Example Request

curl -X POST https://api.entercrm.io/v1/campaigns/8/send \
  -H "Authorization: Bearer <token>"

Example Response

{
  "campaign_id": 8,
  "status": "sending",
  "queued_messages": 48,
  "message": "Campaign is being sent to 48 customers."
}

Automations

GET/automations

List all automation workflows with their active status and trigger types.

Example Request

curl https://api.entercrm.io/v1/automations \
  -H "Authorization: Bearer <token>"

Example Response

{
  "data": [
    {
      "id": 1,
      "name": "Welcome Series",
      "trigger_type": "customer_created",
      "is_active": true,
      "steps_count": 5,
      "total_enrolled": 342,
      "created_at": "2026-01-10T00:00:00Z"
    }
  ]
}
POST/automations

Create a new automation workflow with a name and trigger type.

Example Request

curl -X POST https://api.entercrm.io/v1/automations \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Win-Back Campaign",
    "trigger_type": "customer_inactive",
    "trigger_config": { "inactive_days": 60 },
    "is_active": false
  }'

Example Response

{
  "id": 4,
  "name": "Win-Back Campaign",
  "trigger_type": "customer_inactive",
  "is_active": false,
  "steps_count": 0,
  "created_at": "2026-03-16T12:00:00Z"
}
POST/automations/{id}/design

Save the visual flow design (nodes and edges) of an automation.

Example Request

curl -X POST https://api.entercrm.io/v1/automations/4/design \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "nodes": [
      { "id": "1", "type": "trigger", "data": { "label": "Customer Inactive" }, "position": { "x": 250, "y": 50 } },
      { "id": "2", "type": "action", "data": { "label": "Send Email", "email_template": "win-back-1" }, "position": { "x": 250, "y": 180 } }
    ],
    "edges": [
      { "id": "e1-2", "source": "1", "target": "2" }
    ]
  }'

Example Response

{
  "automation_id": 4,
  "saved": true,
  "nodes_count": 2,
  "edges_count": 1
}

API Keys

GET/api-keys

List all API keys for the workspace. Secret values are masked after creation.

Example Request

curl https://api.entercrm.io/v1/api-keys \
  -H "Authorization: Bearer <token>"

Example Response

{
  "data": [
    {
      "id": 1,
      "name": "Production Server",
      "key": "eck_your_api_key_here",
      "last_used_at": "2026-03-15T18:30:00Z",
      "created_at": "2026-01-01T00:00:00Z"
    }
  ]
}
POST/api-keys

Generate a new API key. The full key is only shown once — store it securely.

Example Request

curl -X POST https://api.entercrm.io/v1/api-keys \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Staging Server" }'

Example Response

{
  "id": 2,
  "name": "Staging Server",
  "key": "eck_your_api_key_here",
  "created_at": "2026-03-16T12:30:00Z",
  "note": "This is the only time the full key will be shown."
}
All timestamps are in ISO 8601 format (UTC). Monetary values are in Euro (€). For questions or to report API issues, contact support.