Skip to main content

Business Process API Actions

This document provides a comprehensive guide on how to use SureMSA on a standalone basis without Salesforce via REST APIs. Each critical business process is mapped to its corresponding API endpoint.

Overview

SureMSA can operate completely independently of external systems like Salesforce, QuickBooks, or other integrations. All core business processes can be executed through REST APIs.


Core Business Process APIs

1. Customer Lifecycle Management

Business ActionAPI EndpointMethodStatusNotes
Create CustomerPOST /customers✅ AvailableREADYAuto-generates customer code from name
Update CustomerPOST /customers✅ AvailableREADYInclude id field to update
Delete CustomerDELETE /customers/{id}✅ AvailableREADYSoft delete
Get Customer by IDGET /customers/{id}✅ AvailableREADY-
Get Customer by CodeGET /customers?code={code}✅ AvailableREADY-
List All CustomersGET /customers/all✅ AvailableREADY-
Add Customer TagPOST /customers/{id}/tag/{tag}✅ AvailableREADYOrganize customers

Create Customer API Example:

POST /customers
Content-Type: application/json

{
"fullName": "Sterling Bio Inc",
"name": "Sterling Bio",
"website": "https://sterlingbio.com",
"createdViaChannel": "INTERNAL",
"type": "ENTERPRISE",
"autoCreateMasterAgreement": true
}

Response:

{
"id": 123,
"code": "sterlingb",
"fullName": "Sterling Bio Inc",
"name": "Sterling Bio"
}

View Customer Data Model →


2. Master Agreement Management

Business ActionAPI EndpointMethodStatusNotes
Create Master AgreementPOST /subscriptions/master-agreements✅ AvailableREADYPrimary contract for customer
Update Master AgreementPOST /subscriptions/master-agreements✅ AvailableREADYInclude id field
Auto-Create on CustomerPOST /customers✅ AvailableREADYSet autoCreateMasterAgreement: true
Create Default AgreementPOST /subscriptions/master-agreements/{customerId}✅ AvailableREADYCreates with defaults
Delete Master AgreementDELETE /subscriptions/master-agreements/{id}✅ AvailableREADY-
Manual Change AgreementPOST /subscriptions/master-agreements/manual/change✅ AvailableREADYWith reason tracking

Create Master Agreement API Example:

POST /subscriptions/master-agreements
Content-Type: application/json

{
"customerCode": "sterlingb",
"name": "Sterling Bio Enterprise Agreement",
"dateStart": "2026-01-01",
"dateEnd": "2026-12-31",
"status": "ACTIVE",
"type": "ENTERPRISE"
}

Auto-Create with Customer:

POST /customers
{
"fullName": "Sterling Bio Inc",
"autoCreateMasterAgreement": true // ✅ Auto-creates agreement
}

View Agreements Data Model →


3. Subscription Management

Business ActionAPI EndpointMethodStatusNotes
Create SubscriptionPOST /subscriptions✅ AvailableREADYUnder Master Agreement
Update SubscriptionPOST /subscriptions✅ AvailableREADYInclude id field
Delete SubscriptionDELETE /subscriptions/{id}✅ AvailableREADY-
Get Subscription by IDGET /subscriptions/{id}✅ AvailableREADY-
Get by Billing Project IDGET /subscriptions/by/billingProjectId✅ AvailableREADYUnique identifier
Get by Customer CodeGET /subscriptions/by/customerCode✅ AvailableREADYAll customer subs
Generate Billing Project IDGET /subscriptions/generate/billingProjectId✅ AvailableREADYPreview ID before creation
Manual Subscription ChangePOST /subscriptions/manual/change✅ AvailableREADYWith reason tracking

Create Subscription API Example:

POST /subscriptions
Content-Type: application/json

{
"customerCode": "sterlingb",
"name": "Enterprise Platform Subscription",
"dateStart": "2026-01-01",
"dateEnd": "2026-12-31",
"masterAgreementId": 456,
"subscriptionTypeId": 789,
"status": "ACTIVE"
}

Response:

{
"id": 321,
"billingProjectId": "sterlingb-enterprise",
"customerCode": "sterlingb",
"name": "Enterprise Platform Subscription"
}

Key Features:

  • ✅ Auto-generates billingProjectId from customer code + subscription name
  • ✅ Links to Master Agreement
  • ✅ Tracks subscription lifecycle (ACTIVE, PAUSED, EXPIRED)

