Creating Assets from APIs

Creating Assets from APIs

Overview

Once your API is connected to Spartera, the next step is creating Assets,
the products that buyers will purchase and use. An asset defines the input
parameters, pricing, and marketplace presence of your model.

What is an Asset?

An asset is a marketplace product that:

  • Exposes your ML model's capabilities to buyers
  • Defines what inputs the model accepts
  • Specifies output format and pricing
  • Appears in the Spartera marketplace for discovery

Think of it as: Your API is the backend engine, the Asset is the
customer-facing product.

Creating Your First Asset

Step 1: Navigate to Assets

  1. Log in to Spartera
  2. Go to AssetsAdd
  3. Click "Create Asset"

Step 2: Select Connection

Choose the API connection you created earlier:

Example: "Fraud Detection Model API"

This links your asset to your deployed model.

Step 3: Configure Basic Information

Asset Name

✅ Good Examples:
"Real-Time Fraud Detection"
"Customer Churn Predictor"
"Property Value Estimator"
"Credit Risk Scorer"

❌ Avoid:
"ML Model 1"
"API Endpoint"
"Prediction Service"

Best Practices:

  • Clear and descriptive
  • Include what it does
  • Use action words (Detect, Predict, Estimate, Score)
  • Customer-facing language

Short Description

One sentence (100-150 characters) that appears in marketplace cards:

Example: "Predict customer churn probability with 92% accuracy based on
usage patterns and demographics."

Example: "Real-time fraud detection for transactions with sub-100ms
latency."

Asset Type

Select: Calculation (Insight API)

This indicates your asset provides predictive insights via API.

Category

Choose the most appropriate category:

  • Financial Services
  • Risk Analytics
  • Customer Intelligence
  • Real Estate
  • Healthcare
  • E-commerce
  • Supply Chain
  • Marketing
  • Other

Configuring Input Parameters

Input parameters define what data buyers must provide to get a prediction.

Step 4: Add Input Parameters

Click "Add Parameter" for each input your model requires.

Parameter Configuration Fields

FieldDescriptionExample
Parameter NameInternal API parameter namecustomer_age
Display LabelUser-friendly name shown to buyersCustomer Age
Data TypeType of input (STRING, INTEGER, FLOAT)INTEGER
DescriptionExplanation of what this representsAge of customer
RequiredWhether this parameter is mandatoryYes
Valid ValuesOptional dropdown of allowed values0, 1, 2, 3
PlaceholderExample value shown to users35

Example Parameter Configurations

For Fraud Detection Model:

Parameter 1:

Parameter Name: transaction_amount
Display Label: Transaction Amount (USD)
Data Type: FLOAT
Description: Dollar amount of the transaction
Required: Yes
Placeholder: 125.50

Parameter 2:

Parameter Name: merchant_category
Display Label: Merchant Category
Data Type: STRING
Description: Type of merchant (retail, restaurant, gas, etc.)
Required: Yes
Valid Values: retail, restaurant, gas_station, online, grocery

Parameter 3:

Parameter Name: card_present
Display Label: Card Present
Data Type: INTEGER
Description: Was physical card present? (1=Yes, 0=No)
Required: Yes
Valid Values: 0, 1

For Rent Prediction Model:

Parameter Name: state
Display Label: State
Data Type: STRING
Description: US state abbreviation (e.g., NY, CA)
Required: Yes
Placeholder: NY

Parameter Name: zip_code
Display Label: ZIP Code
Data Type: INTEGER
Description: 5-digit ZIP code
Required: Yes
Placeholder: 10001

Parameter Name: bedrooms
Display Label: Number of Bedrooms
Data Type: INTEGER
Description: Number of bedrooms (0-5)
Required: Yes
Valid Values: 0, 1, 2, 3, 4, 5

Parameter Best Practices

DO:

  • Use clear, descriptive display labels
  • Provide helpful descriptions
  • Set appropriate data types
  • Use dropdown values when options are limited
  • Include units in labels (USD, years, miles, etc.)

DON'T:

  • Use technical jargon in display labels
  • Leave descriptions empty
  • Use overly long names
  • Omit required validation

Configuring Function ID (Optional)

If using Function ID Routing:

Function ID Field

Example: predict_fraud
Example: predict_churn
Example: predict_rent

Leave blank if:

  • Your API Endpoint URL includes the full path (e.g., .../predict)
  • You're using direct routing

Set a value if:

  • Your API Endpoint URL is the base URL
  • You're using function_id routing
  • You have multiple models on one base URL

Defining API Response Schema

Tell Spartera what to expect from your API's response.

Step 5: Configure Response Fields

You need to define the three fields your API returns:

Field 1: timestamp

Show: ✓ (checked)
Field Name: timestamp
Column Alias: Prediction Timestamp
Data Type: STRING
Description: When the prediction was generated

Field 2: answer_value

Show: ✓ (checked)
Field Name: answer_value
Column Alias: (depends on your model)
Data Type: FLOAT or INTEGER
Description: (depends on your model)

Column Alias Examples:

  • Fraud Detection: Fraud Probability (0-1)
  • Churn Prediction: Churn Risk Score
  • House Price: Estimated Value (USD)
  • Credit Score: Credit Risk Rating (0-100)

Field 3: asset_id

Show: ✓ (checked)
Field Name: asset_id
Column Alias: Asset ID
Data Type: STRING
Description: Unique identifier for this prediction

