Code Examples
Learn how to integrate Quote3D API into your application with code examples in multiple programming languages. Copy and paste these examples to get started quickly.
Note: Replace YOUR_TOKEN_HERE with your actual API token. Replace FILE_ID_HERE and QUOTE_ID_HERE with actual IDs from your API responses.
Authentication
How to authenticate your API requests
curl -X GET "https://api.quote3d.com/v2/user" \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-H "Content-Type: application/json"import requests
url = "https://api.quote3d.com/v2/user"
headers = {
"Authorization": "Bearer YOUR_TOKEN_HERE",
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
print(response.json())const response = await fetch('https://api.quote3d.com/v2/user', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_TOKEN_HERE',
'Content-Type': 'application/json'
}
});
const data = await response.json();
log.info('User data', { data });interface UserResponse {
user_id: string;
email: string;
plan: string;
quotes_used: number;
quotes_limit: number;
}
const response = await fetch('https://api.quote3d.com/v2/user', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_TOKEN_HERE',
'Content-Type': 'application/json'
}
});
const data: UserResponse = await response.json();
log.info('User data', { data });File Upload
Upload a 3D model file (STL, 3MF, OBJ)
curl -X POST "https://api.quote3d.com/v2/file" \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-F "file=@model.stl"import requests
url = "https://api.quote3d.com/v2/file"
headers = {
"Authorization": "Bearer YOUR_TOKEN_HERE"
}
with open('model.stl', 'rb') as f:
files = {'file': ('model.stl', f, 'application/octet-stream')}
response = requests.post(url, headers=headers, files=files)
print(response.json())const formData = new FormData();
formData.append('file', fileInput.files[0]);
const response = await fetch('https://api.quote3d.com/v2/file', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN_HERE'
},
body: formData
});
const data = await response.json();
log.info('File data', { data });Public File Upload
Upload a file without authentication using upload_id
curl -X GET "https://api.quote3d.com/v2/file/upload-id" \
-H "Authorization: Bearer YOUR_TOKEN_HERE"curl -X POST "https://api.quote3d.com/v2/file/public/UPLOAD_ID_HERE" \
-F "file=@model.stl"// Step 1: Get upload ID
const uploadIdResponse = await fetch('https://api.quote3d.com/v2/file/upload-id', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_TOKEN_HERE'
}
});
const { upload_id } = await uploadIdResponse.json();
// Step 2: Upload file (no auth required)
const formData = new FormData();
formData.append('file', fileInput.files[0]);
const uploadResponse = await fetch(`${baseUrl}/v2/file/public/${upload_id}`, {
method: 'POST',
body: formData
});
const result = await uploadResponse.json();
log.info('Upload result', { result });Quote Generation
Generate an instant quote for a 3D model. All parameters are optional - if not provided, values from your Dashboard Slice Profile will be used. The filament_type parameter should match a material name from your Dashboard Material Profile. For accurate pricing, ensure both price_per_kg and price_per_gram are set in your Material Profile.
# Minimal request - uses all settings from Dashboard Slice Profile
curl -X POST "https://api.quote3d.com/v2/file/quote/FILE_ID_HERE" \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-H "Content-Type: application/json" \
-d '{
"material_config": {
"filament_type": "PLA"
}
}'# Full request with custom parameters
# Parameters not specified will use Dashboard Slice Profile values
curl -X POST "https://api.quote3d.com/v2/file/quote/FILE_ID_HERE" \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-H "Content-Type: application/json" \
-d '{
"printer_config": {
"bed_size_x": 210,
"bed_size_y": 210,
"bed_size_z": 250,
"nozzle_diameter": 0.4,
"nozzle_count": 1,
"print_speed": 60,
"max_print_speed": 120,
"travel_speed": 150,
"first_layer_speed": 30,
"layer_height": 0.2,
"min_layer_height": 0.1,
"max_layer_height": 0.3,
"perimeters": 3,
"top_solid_layers": 4,
"bottom_solid_layers": 4,
"min_wall_count": 2,
"max_wall_count": 5,
"fill_density": 20,
"infill_pattern": "grid",
"support_material": true,
"support_overhang_angle": 45,
"support_density": 15,
"acceleration_print": 800,
"acceleration_travel": 1000,
"acceleration_retraction": 1000,
"jerk_print": 8,
"jerk_travel": 20,
"jerk_retraction": 5,
"min_hotend_temp": 180,
"max_hotend_temp": 260,
"min_bed_temp": 0,
"max_bed_temp": 100,
"hourly_cost": 5.0
},
"material_config": {
"filament_type": "PLA",
"density": 1.24,
"diameter": 1.75,
"temperature": 210,
"print_temp_min": 190,
"print_temp_max": 230,
"bed_temperature": 60,
"bed_temp_min": 0,
"bed_temp_max": 70,
"fan_speed": 100,
"min_fan_speed": 0,
"retraction_distance": 6.5,
"retraction_speed": 25,
"price_per_kg": 20.0,
"price_per_gram": 0.02,
"support_cost_multiplier": 1.2
},
"quote_config": {
"currency": "USD",
"tax_rate": 20,
"fixed_fee": 2.0,
"energy_cost_per_kwh": 0.12
}
}'import requests
# Minimal request - uses Dashboard Slice Profile settings
url = "https://api.quote3d.com/v2/file/quote/FILE_ID_HERE"
headers = {
"Authorization": "Bearer YOUR_TOKEN_HERE",
"Content-Type": "application/json"
}
data = {
"material_config": {
"filament_type": "PLA"
}
}
response = requests.post(url, headers=headers, json=data)
print(response.json())import requests
url = "https://api.quote3d.com/v2/file/quote/FILE_ID_HERE"
headers = {
"Authorization": "Bearer YOUR_TOKEN_HERE",
"Content-Type": "application/json"
}
data = {
"printer_config": {
"bed_size_x": 210,
"bed_size_y": 210,
"bed_size_z": 250,
"nozzle_diameter": 0.4,
"nozzle_count": 1,
"print_speed": 60,
"max_print_speed": 120,
"travel_speed": 150,
"first_layer_speed": 30,
"layer_height": 0.2,
"min_layer_height": 0.1,
"max_layer_height": 0.3,
"perimeters": 3,
"top_solid_layers": 4,
"bottom_solid_layers": 4,
"min_wall_count": 2,
"max_wall_count": 5,
"fill_density": 20,
"infill_pattern": "grid",
"support_material": True,
"support_overhang_angle": 45,
"support_density": 15,
"acceleration_print": 800,
"acceleration_travel": 1000,
"acceleration_retraction": 1000,
"jerk_print": 8,
"jerk_travel": 20,
"jerk_retraction": 5,
"min_hotend_temp": 180,
"max_hotend_temp": 260,
"min_bed_temp": 0,
"max_bed_temp": 100,
"hourly_cost": 5.0
},
"material_config": {
"filament_type": "PLA",
"density": 1.24,
"diameter": 1.75,
"temperature": 210,
"print_temp_min": 190,
"print_temp_max": 230,
"bed_temperature": 60,
"bed_temp_min": 0,
"bed_temp_max": 70,
"fan_speed": 100,
"min_fan_speed": 0,
"retraction_distance": 6.5,
"retraction_speed": 25,
"price_per_kg": 20.0,
"price_per_gram": 0.02,
"support_cost_multiplier": 1.2
},
"quote_config": {
"currency": "USD",
"tax_rate": 20,
"fixed_fee": 2.0,
"energy_cost_per_kwh": 0.12
}
}
response = requests.post(url, headers=headers, json=data)
print(response.json())// Minimal request - uses Dashboard Slice Profile settings
const response = await fetch('https://api.quote3d.com/v2/file/quote/FILE_ID_HERE', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN_HERE',
'Content-Type': 'application/json'
},
body: JSON.stringify({
material_config: {
filament_type: 'PLA'
}
})
});
const data = await response.json();
log.info('Data', { data });// Full request with custom parameters
const response = await fetch('https://api.quote3d.com/v2/file/quote/FILE_ID_HERE', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN_HERE',
'Content-Type': 'application/json'
},
body: JSON.stringify({
printer_config: {
bed_size_x: 210,
bed_size_y: 210,
bed_size_z: 250,
nozzle_diameter: 0.4,
nozzle_count: 1,
print_speed: 60,
max_print_speed: 120,
travel_speed: 150,
first_layer_speed: 30,
layer_height: 0.2,
min_layer_height: 0.1,
max_layer_height: 0.3,
perimeters: 3,
top_solid_layers: 4,
bottom_solid_layers: 4,
min_wall_count: 2,
max_wall_count: 5,
fill_density: 20,
infill_pattern: 'grid',
support_material: true,
support_overhang_angle: 45,
support_density: 15,
acceleration_print: 800,
acceleration_travel: 1000,
acceleration_retraction: 1000,
jerk_print: 8,
jerk_travel: 20,
jerk_retraction: 5,
min_hotend_temp: 180,
max_hotend_temp: 260,
min_bed_temp: 0,
max_bed_temp: 100,
hourly_cost: 5.0
},
material_config: {
filament_type: 'PLA',
density: 1.24,
diameter: 1.75,
temperature: 210,
print_temp_min: 190,
print_temp_max: 230,
bed_temperature: 60,
bed_temp_min: 0,
bed_temp_max: 70,
fan_speed: 100,
min_fan_speed: 0,
retraction_distance: 6.5,
retraction_speed: 25,
price_per_kg: 20.0,
price_per_gram: 0.02,
support_cost_multiplier: 1.2
},
quote_config: {
currency: 'USD',
tax_rate: 20,
fixed_fee: 2.0,
energy_cost_per_kwh: 0.12
}
})
});
const data = await response.json();
log.info('Data', { data });Printability Check
Check if a model fits in your printer
curl -X POST "https://api.quote3d.com/v2/printability/FILE_ID_HERE" \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-H "Content-Type: application/json" \
-d '{
"x": 210,
"y": 210,
"z": 250
}'import requests
url = "https://api.quote3d.com/v2/printability/FILE_ID_HERE"
headers = {
"Authorization": "Bearer YOUR_TOKEN_HERE",
"Content-Type": "application/json"
}
data = {
"x": 210,
"y": 210,
"z": 250
}
response = requests.post(url, headers=headers, json=data)
print(response.json())const response = await fetch('https://api.quote3d.com/v2/printability/FILE_ID_HERE', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN_HERE',
'Content-Type': 'application/json'
},
body: JSON.stringify({
x: 210,
y: 210,
z: 250
})
});
const data = await response.json();
log.info('Data', { data });Quote History
Retrieve your quote history
curl -X GET "https://api.quote3d.com/v2/quotes?page=1&limit=10" \
-H "Authorization: Bearer YOUR_TOKEN_HERE"curl -X GET "https://api.quote3d.com/v2/quotes/QUOTE_ID_HERE" \
-H "Authorization: Bearer YOUR_TOKEN_HERE"import requests
# Get all quotes
url = "https://api.quote3d.com/v2/quotes"
headers = {
"Authorization": "Bearer YOUR_TOKEN_HERE"
}
params = {"page": 1, "limit": 10}
response = requests.get(url, headers=headers, params=params)
quotes = response.json()
print(quotes)
# Get specific quote
quote_id = "QUOTE_ID_HERE"
quote_response = requests.get(f"{baseUrl}/v2/quotes/{quote_id}", headers=headers)
quote = quote_response.json()
print(quote)// Get all quotes
const quotesResponse = await fetch('https://api.quote3d.com/v2/quotes?page=1&limit=10', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_TOKEN_HERE'
}
});
const quotes = await quotesResponse.json();
log.info('Quotes', { quotes });
// Get specific quote
const quoteId = 'QUOTE_ID_HERE';
const quoteResponse = await fetch(`${baseUrl}/v2/quotes/${quoteId}`, {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_TOKEN_HERE'
}
});
const quote = await quoteResponse.json();
log.info('Quote', { quote });Webhooks
Create and manage webhooks for real-time notifications
curl -X POST "https://api.quote3d.com/v2/webhooks" \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-app.com/webhook",
"events": ["quote.completed", "quote.failed"],
"secret": "your-webhook-secret"
}'import requests
url = "https://api.quote3d.com/v2/webhooks"
headers = {
"Authorization": "Bearer YOUR_TOKEN_HERE",
"Content-Type": "application/json"
}
data = {
"url": "https://your-app.com/webhook",
"events": ["quote.completed", "quote.failed"],
"secret": "your-webhook-secret"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())const response = await fetch('https://api.quote3d.com/v2/webhooks', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN_HERE',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://your-app.com/webhook',
events: ['quote.completed', 'quote.failed'],
secret: 'your-webhook-secret'
})
});
const webhook = await response.json();
log.info('Webhook', { webhook });Analytics
Get analytics and usage statistics
curl -X GET "https://api.quote3d.com/v2/analytics/quotes" \
-H "Authorization: Bearer YOUR_TOKEN_HERE"curl -X GET "https://api.quote3d.com/v2/analytics/popular" \
-H "Authorization: Bearer YOUR_TOKEN_HERE"import requests
headers = {
"Authorization": "Bearer YOUR_TOKEN_HERE"
}
# Get quote statistics
quotes_stats = requests.get("https://api.quote3d.com/v2/analytics/quotes", headers=headers).json()
print(quotes_stats)
# Get popular materials
popular = requests.get("https://api.quote3d.com/v2/analytics/popular", headers=headers).json()
print(popular)const headers = {
'Authorization': 'Bearer YOUR_TOKEN_HERE'
};
// Get quote statistics
const quotesStats = await fetch('https://api.quote3d.com/v2/analytics/quotes', { headers }).then(r => r.json());
log.info('Quotes statistics', { quotesStats });
// Get popular materials
const popular = await fetch('https://api.quote3d.com/v2/analytics/popular', { headers }).then(r => r.json());
log.info('Popular materials', { popular });Need More Help?
Check out our interactive API Playground to test endpoints directly in your browser, or explore the Core Concepts guide for detailed explanations.