View Subscriptions Data Model →


4. License Management

Business ActionAPI EndpointMethodStatusNotes
Create LicenseCreated via Order/Cart⚠️ IndirectVIA CARTLicenses created from orders
Update License NamePUT /licenses/{id}/name/{name}✅ AvailableREADY-
Update Primary TypePUT /licenses/{id}/primaryLicenseType/{type}✅ AvailableREADY-
Update External Project IDPUT /licenses/{id}/external-project-id/{id}✅ AvailableREADYLink to external system
Pause LicensePUT /licenses/{id}/pause✅ AvailableREADYTemporarily suspend
Resume LicensePUT /licenses/{id}/resume✅ AvailableREADYReactivate
Add Named UsersPOST /licenses/{id}/named-users/add✅ AvailableREADYFor named user licenses
Remove Named UsersDELETE /licenses/{id}/named-users/remove✅ AvailableREADY-
Swap LicensePOST /licenses/{id}/swap✅ AvailableREADYTransfer to different user
Get License by IDGET /licenses/{id}✅ AvailableREADY-
Get by SubscriptionGET /licenses/by/subscriptionId✅ AvailableREADYAll licenses in subscription
Get by Customer CodeGET /licenses/by/customerCode✅ AvailableREADYAll customer licenses

Update License Example:

PUT /licenses/123/name/Sterling-Bio-License-001

Add Named Users:

POST /licenses/123/named-users/add
Content-Type: application/json

["john.doe@sterlingbio.com", "jane.smith@sterlingbio.com"]

Important Note:

  • ⚠️ Licenses are not created directly via a POST /licenses endpoint
  • ✅ Licenses are created through the Cart/Order workflow
  • ✅ See Cart & Order Flow below

View Licensing Data Model →


5. Cart & Order Workflow

The Cart is the primary mechanism for creating subscriptions and licenses in SureMSA.

Business ActionAPI EndpointMethodStatusNotes
Create CartPOST /cart✅ AvailableREADYShopping cart for products
Add Cart ProductPOST /cart/cartProduct✅ AvailableREADYAdd products to cart
Get Cart by IDGET /cart/{id}✅ AvailableREADY-
Get Cart by OpportunityGET /cart/by/opportunityId✅ AvailableREADYSalesforce integration
Set Cart to PLACEDPOST /cart/set/placed/{id}/subsTxType/{type}✅ AvailableREADYCreates order
Set Cart to COMPLETEDPOST /cart/set/completed/{id}✅ AvailableREADYProvisions licenses
Set Cart to CANCELEDPOST /cart/set/canceled/{id}✅ AvailableREADYCancel order
Delete CartDELETE /cart/{id}✅ AvailableREADY-

Create Cart API Example:

POST /cart
Content-Type: application/json

{
"customerCode": "sterlingb",
"customerName": "Sterling Bio Inc",
"name": "Q1 2026 Enterprise Purchase",
"description": "Annual enterprise subscription renewal",
"dateStart": "2026-01-01",
"dateEnd": "2026-12-31",
"months": 12,
"channel": "INTERNAL",
"stage": "DRAFT",
"totalPrice": 50000.00,
"currency": "USD",
"repaymentType": "ONE_TIME",
"cartProducts": [
{
"productId": 789,
"name": "Enterprise Plan",
"quantity": 10,
"totalPrice": 50000.00
}
]
}

Cart Workflow:

Cart Stages:

  • DRAFT - Being built
  • PLACED - Order submitted
  • AWAITING_ACCEPT - Pending approval
  • COMPLETED - Licenses provisioned
  • CANCELED - Order canceled

View Cart Workflow Details →


6. Product Management

Business ActionAPI EndpointMethodStatusNotes
Create ProductPOST /products✅ AvailableREADYDefine sellable products
Update ProductPOST /products✅ AvailableREADYInclude id field
Delete ProductDELETE /products/{id}✅ AvailableREADY-
Get Product by IDGET /products/{id}✅ AvailableREADY-
Get All ProductsGET /products/all✅ AvailableREADY-
Import from QuickBooksPOST /products/import/quickbooks/all/data✅ AvailableREADYOptional integration
Import from SalesforceGET /products/import/salesforce/data✅ AvailableREADYOptional integration
Create in QuickBooksPOST /products/create/quickbooks/product✅ AvailableREADYPush to QuickBooks

