Code-Beispiele
Erfahren Sie, wie Sie die Quote3D API in Ihre Anwendung mit Code-Beispielen in verschiedenen Programmiersprachen integrieren. Kopieren und fügen Sie diese Beispiele ein, um schnell loszulegen.
Hinweis: Ersetzen Sie YOUR_TOKEN_HERE durch Ihr tatsächliches API-Token. Ersetzen Sie FILE_ID_HERE und QUOTE_ID_HERE durch tatsächliche IDs aus Ihren API-Antworten.
Authentifizierung
So authentifizieren Sie Ihre API-Anfragen
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 });Datei hochladen
Eine 3D-Modelldatei hochladen (STL, 3MF, OBJ)
curl -X POST "https://api.quote3d.com/v2/file" \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-F "[email protected]"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 });Öffentlicher Datei-Upload
Eine Datei ohne Authentifizierung unter Verwendung der Upload-ID hochladen
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 "[email protected]"// 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 });Angebotserstellung
Starten Sie eine asynchrone Angebotsberechnung für ein 3D-Modell. Alle Parameter sind optional; wenn sie nicht angegeben werden, werden die Werte aus Ihrem Dashboard-Slice-Profil verwendet. Der Endpunkt gibt zuerst einen Job zurück, dann können Sie das abgeschlossene kompakte Ergebnis von GET /v2/jobs/JOB_ID_HERE und das detaillierte gespeicherte Angebot von GET /v2/quotes/QUOTE_ID_HERE lesen. Die Währung entspricht standardmäßig Ihren Dashboard-Einstellungen, kann aber überschrieben werden (z. B. 'USD', 'EUR', 'TRY'). Der Parameter 'filament_type' sollte mit einem Materialnamen aus Ihrem Dashboard-Materialprofil übereinstimmen.
# 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",
"color": "Weiß"
}
}'# Uses settings from a specific Printer Profile instead of defaults
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_id": "YOUR_PRINTER_ID_HERE",
"quantity": 1,
"material_config": {
"filament_type": "PLA",
"color": "Weiß"
}
}'# 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_id": "YOUR_PRINTER_ID_HERE",
"quantity": 1,
"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",
"color": "Weiß",
"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,
"hollowing": "solid",
"post_processing": "standard"
}
}'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",
"color": "Weiß"
}
}
job = requests.post(url, headers=headers, json=data).json()
print(job)
status_response = requests.get(f"https://api.quote3d.com{job['data']['statusUrl']}", headers=headers)
print(status_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_id": "YOUR_PRINTER_ID_HERE",
"quantity": 1,
"material_config": {
"filament_type": "PLA",
"color": "Weiß"
}
}
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_id": "YOUR_PRINTER_ID_HERE",
"quantity": 1,
"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",
"color": "Weiß",
"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,
"hollowing": "solid",
"post_processing": "standard"
}
}
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',
color: 'Weiß'
}
})
});
const job = await response.json();
log.info('Job', { job });
const statusResponse = await fetch(`https://api.quote3d.com${job.data.statusUrl}`, {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_TOKEN_HERE'
}
});
const status = await statusResponse.json();
log.info('Job status', { status });// Uses settings from a specific Printer Profile
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_id: 'YOUR_PRINTER_ID_HERE',
quantity: 1,
material_config: {
filament_type: 'PLA',
color: 'Weiß'
}
})
});
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_id: 'YOUR_PRINTER_ID_HERE',
quantity: 1,
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',
color: 'Weiß',
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,
hollowing: 'solid',
post_processing: 'standard'
}
})
});
const data = await response.json();
log.info('Data', { data });{
"material_config": {
"filament_type": "PA12",
"density": 1.01,
"powder_bulk_density": 0.45,
"price_per_gram": 0.09,
"sls_refresh_factor": 1.15
},
"quote_config": {
"post_processing": "standard"
}
}{
"success": true,
"data": {
"jobId": "job_01HXYZ123456789",
"status": "queued",
"statusUrl": "/v2/jobs/job_01HXYZ123456789",
"estimatedTime": 120,
"createdAt": "2026-03-14T09:30:00.000Z"
}
}{
"success": true,
"data": {
"jobId": "job_01HXYZ123456789",
"status": "completed",
"progress": 100,
"createdAt": "2026-03-14T09:30:00.000Z",
"startedAt": "2026-03-14T09:30:04.000Z",
"completedAt": "2026-03-14T09:30:26.000Z",
"result": {
"user_id": "usr_123",
"status": "success",
"timestamp": "2026-03-14T09:30:26.000Z",
"quote_duration": 22,
"file_path": "/uploads/example.stl",
"currency": "USD",
"estimated_time": "2h 15m",
"estimated_time_seconds": 8100,
"filament_weight": 42.8,
"filament_cost": 1.07,
"total_price": 12.50,
"quote_id": "job_01HXYZ123456789",
"quantity": 2,
"printInfo": {
"technology": "FDM",
"printerName": "Prusa MK4",
"material": "PLA",
"color": "Black",
"layerHeight": 0.2,
"infillDensity": 20,
"infillPattern": "grid",
"wallCount": 3,
"quantity": 2,
"hollowing": "solid",
"postProcessing": "standard"
},
"modelInfo": {
"volume": 34.5,
"weight": 42.8,
"bounds": {
"x": 98.2,
"y": 44.1,
"z": 27.6
}
},
"pricing": {
"total": 12.5,
"currency": "USD",
"materialCost": 1.07
},
"geometricIntegrity": {
"isValid": true,
"description": "Model is manifold and ready for printing"
},
"adhesionRisk": {
"value": 0.12,
"needsBrim": false,
"brimWidth": 0
},
"totalTravelLength": "305.3m"
}
}
}{
"quote_id": "job_01HXYZ123456789",
"file_id": "file_123",
"result": {
"success": true,
"modelInfo": {
"fileName": "example.stl",
"fileSize": 512000,
"triangleCount": 84200,
"volume": 34.5,
"surfaceArea": 98.2,
"bounds": { "x": 98.2, "y": 44.1, "z": 27.6 },
"weight": { "model": 39.1, "support": 3.7, "total": 42.8 }
},
"printInfo": {
"printerName": "Prusa MK4",
"material": "PLA",
"color": "Black",
"technology": "FDM",
"layerHeight": 0.2,
"infillDensity": 20,
"infillPattern": "grid",
"wallCount": 3,
"postProcessing": "standard",
"hollowing": "solid",
"quantity": 2,
"layerCount": 146,
"supportVolume": 3.2,
"filamentLength": { "model": 12500, "support": 980, "total": 13480 }
},
"timeEstimation": {
"printingTime": 7940,
"totalTime": 8100,
"breakdown": {
"technology": "FDM",
"walls": 2810,
"infill": 2180,
"support": 760,
"travel": 940,
"other": 1410
},
"humanReadable": "2h 15m"
},
"pricing": {
"materialCost": 1.07,
"timeCost": 5.62,
"supportCost": 0.23,
"total": 12.5,
"currency": "USD"
},
"recommendations": [
"Use the selected orientation for lower support usage."
],
"processedAt": "2026-03-14T09:30:26.000Z",
"processingTimeMs": 22134,
"version": "2.0"
}
}Druckbarkeitsprüfung
Prüfen, ob ein Modell in Ihren Drucker passt
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 });{
"user_id": "usr_123",
"file_path": "/uploads/models/gearbox-housing.stl",
"fits_printer": true,
"technology": "FDM",
"fits_without_orientation": false,
"orientation_optimized": true,
"volume": 42.15,
"surface_area": 128.4,
"triangle_count": 84200,
"model_dimensions": {
"x": 62.4,
"y": 88.1,
"z": 47.2
},
"printer_dimensions": {
"x": 210,
"y": 210,
"z": 250
},
"original_model_dimensions": {
"x": 88.1,
"y": 62.4,
"z": 47.2
},
"optimized_model_dimensions": {
"x": 62.4,
"y": 88.1,
"z": 47.2
},
"orientation": {
"rotation": {
"x": 0,
"y": 90,
"z": 0
},
"score": 0.91,
"support_ratio": 0.08,
"overhang_score": 0.94
},
"geometric_integrity": {
"is_valid": true,
"open_edges": 0,
"non_manifold_edges": 0,
"description": "Geometry is valid and watertight"
}
}Angebotsverlauf
Rufen Sie Ihren Angebotsverlauf ab
curl -X GET "https://api.quote3d.com/v2/quotes?offset=0&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 = {"offset": 0, "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?offset=0&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
Erstellen und verwalten Sie Webhooks für Echtzeitbenachrichtigungen
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"]
}'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"]
}
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']
})
});
const webhook = await response.json();
log.info('Webhook', { webhook });Analysen
Erhalten Sie Analysen und Nutzungsstatistiken
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 });Benötigen Sie weitere Hilfe?
Schauen Sie sich unseren interaktiven API Playground an, um Endpunkte direkt in Ihrem Browser zu testen, oder erkunden Sie den Leitfaden zu den Kernkonzepten für detaillierte Erklärungen.