Getting started
Get up and running with our API to start developing your own Shapeways integrations. Once you have registered and verified your Shapeways account you are ready to create your first app.
Create your first app
Create a new app to generate the API keys you’ll use to authenticate your API requests. You can access all apps associated with your account from the Manage apps page on the Shapeways Developers site.
Note: From the Manage apps screen, you can create, edit, or delete your applications.
API user account authorization
Your application will need access to users’ Shapeways accounts to upload models and place orders. To get started, you’ll need to decide what type of access your app will need as the user authorization process is different.
Note: The Shapeways API uses 0Auth 2.0 to authenticate users. Learn more about OAuth 2.0.
1. How many accounts will need access to the API?
This is the simplest way to get started using the API. Choose this option if the API only needs access to your Shapeways account.
2. Requesting the API Access Tokens
In Manage apps > (Your App) copy your Client ID and Client Secret. Add them to the code below and make a POST request. Save this Access Token & Refresh Token (only for multiple user accounts flow) in a safe place.
// Add your Client ID & Client Secret to the following code examples:
$clientId = 'YOUR_CLIENT_ID'; // replace this
$clientSecret = 'YOUR_CLIENT_SECRET'; // replace this
$url = 'https://api.shapeways.com/oauth2/token';
$params = ['grant_type' => 'client_credentials'];
try {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_USERPWD, $clientId . ':' . $clientSecret);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
// showing response on screen
print_r($response);
} catch (\Exception $e) {
// printing error on screen
echo 'Exception: '. $e->getMessage();
}
// Example API response
{
"access_token": "ACCESS_TOKEN",
"token_type": "bearer",
"expires_in": 3600
}
// Add your Client ID & Client Secret to the following code examples: curl -d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=\ YOUR_CLIENT_SECRET" -H "Content-Type: application/x-www-form-urlencoded" -X\ POST https://api.shapeways.com/oauth2/token
// Example API response
{"access_token":"ACCESS_TOKEN","token_type":"bearer","expires_in":3600}
// Add your Client ID & Client Secret to the following code examples:
import requests
url = 'https://api.shapeways.com/oauth2/token'
client_id = 'YOUR_CLIENT_ID'
client_secret = 'YOUR_CLIENT_SECRET'
post_data = {
'grant_type': 'client_credentials'
}
response = requests.post(url=url, data=post_data, auth=(client_id,client_secret))
access_token = response.json()['access_token']
print("Access token: " + access_token)
// Example API response
{
"access_token": "ACCESS_TOKEN",
"token_type": "bearer",
"expires_in": 3600
}
This option allows any user to authorize access to their Shapeways accounts so they can use your app. For example, choose this option if you are creating a plugin for Shopify, Squarespace, Etsy, etc that will need access to Shapeways user data other than your own.
2. Generate user authorization code
In Manage apps > (Your app) add a Redirect URI. This determines where authentication requests will be sent and received by your app. Users will be redirected to this URL when they attempt to use your app.
Note: Users will be redirected to this URL in browser and asked to Authorize your app.
// Redirect your user to Shapeways.com to authorize access
// Use the app’s Client ID and Redirect URI to make the API request
$redirectURL = 'https://example.com/redirect'; // replace this
$clientId = 'YOUR_CLIENT_ID'; // replace this
// A random text to be verified laster in your handle callback function
$verificationString = 'VERIFICATION_STRING';
$params = [
'response_type' => 'code',
'client_id' => $clientId,
'redirect_uri' => rawurlencode($redirectURL),
'state' => rawurlencode($verificationString),
];
$url = 'https://api.shapeways.come/oauth2/authorize';
$url = $url . '?' . http_build_query($params);
header('Location: ' . $url);
// Handling callback from Shapeways.com
// Use the Verification String you created for the authorization request
$verificationString = 'VERIFICATION_STRING';
$state = $_REQUEST['state'] ?? null;
if ($state !== $verificationString) {
echo 'Invalid request';
// retry or send error alerts
}
$code = $_REQUEST['code'] ?? null;
if ($code === null) {
echo 'Missing Authorization Code';
// retry or send error alerts
}
// Use the $code for the token request (#link to access token)
For oob curl instructions follow the quick start instruction below
// Add your Client ID & Redirect Url to the following code examples:
import requests
url = 'https://api.shapeways.com/oauth2/authorize?response_type=code&client_id={CLIENT_ID}&redirect_uri={REDIRECT_URL}'
r = requests.head(url, allow_redirects=True)
print(r.url)
Quick start method. Using "oob"(Out-Of-Band)
Don’t need other users to access your app yet? Get access for the account owner only by following these quick steps:
- In Manage apps > (Your app) add “oob” as a Redirect URI
- To generate an authorization code, modify and open this URL on your browser:
https://api.shapeways.com/oauth2/authorize?response_type=code&client_id={CLIENT_ID}&redirect_uri=oob - Click the Authorize button
- Copy the authorization code displayed on the screen
3. Requesting the API Access Tokens
Use the authorization code returned in the previous step to request access to the API. Add the necessary credentials to the code below and make a POST request. Save this Access Token & Refresh Token (only for multiple users flow) in a safe place (app owner only).
// Add your Client ID, Client Secret, Authorization Code,
//and Redirect URL to the code below
$clientId = 'YOUR_CLIENT_ID'; // replace this
$authorizationCode = 'AUTHORIZATION_CODE'; // replace this
$clientSecret = 'YOUR_CLIENT_SECRET'; // replace this
$redirectUrl = 'REDIRECT_URL'; // replace this
$url = 'https://api.shapeways.com/oauth2/token';
$data = array(
'grant_type' => 'authorization_code',
'code' => $authorizationCode,
'client_id' => $clientId,
'client_secret' => $clientSecret,
'redirect_uri' => $redirectUrl
);
try {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($ch);
curl_close($ch);
// printing API response on screen
print_r($response);
} catch (\Exception $e) {
// printing error on screen
echo 'Exception: ' . $e->getMessage();
}
// Example API response
{
"access_token": "ACCESS_TOKEN",
"token_type": "bearer",
"expires_in": 3600,
"refresh_token": "REFRESH_TOKEN"
}
// Add your Client ID & AUTHORIZATION_CODE to the following code examples:
curl -X POST -F 'grant_type=authorization_code' -F 'code={AUTHORIZATION_CODE}'\
-F 'redirect_uri={YOUR_REDIRECT_URL}' -F 'client_id={YOUR_CLIENT_ID}' -F\
'client_secret={YOUR_CLIENT_SECRET}' https://api.shapeways.com/oauth2/token
// Example API response
{"access_token":"ACCESS_TOKEN","token_type":"bearer","expires_in":3600}
// Add your REDIRECT_URL, Authorization Code, Client ID & Client Secret to the following code examples:
import requests
url = 'https://api.shapeways.com/oauth2/token'
client_id = 'YOUR_CLIENT_ID'
client_secret = 'YOUR_CLIENT_SECRET'
authorization_code = 'AUTHORIZATION_CODE'
redirect_url = 'REDIRECT_URL'
post_data = {
'grant_type': 'authorization_code',
'code' : authorization_code,
'client_id' : client_id,
'client_secret' : client_secret,
'redirect_uri' : redirect_url
}
response = requests.post(url=url, data=post_data)
access_token = response.json()['access_token']
print("Access token: " + access_token)
// Example API response
{
"access_token": "ACCESS_TOKEN",
"token_type": "bearer",
"expires_in": 3600,
"refresh_token": "REFRESH_TOKEN"
}
Make an API test request
Let’s see if you can make a successful request from the API using our Materials endpoint.
// Add your access token to the code example
$accessToken = 'YOUR_ACCESS_TOKEN';
$url = 'https://api.shapeways.com/materials/v1';
try {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER,
['Authorization: Bearer ' . $accessToken,
'Content-type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
// printing API response on screen
print_r($response);
} catch (\Exception $e) {
// printing error on screen
echo 'Exception: ' . $e->getMessage();
}
// Example API response
{
"result":"success",
"Materials":{
"6":{
"materialId":"6",
"title":"White Natural Versatile Plastic",
"supportsColorFiles":"0",
"printerId":"5",
"swatch":"https:\/\/www.shapeways.com\/rrstatic\/img\/materials\/plastic_wsf_white.jpg",
"Restrictions":null
},
...
},
"nextActionSuggestions":[]
}
// Add your access token to the following code examples:
curl -X GET -H "Authorization: Bearer {YOUR_ACCESS_TOEKN}" -H "Content-Type: application/json" https://api.shapeways.com/materials/v1
// Example API response
{
"result":"success",
"Materials":{
"6":{
"materialId":"6",
"title":"White Natural Versatile Plastic",
"supportsColorFiles":"0",
"printerId":"5",
"swatch":"https:\/\/www.shapeways.com\/rrstatic\/img\/materials\/plastic_wsf_white.jpg",
"Restrictions":null
},
...
},
"nextActionSuggestions":[]
}
// Add your access token to the following code examples:
import requests
access_token = '{YOUR ACCESS TOKEN}'
headers = {
'Authorization': 'Bearer ' + access_token
}
api_url = 'https://api.shapeways.com/materials/v1'
response = requests.get(url=api_url +'?', headers=headers)
print(response.json())
// Example API response
{
"result":"success",
"Materials":{
"6":{
"materialId":"6",
"title":"White Natural Versatile Plastic",
"supportsColorFiles":"0",
"printerId":"5",
"swatch":"https:\/\/www.shapeways.com\/rrstatic\/img\/materials\/plastic_wsf_white.jpg",
"Restrictions":null
},
...
},
"nextActionSuggestions":[]
}
Congratulations! Your ready to start integrating with the Shapeways API endpoints.
About refresh tokens
After an access token expires, using it to make a request from the API will result in an "Invalid Token Error". Your refresh token can be used to request a fresh access token from the authorization server.
// Add your Refresh token, Client id, & Client Secret to the following code examples:
$clientId = 'YOUR_CLIENT_ID';
$clientSecret = 'YOUR_CLIENT_SECRET';
$refreshToken = 'YOUR_REFRESH_TOKEN';
$url = 'https://api.shapeways.com/oauth2/token';
$headers[] = 'Authorization: Basic ' . $clientSecret;
$params = array(
'grant_type' => 'refresh_token',
'refresh_token' => $refreshToken,
'client_id' => $clientId
);
try {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
$response = curl_exec($ch);
curl_close($ch);
// printing API response on screen
print_r($response);
} catch (\Exception $e) {
// printing error on screen
echo 'Exception: ' . $e->getMessage();
}
// Add your Client ID, Client Secret & Refresh Token to the following code examples:
curl --request POST \
--url https://api.shapeways.com/oauth2/token \
--header 'Authorization: Basic {YOUR_CLIENT_SECRET}' \
--header 'content-type: application/x-www-form-urlencoded' \
--data grant_type=refresh_token \
--data 'client_id={YOUR_CLIENT_ID}' \
--data 'refresh_token={YOUR_REFRESH_TOKEN}'
// Add your REDIRECT_URL, Authorization Code, Client ID & Client Secret to the following code examples:
import requests
url = "https://api.shapeways.com/oauth2/token"
payload = {
"grant_type": "refresh_token",
"client_id": "{YOUR_CLIENT_ID}",
"refresh_token": "{YOUR_REFRESH_TOKEN}"
}
headers = {
"content-type": "application/x-www-form-urlencoded",
"Authorization": "Basic {YOUR_CLIENT_SECRET}"
}
response = requests.post(url, data=payload, headers=headers)
print(response.json())
Model management
Easily manage your Shapeways’ models with the /models/v1 API endpoint. Quickly learn how to:
- Upload a model(s)
- Get model information (Model IDs, material printability, etc)
Upload a model
Upload 3D models to your Shapeways account to check material printability and to prepare your model for ordering.
Note: Learn more about the file types that can be uploaded to Shapeways.
// Model upload example showing the required fields only
// Add your access token to the following code examples:
// Make sure to use json encoded body and have the application/json for your header
$accessToken = 'YOUR_ACCESS_TOKEN';
$url = 'https://api.shapeways.com/models/v1';
// loading file data
$file = file_get_contents(YOUR_FILE_PATH);
// generating request data
$postFields = [
"fileName" => "cube.stl", // make sure include the correct file extension
"file" => rawurlencode(base64_encode($file)),
"uploadScale" => 0.001, // 1.0 for meters, 0.001 for mm, 0.0254 for inches
"description" => "This is a nice cube!",
"hasRightsToModel" => 1,
"acceptTermsAndConditions" => 1
];
$postData = json_encode($postFields);
try {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER,
['Authorization: Bearer ' . $accessToken, 'Content-type: application/json']);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
// printing API response on screen
print_r($response);
} catch (\Exception $e) {
// printing error on screen
echo $e->getMessage();
}
// Example API response
{
"result":"success",
"modelId":123456,
"modelVersion":0,
"title":"cube",
"fileName":"cube.stl",
"contentLength":684,
"fileMd5Checksum":"a6d5646bcb5a1437cb38ad07c45adf7",
"description":"This is a nice cube!",
"isPublic":0,
"isClaimable":0,
"isForSale":false,
"isDownloadable":0,
"materials":{
"6":{
"materialId":6,
"markup":0,
"isActive":1,
"price":4
},
...
"addModelPhoto":{
"method":"POST",
"restUrl":"https:\/\/api.shapeways.com\/models\/v1",
"link":"\/models\/v1"
}
}
}
// Add your Client ID & AUTHORIZATION_CODE to the following code examples:
curl --request POST \
--url https://api.matthew.dev-cluster.ehv.shapeways.net/models/v1 \
--header 'Authorization: Bearer {YOUR_ACCESS_TOKEN}' \
--header 'Content-type: application/json' \
--data '{\
"fileName": "cube.stl",\
"file": "{BASE64_ENCODED_FILE_DATA}",\
"uploadScale": 1,\
"description": "This is a nice cube!",\
"hasRightsToModel": 1,\
"acceptTermsAndConditions": 1 \
}'
// Example API response
{
"result":"success",
"modelId":123456,
"modelVersion":0,
"title":"cube",
"fileName":"cube.stl",
"contentLength":684,
"fileMd5Checksum":"a6d5646bcb5a1437cb38ad07c45adf7",
"description":"This is a nice cube!",
"isPublic":0,
"isClaimable":0,
"isForSale":false,
"isDownloadable":0,
"materials":{
"6":{
"materialId":6,
"markup":0,
"isActive":1,
"price":4
},
...
"addModelPhoto":{
"method":"POST",
"restUrl":"https:\/\/api.shapeways.com\/models\/v1",
"link":"\/models\/v1"
}
}
}
// Model upload example showing the required fields only // Add your access token to the following code examples: // Make sure to use json encoded body and have the application/json for your header import requests access_token =headers = { 'Authorization': 'Bearer ' + access_token } with open('cube.stl', 'rb') as model_file: model_file_data = model_file.read() model_upload_post_data = { 'fileName': 'cube.stl', // make sure include the correct file extension 'file': base64.b64encode(model_file_data).decode('utf-8'), 'description': 'Someone call a doctor, because this cube is SIIIICK.', 'uploadScale': 1.0, 'hasRightsToModel': 1, 'acceptTermsAndConditions': 1 } response = requests.post(url='https://api.shapeways.com/models/v1', headers=headers, data=json.dumps(model_upload_post_data)) print(json.dumps(response.json(), indent=4, sort_keys=True))
// Example API response
{
"result":"success",
"modelId":123456,
"modelVersion":0,
"title":"cube",
"fileName":"cube.stl",
"contentLength":684,
"fileMd5Checksum":"a6d5646bcb5a1437cb38ad07c45adf7",
"description":"This is a nice cube!",
"isPublic":0,
"isClaimable":0,
"isForSale":false,
"isDownloadable":0,
"materials":{
"6":{
"materialId":6,
"markup":0,
"isActive":1,
"price":4
},
...
"addModelPhoto":{
"method":"POST",
"restUrl":"https:\/\/api.shapeways.com\/models\/v1",
"link":"\/models\/v1"
}
}
}
Get model information
Once you’ve uploaded a model to Shapeways, you can use GET requests to find out more about it, including:
- The Model ID
- Which materials the model is printable in
- The base price of the model
// Add your access token and a Model ID to the code example
$accessToken = 'YOUR_ACCESS_TOKEN';
$url = 'https://api.shapeways.com/models/{MODEL_ID}/v1';
try {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER,
['Authorization: Bearer ' . $accessToken, 'Content-type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
// printing API response on screen
print_r($response);
} catch (\Exception $e) {
// printing error on screen
echo 'Exception: ' . $e->getMessage();
}
// Example API response
{
"result":"success",
"modelId":123456,
"modelVersion":0,
"title":"cube",
"fileName":"cube.stl",
"contentLength":684,
"fileMd5Checksum":"a6d5646bcb5a1437cb38ad07c45adf7",
"description":"This is a nice cube!",
"isPublic":0,
"isClaimable":0,
"isForSale":false,
"isDownloadable":0,
"materials":{
"6":{
"materialId":6,
"markup":0,
"isActive":1,
"price":4
},
...
"addModelPhoto":{
"method":"POST",
"restUrl":"https:\/\/api.shapeways.com\/models\/v1",
"link":"\/models\/v1"
}
}
}
// Add your access token & model id to the following code examples:
curl -X GET -H "Authorization: Bearer {YOUR_ACCESS_TOKEN}"\
-H "Content-Type: application/json" https://api.shapeways.com\
/models/{MODEL ID}/v1
// Example API response
{
"result":"success",
"modelId":123456,
"modelVersion":0,
"title":"cube",
"fileName":"cube.stl",
"contentLength":684,
"fileMd5Checksum":"a6d5646bcb5a1437cb38ad07c45adf7",
"description":"This is a nice cube!",
"isPublic":0,
"isClaimable":0,
"isForSale":false,
"isDownloadable":0,
"materials":{
"6":{
"materialId":6,
"markup":0,
"isActive":1,
"price":4
},
...
"addModelPhoto":{
"method":"POST",
"restUrl":"https:\/\/api.shapeways.com\/models\/v1",
"link":"\/models\/v1"
}
}
}
// Add your access token, model id to the following code examples:
import requests
access_token = '{YOUR ACCESS TOKEN}'
model_id = '{MODEL ID}'
headers = {
'Authorization': 'Bearer ' + access_token
}
api_url = 'https://api.shapeways.com/models/' + model_id + '/v1'
response = requests.get(url=api_url +'?', headers=headers)
print(response.json()['models'])
// Example API response
{
"result":"success",
"modelId":123456,
"modelVersion":0,
"title":"cube",
"fileName":"cube.stl",
"contentLength":684,
"fileMd5Checksum":"a6d5646bcb5a1437cb38ad07c45adf7",
"description":"This is a nice cube!",
"isPublic":0,
"isClaimable":0,
"isForSale":false,
"isDownloadable":0,
"materials":{
"6":{
"materialId":6,
"markup":0,
"isActive":1,
"price":4
},
...
"addModelPhoto":{
"method":"POST",
"restUrl":"https:\/\/api.shapeways.com\/models\/v1",
"link":"\/models\/v1"
}
}
}
Up next, Place an Order or learn what else you can do with /models/v1.
Get material information
The /materials/v1 API endpoint gives you access to up-to-date information about Shapeways’ materials. Similar information can be found https://www.shapeways.com/materials
// Add your access token to the code example
$accessToken = 'YOUR_ACCESS_TOKEN';
$url = 'https://api.shapeways.com/materials/v1';
try {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER,
['Authorization: Bearer ' . $accessToken, 'Content-type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
// printing API response on screen
print_r($response);
} catch (\Exception $e) {
// printing error on screen
echo 'Exception: ' . $e->getMessage();
}
// Example API response
{
"result":"success",
"Materials":{
"6":{
"materialId":"6",
"title":"White Natural Versatile Plastic",
"supportsColorFiles":"0",
"printerId":"5",
"swatch":"https:\/\/www.shapeways.com\/rrstatic\/img\/materials\/plastic
_wsf_white.jpg",
"Restrictions":null
},
...
},
"nextActionSuggestions":[]
}
// Add your access token to the following code examples:
curl -X GET -H "Authorization: Bearer {YOUR_ACCESS_TOEKN}" -H "Content-Type: application/json" https://api.shapeways.net/materials/v1
// Example API response
{
"result":"success",
"Materials":{
"6":{
"materialId":"6",
"title":"White Natural Versatile Plastic",
"supportsColorFiles":"0",
"printerId":"5",
"swatch":"https:\/\/www.shapeways.com\/rrstatic\/img\/materials\/plastic_wsf_white.jpg",
"Restrictions":null
},
...
},
"nextActionSuggestions":[]
}
// Add your access token to the following code examples:
import requests
access_token = '{YOUR ACCESS TOKEN}'
headers = {
'Authorization': 'Bearer ' + access_token
}
api_url = 'https://api.shapeways.com/materials/v1'
response = requests.get(url=api_url +'?', headers=headers)
print(response.json())
// Example API response
{
"result":"success",
"Materials":{
"6":{
"materialId":"6",
"title":"White Natural Versatile Plastic",
"supportsColorFiles":"0",
"printerId":"5",
"swatch":"https:\/\/www.shapeways.com\/rrstatic\/img\/materials\/plastic_wsf_white.jpg",
"Restrictions":null
},
...
},
"nextActionSuggestions":[]
}
See what types of information are returned by /materials/v1.
Placing orders
Use the /orders/v1 API endpoint to integrate with Shapeways fulfillment services to seamlessly place and manage orders. Quickly learn how to:
- Place orders
- Check order statuses
Placing your first order
1. Setting up a payment method
In Settings add and save a credit card. Placed orders will be charged to the credit card on file for this Shapeways account.
2. Get the Model ID and Material ID
To place an order, the API needs to know both 1) the model you want to order and 2) which material you want to print it in. Below are two different ways you can locate the Model ID and Material ID.
Example 1: Upload a new model
- Upload a model using POST /models/v1
- Locate the modelId and materialId in the API response
Example 2: Locate with an existing model
- If you have a model, use GET /models/v1 to get a list of all your models
- Choose a model from the list and use GET /models/{modelId}/v1 to return a list of materials the model can be printed in.
3. Place the Order
Use the modelID, materialID, and required fields for the shipping address to create the order.
// Place an order example showing the required shipping address fields only
$accessToken = 'YOUR_ACCESS_TOKEN'; // replace this
$url = 'https://api.shapeways.com/orders/v1';
// initialize items list
$items = [];
// adding a item to items list
$items[] = [
'materialId' => MATERIAL_ID, // replace this
'modelId' => MODEL_ID, // replace this
'quantity' => 1
];
// generating request data
$postFields = [
'items' => $items,
'firstName' => 'John',
'lastName' => 'Doe',
'country' => 'US',
'state' => 'NY',
'city' => 'New York',
'address1' => '419 Park Ave S',
'address2' => 'Suite 900',
'zipCode' => '10016',
'phoneNumber' => '1234567890',
'paymentMethod' => 'credit_card',
'shippingOption' => 'Cheapest'
];
$postData = json_encode($postFields);
try {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER,
['Authorization: Bearer ' . $accessToken, 'Content-type: application/json']);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
// printing API response on screen
print_r($response);
} catch (\Exception $e) {
// printing error on screen
echo $e->getMessage();
}
// Example API response
{
"result":"success",
"orderId":123,
"productionOrderIds":[
"1234"
],
"nextActionSuggestions":{
"checkOrderStatus":"\/checkout\/receipt?orderId=123"
}
}
// Add your Client ID & AUTHORIZATION_CODE to the following code examples:
curl --request POST \
--url https://api.matthew.dev-cluster.ehv.shapeways.net/orders/v1 \
--header 'content-type: application/json' \
--data '{\
"items":[{ \
"modelId":"uuid", \
"materialId":6, \
"quantity":1 \
}], \
"firstName":"Philomena", \
"lastName":"Cunk", \
"country":"NL", \
"state":"Flevoland", \
"city":"Almere", \
"address1":"Stadhuisplein 1", \
"address2":"", \
"zipCode":"1315 HR", \
"phoneNumber":"+31612345678", \
"paymentMethod":"credit_card", \
"shippingOption":"Cheapest" \
}'
// Example API response
{
"result": "success",
"orderId": orderNum,
"productionOrderIds": [
"poId"
],
"nextActionSuggestions": {
"checkOrderStatus": "\/checkout\/receipt?orderId=orderNum"
}
}
// Add your REDIRECT_URL, Authorization Code, Client ID & Client Secret to the following code examples:
access_token = 'YOUR_ACCESS_TOKEN'; // replace this
payment_verification_id = 'YOUR_PAYMENT_VERIFICATION_ID'; // replace this
api_url = 'https://api.shapeways.com/orders/v1';
items = [{
'materialId': material_id, // replace this
'modelId': model_id, // replace this
'quantity': 1
}]
order_data = {
'items': items,
'firstName' : 'John',
'lastName' : 'Dude',
'country' : 'US',
'state' : 'NY',
'city' : 'New York',
'address1' : '419 Park Ave S',
'address2' => 'Suite 900',
'zipCode' : '10016',
'phoneNumber' => '0000000000',
'paymentVerificationId': payment_verification_id,
'paymentMethod': 'credit_card',
'shippingOption': 'Cheapest'
}
headers = {
'Authorization': 'Bearer ' + access_token
}
response = requests.post(url=api_url, headers=headers, data=json.dumps(order_data))
print(response.json())
// Example API response
{
"result":"success",
"orderId":123,
"productionOrderIds":[
"1234"
],
"nextActionSuggestions":{
"checkOrderStatus":"\/checkout\/receipt?orderId=123"
}
}
Check the status of an order
Once an order has been placed, you can use GET /orders/{orderId}/v1 to find out about its current status.
// Add your access token and an Order ID to the code example
$accessToken = 'YOUR_ACCESS_TOKEN';
$url = 'https://api.shapeways.com/orders/{ORDER_ID}/v1';
try {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER,
['Authorization: Bearer ' . $accessToken, 'Content-type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
// printing API response on screen
print_r($response);
} catch (\Exception $e) {
// printing error on screen
echo 'Exception: ' . $e->getMessage();
}
// Example API response
{
"result": "success",
"ordersCount": {
"total": 1,
"placed": 0,
"in_production": 1,
"cancelled": 0,
"unknown": 0,
"shipped": 0
},
"ordersStatus": {
"123": {
"status": "in_production",
"items": {
"789": {
"title": "cube",
"quantity": 1,
"status": {
"processing": 1,
"in_production": 0,
"complete": 0,
"cancelled": 0
}
}
}
}
},
"ordersInfo": [
{
"orderId": 123,
"refNumber": null,
"targetDeliveryDate": "2023-10-31 00:00:00",
"targetShipDate": "2023-11-02 00:00:00",
"shipments": null,
"orderProducts": [
{
"orderProductId": "789",
"spin": "LV9DZGVW7",
"productTitle": "cube",
"optionId": "987",
"optionDescription": "White Natural Versatile Plastic",
"quantity": "1",
"models": [
{
"modelId": "MODEL_ID",
"materialId": "MATERIAL_ID",
"title": "cube",
"rejection": {
"rejectionReasons": [],
"affectedMaterials": []
}
}
]
}
]
}
],
"nextActionSuggestions": {
"url": null
}
}
// Add your Client ID & AUTHORIZATION_CODE to the following code examples:
curl --request GET \
--url https://api.matthew.dev-cluster.ehv.shapeways.net/orders/{orderId}/v1 \
--header 'Authorization: Bearer {YOUR_ACCESS_TOKEN}' \
--header 'Accept: application/json'
// Example API response
{
"result": "success",
"ordersCount": {
"total": 1,
"placed": 0,
"in_production": 1,
"cancelled": 0,
"unknown": 0,
"shipped": 0
},
"ordersStatus": {
"123": {
"status": "in_production",
"items": {
"789": {
"title": "cube",
"quantity": 1,
"status": {
"processing": 1,
"in_production": 0,
"complete": 0,
"cancelled": 0
}
}
...
}
}
},
"ordersInfo": [
{
"orderId": 123,
"refNumber": null,
"targetDeliveryDate": "2023-10-31 00:00:00",
"targetShipDate": "2023-11-02 00:00:00",
"shipments": null,
"orderProducts": [
{
"orderProductId": "789",
"spin": "LV9DZGVW7",
"productTitle": "cube",
"optionId": "987",
"optionDescription": "White Natural Versatile Plastic",
"quantity": "1",
"models": [
{
"modelId": "MODEL_ID",
"materialId": "MATERIAL_ID",
"title": "cube",
"rejection": {
"rejectionReasons": [],
"affectedMaterials": []
}
}
...
]
}
...
]
}
],
"nextActionSuggestions": {
"url": null
}
}
// Add your REDIRECT_URL, Authorization Code, Client ID & Client Secret to the following code examples:
import requests
access_token = 'YOUR_ACCESS_TOKEN'; // replace this
api_url = "https://api.shapeways.com/orders/{orderId}/v1"
headers = {
"Authorization": "Bearer " + access_token,
"Accept": "application/json"
}
response = requests.get(url, headers=headers)
print(response.json())
// Example API response
{
"result": "success",
"ordersCount": {
"total": 1,
"placed": 0,
"in_production": 1,
"cancelled": 0,
"unknown": 0,
"shipped": 0
},
"ordersStatus": {
"123": {
"status": "in_production",
"items": {
"789": {
"title": "cube",
"quantity": 1,
"status": {
"processing": 1,
"in_production": 0,
"complete": 0,
"cancelled": 0
}
}
}
}
},
"ordersInfo": [
{
"orderId": 123,
"refNumber": null,
"targetDeliveryDate": "2023-10-31 00:00:00",
"targetShipDate": "2023-11-02 00:00:00",
"shipments": null,
"orderProducts": [
{
"orderProductId": "789",
"spin": "LV9DZGVW7",
"productTitle": "cube",
"optionId": "987",
"optionDescription": "White Natural Versatile Plastic",
"quantity": "1",
"models": [
{
"modelId": "MODEL_ID",
"materialId": "MATERIAL_ID",
"title": "cube",
"rejection": {
"rejectionReasons": [],
"affectedMaterials": []
}
}
]
}
]
}
],
"nextActionSuggestions": {
"url": null
}
}
Transaction fees
Contact us if you are a growing business and want to learn about volume discounts.
Not a developer?
If setting up API access seems daunting, don’t worry, we’ve got you covered with a Shopify plug-in.
Learn more