Create Product API Example:

POST /products
Content-Type: application/json

{
"name": "Enterprise Platform License",
"code": "EPL-2026",
"description": "Full platform access with enterprise features",
"productFamily": "PLATFORM",
"licenseType": "SUBSCRIPTION",
"pricePerMonth": 500.00,
"currency": "USD",
"billingType": "MONTHLY_PAYMENT",
"isActive": true
}

Response:

{
"id": 789,
"name": "Enterprise Platform License",
"code": "EPL-2026",
"pricePerMonth": 500.00
}

View Products Data Model →


Complete Workflow: Customer to License (No Salesforce)

Scenario: New Enterprise Customer with Subscription

# Step 1: Create Customer with Auto-Created Master Agreement
POST /customers
{
"fullName": "Sterling Bio Inc",
"name": "Sterling Bio",
"website": "https://sterlingbio.com",
"createdViaChannel": "INTERNAL",
"type": "ENTERPRISE",
"autoCreateMasterAgreement": true # ✅ Auto-creates agreement
}

# Response: { "id": 123, "code": "sterlingb" }

# Step 2: Create Subscription
POST /subscriptions
{
"customerCode": "sterlingb",
"name": "Enterprise Platform",
"dateStart": "2026-01-01",
"dateEnd": "2026-12-31",
"masterAgreementId": 124, # From auto-created agreement
"subscriptionTypeId": 1
}

# Response: { "id": 321, "billingProjectId": "sterlingb-enterprise" }

# Step 3: Create Product (if not exists)
POST /products
{
"name": "Enterprise License",
"code": "ENT-LIC",
"pricePerMonth": 500.00,
"productFamily": "PLATFORM"
}

# Response: { "id": 789 }

# Step 4: Create Cart with Products
POST /cart
{
"customerCode": "sterlingb",
"name": "Initial Purchase",
"stage": "DRAFT",
"totalPrice": 5000.00,
"currency": "USD",
"repaymentType": "ONE_TIME",
"cartProducts": [
{
"productId": 789,
"quantity": 10,
"totalPrice": 5000.00
}
]
}

# Response: { "id": 456 }

# Step 5: Place Cart (Create Order)
POST /cart/set/placed/456/subsTxType/NEW

# Step 6: Process Payment (external or internal)
# ... payment processing ...

# Step 7: Complete Cart (Provision Licenses)
POST /cart/set/completed/456

# ✅ Result: 10 licenses automatically created and provisioned!

Financial Transaction APIs

Quote → Order → Invoice Flow

Business ActionAPI EndpointMethodStatusNotes
Create QuotePOST /payment/quotes✅ AvailableREADYQuote is a DRAFT cart
Update QuotePOST /payment/quotes✅ AvailableREADY-
Get Quote by IDGET /payment/quotes/{id}✅ AvailableREADY-
Convert Quote to OrderPOST /cart/set/placed/{id}✅ AvailableREADYChanges stage to PLACED
Create InvoiceAuto-generated⚠️ AutomaticAUTOCreated on cart completion
Get Invoice by IDGET /payment/invoices/{id}✅ AvailableREADY-
Get Invoices by CustomerGET /payment/invoices/by/customerCode✅ AvailableREADY-
Mark Invoice as PaidPUT /payment/invoices/{id}/status/PAID✅ AvailableREADY-

Quote Workflow:

View Quote/Order/Invoice Flow →


Payment Processing APIs

Business ActionAPI EndpointMethodStatusNotes
Create PaymentPOST /payment✅ AvailableREADYLinks to cart/order
Get Payment by IDGET /payment/{id}✅ AvailableREADY-
Get Payment MethodsGET /payment/methods✅ AvailableREADYCustomer payment methods
Add Payment MethodPOST /payment/methods✅ AvailableREADYCredit card, ACH, etc.
Process Stripe PaymentPOST /payment/stripe/process✅ AvailableREADYStripe integration

API Summary Table

