Exemples de code
Apprenez à intégrer l'API Quote3D dans votre application avec des exemples de code dans plusieurs langages de programmation. Copiez et collez ces exemples pour démarrer rapidement.
Note : Remplacez YOUR_TOKEN_HERE par votre véritable jeton d'API. Remplacez FILE_ID_HERE et QUOTE_ID_HERE par des identifiants réels issus de vos réponses API.
Authentification
Comment authentifier vos requêtes API
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 });Téléchargement de fichier
Télécharger un fichier modèle 3D (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 });Téléchargement de fichier public
Télécharger un fichier sans authentification en utilisant l'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 "[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 });Génération de devis
Démarrez un calcul de devis asynchrone pour un modèle 3D. Tous les paramètres sont facultatifs ; s'ils ne sont pas fournis, les valeurs de votre profil de découpe (Slice Profile) du Tableau de bord seront utilisées. Le point de terminaison renvoie d'abord une tâche, puis vous pouvez lire le résultat compact terminé à partir de GET /v2/jobs/JOB_ID_ICI et le devis détaillé stocké à partir de GET /v2/quotes/QUOTE_ID_ICI. La devise par défaut est celle de vos paramètres de tableau de bord, mais elle peut être remplacée (par exemple, 'USD', 'EUR', 'TRY'). Le paramètre filament_type doit correspondre à un nom de matériau de votre profil de matériaux (Material Profile) du Tableau de bord.
# 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": "Blanc"
}
}'# 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": "Blanc"
}
}'# 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": "Blanc",
"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": "Blanc"
}
}
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": "Blanc"
}
}
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": "Blanc",
"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: 'Blanc'
}
})
});
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: 'Blanc'
}
})
});
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: 'Blanc',
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"
}
}Vérification d'imprimabilité
Vérifiez si un modèle est compatible avec votre imprimante
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"
}
}Historique des devis
Récupérer votre historique de devis
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
Créer et gérer des webhooks pour des notifications en temps réel
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 });Analyses
Obtenez des statistiques d'utilisation et d'analyse
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 });Besoin d'aide supplémentaire ?
Consultez notre API Playground interactif pour tester les points de terminaison directement dans votre navigateur, ou explorez le guide des Concepts de base pour des explications détaillées.