Setting Pricing

Step 6: Configure Pricing

Pricing Model

Select: Pay Per Use

This charges buyers per prediction.

Price Per Prediction

Set your price in USD:

Examples by Model Type:
$0.01 - Simple classifications (spam detection, sentiment)
$0.05 - Standard predictions (lead scoring, churn)
$0.10 - Complex models (fraud detection, demand forecasting)
$0.25 - High-value predictions (credit risk, price optimization)
$0.50+ - Premium models (property valuation, medical diagnosis)

Pricing Tips:

  • Start smaller, gradually increase if needed
  • Research competitor pricing
  • Consider buyer's value (what decision does this enable?)
  • Test different price points with beta customers

Adding Detailed Description

Step 7: Write Marketplace Description

This appears on your asset's detail page. Include:

1. What It Does (1-2 sentences)

Example: "Predicts monthly rent for residential properties across the US
based on location and property characteristics. Uses machine learning
trained on 500,000+ rental listings."

2. Key Features (bullet points)

Example:
• 94% prediction accuracy
• Sub-second response time
• Covers all 50 US states
• Updated weekly with new market data

3. Use Cases (3-5 examples)

Example:
• Real estate investors evaluating purchase opportunities
• Property managers setting competitive rental rates
• Renters budgeting for relocations
• Real estate platforms showing estimated rents

4. Technical Details

Example:
Model Type: Boosted Tree Regression
Training Data: 500K+ rental listings (2020-2025)
Update Frequency: Weekly
Expected Latency: <500ms
Accuracy: MAE $150, R² 0.89

5. Input Requirements

Example:
Required Inputs:
• State (US state code)
• ZIP Code (5 digits)
• Number of Bedrooms (0-5)

6. Output Format

Example:
Returns predicted monthly rent in USD as a float.
Range: $200 - $10,000/month

Testing Your Asset

Step 8: Preview and Test

Before publishing, test your asset:

  1. Click "Preview" in asset settings
  2. Fill in sample parameters
  3. Click "Test Prediction"
  4. Verify response is correct

Test Cases to Try:

Valid input - Should return prediction
Edge case values - Min/max values
Invalid input - Should return error
Missing parameters - Should return error

Example Test:

Input:
  state: NY
  zip_code: 10001
  bedrooms: 2

Expected Output:
{
  "timestamp": "2026-01-30T19:30:00.000000+00:00",
  "answer_value": 2850.00,
  "asset_id": "test-123"
}

Publishing to Marketplace

Step 9: Publish

Once testing is successful:

  1. Click "Publish to Marketplace"
  2. Review all settings one final time
  3. Confirm publication

Your asset is now live! 🎉

Buyers can now:

  • Discover your model in marketplace search
  • View details and pricing
  • Test with free predictions (if you offer trial)
  • Purchase and start using

Post-Publication

Monitoring Performance

Track your asset's performance:

Analytics Dashboard shows:
• Total predictions served
• Revenue generated
• Active customers
• Average response time
• Error rate
• Customer ratings

Updating Your Asset

You can update anytime:

Can Update Without Republishing:

  • Pricing
  • Description
  • Documentation

Requires Republishing:

  • Input parameters
  • Output schema
  • Function ID

Managing Customer Feedback

Respond to customer reviews and questions:

  • Monitor feedback regularly
  • Address issues quickly
  • Use feedback to improve model and documentation

Best Practices

Asset Naming

✅ Be specific and action-oriented
✅ Include what problem it solves
✅ Use customer language, not technical jargon

Documentation

✅ Write clear, comprehensive descriptions
✅ Include examples and use cases
✅ Document limitations honestly
✅ Provide sample inputs/outputs

Pricing Strategy

✅ Research competitor pricing
✅ Start higher, adjust based on demand
✅ Consider offering free trial predictions
✅ Monitor conversion rates

Testing

✅ Test thoroughly before publishing
✅ Try edge cases and invalid inputs
✅ Verify error messages are helpful
✅ Check response times

Multiple Assets from One API

You can create multiple assets using:

Same Connection, Different Function IDs:

Asset 1: "Churn Predictor" → function_id: predict_churn
Asset 2: "Fraud Detector" → function_id: predict_fraud
Asset 3: "Price Optimizer" → function_id: predict_price

Same Connection, Different Parameters:

Asset 1: "Quick Fraud Check" → Minimal parameters, fast
Asset 2: "Comprehensive Fraud Analysis" → Full parameters, thorough

Same Connection, Different Pricing:

Asset 1: "Basic Predictions" → $0.05 per prediction
Asset 2: "Premium Predictions with Explanations" → $0.25 per prediction

Troubleshooting

Asset test fails with 404 error

Solution:

  • Verify API endpoint URL is correct
  • Check Function ID matches your implementation
  • Test API directly with cURL

Parameters not validating

Solution:

  • Check data types match (INTEGER vs STRING)
  • Verify required parameters are marked correctly
  • Test with exact parameter names from your API

Pricing not saving

Solution:

  • Ensure price is positive number
  • Check currency is USD
  • Verify you have permission to set pricing

Next Steps

Now that your asset is created:

  1. Publish to Marketplace - Make it discoverable
  2. Monitor Performance - Track usage and revenue
  3. Optimize Pricing - Adjust based on
    demand
  4. Create More Assets - Monetize other models

Need Help?