Business ProcessPrimary API EndpointCreate MethodAPI StatusExternal System Dependency
CustomerPOST /customersDirect API✅ READYIndependent
Master AgreementPOST /subscriptions/master-agreementsDirect API✅ READYIndependent
SubscriptionPOST /subscriptionsDirect API✅ READYIndependent
LicenseVia Cart CompletionIndirect (Cart workflow)✅ READYIndependent
ProductPOST /productsDirect API✅ READYIndependent
CartPOST /cartDirect API✅ READYIndependent
QuotePOST /payment/quotesDirect API✅ READYIndependent
OrderPOST /cart/set/placed/{id}State Change✅ READYIndependent
InvoiceAuto-generated on completionAutomatic✅ READYIndependent
PaymentPOST /paymentDirect API✅ READY⚠️ Optional (Stripe/Gateway)

Table Column Definitions

  • Business Process - The core business entity or workflow
  • Primary API Endpoint - Main REST API for creating/managing the entity
  • Create Method - How the entity is created:
    • Direct API: Standard REST POST endpoint
    • Indirect: Created as part of another workflow
    • State Change: Created by changing entity state
    • Automatic: System-generated
  • API Status - Current implementation status (✅ READY = Production ready)
  • External System Dependency - Whether Salesforce or other external systems are required:
    • Independent - Works completely standalone
    • ⚠️ Optional - Can integrate but not required
    • Required - External system mandatory

External System Integration Notes

Good News: SureMSA is 100% Standalone Ready! 🎉

All core business processes work without any external system dependencies:

  1. ✅ No Salesforce Required

    • All entities (Customer, Agreement, Subscription, License, Product) can be created via REST API
    • Customer codes auto-generated internally
    • Billing Project IDs auto-generated from customer + subscription name
    • Master Agreements can auto-create with customers or be created independently
  2. ⚠️ Optional Integrations Available

    • Payment Processing: Can integrate with Stripe, but also supports internal payment tracking
    • Salesforce: Optional bidirectional sync for customers who use Salesforce CRM
    • QuickBooks: Optional accounting integration for invoice/payment sync
    • WooCommerce: Optional e-commerce integration for web orders
  3. How to Enable Optional Integrations (if desired):

    • Set appropriate channel field to integration source (e.g., "SALESFORCE", "QUICKBOOKS")
    • Configure external system credentials in system settings
    • Use import endpoints: POST /customers/import/all/quickbooks/customers
    • Link external IDs via CustomerExternalSystemRequest field
  4. Standalone Operation Best Practices:

    • Use createdViaChannel: "INTERNAL" for all entities
    • Omit customerExternalSystemRequest field when creating customers
    • Rely on auto-generation for customer codes and billing project IDs
    • Use Cart workflow for end-to-end order processing

The "❌ No" in the old table meant "No external system required" - which is actually great news!


Key Principles for Standalone Operation

1. Customer Code Generation

  • ✅ Auto-generated from customer fullName
  • ✅ Unique and collision-resistant
  • ✅ No external system required

2. Billing Project ID Generation

  • ✅ Auto-generated from customerCode + subscriptionName
  • ✅ Format: {customerCode}-{subscriptionName} (lowercase, sanitized)
  • ✅ Can be previewed before creation

3. Master Agreement Auto-Creation

  • ✅ Set autoCreateMasterAgreement: true in customer creation
  • ✅ Creates default agreement automatically
  • ✅ No manual step required

4. License Provisioning

  • ✅ Licenses created via Cart workflow
  • ✅ Automatic provisioning on cart completion
  • ✅ No separate license creation API needed

5. Channel Independence

  • ✅ Set createdViaChannel: "INTERNAL" for all entities
  • ✅ No external system integration required
  • ✅ Full standalone operation

Authentication & Authorization

All API endpoints require authentication:

Authorization: Bearer {JWT_TOKEN}

Required Roles:

  • user - Basic access
  • admin - Full CRUD operations
  • service - Service-to-service calls

Error Handling

All APIs return standard error responses:

{
"status": 422,
"message": "Unable to create customer, validation failed",
"errors": ["fullName is required"]
}

Common Status Codes:

  • 200 - Success
  • 201 - Created
  • 400 - Bad Request
  • 401 - Unauthorized
  • 404 - Not Found
  • 422 - Unprocessable Entity (validation error)

Next Steps

  1. Set up authentication - Obtain JWT tokens
  2. Create test customer - Use POST /customers with autoCreateMasterAgreement: true
  3. Create products - Define your product catalog
  4. Test cart workflow - Create cart → place → complete
  5. Monitor licenses - Verify automatic license provisioning


Support

For API questions or issues: