Replace the print areas of a photo mockup
Replaces a ready photo mockup’s printable areas. Each area must be a convex four-point shape within the source image. An area sent with the print_area_id of one of this mockup’s print areas keeps that id; an area without one gets a new id.
PUT
/
api
/
v1
/
photo-mockups
/
{mockup_id}
/
print-areas
const response = await fetch("https://api.sudomock.com/api/v1/photo-mockups/3fa85f64-5717-4562-b3fc-2c963f66afa6/print-areas", {
method: "PUT",
headers: {
"x-api-key": "sm_your_api_key",
"Content-Type": "application/json",
},
body: JSON.stringify({
"print_areas": [
{
"points": [
[
200,
150
],
[
600,
150
],
[
620,
550
],
[
180,
550
]
]
}
]
}),
});
const data = await response.json();
console.log(data);
<?php
$payload = <<<'JSON'
{
"print_areas": [
{
"points": [
[
200,
150
],
[
600,
150
],
[
620,
550
],
[
180,
550
]
]
}
]
}
JSON;
$ch = curl_init("https://api.sudomock.com/api/v1/photo-mockups/3fa85f64-5717-4562-b3fc-2c963f66afa6/print-areas");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"x-api-key: sm_your_api_key",
"Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import requests
payload = {'print_areas': [{'points': [[200, 150],
[600, 150],
[620, 550],
[180, 550]]}]}
response = requests.put(
"https://api.sudomock.com/api/v1/photo-mockups/3fa85f64-5717-4562-b3fc-2c963f66afa6/print-areas",
headers={"x-api-key": "sm_your_api_key"},
json=payload,
)
response.raise_for_status()
print(response.json())
require "net/http"
require "uri"
uri = URI("https://api.sudomock.com/api/v1/photo-mockups/3fa85f64-5717-4562-b3fc-2c963f66afa6/print-areas")
request = Net::HTTP::Put.new(uri)
request["x-api-key"] = "sm_your_api_key"
request["Content-Type"] = "application/json"
request.body = <<~JSON
{
"print_areas": [
{
"points": [
[
200,
150
],
[
600,
150
],
[
620,
550
],
[
180,
550
]
]
}
]
}
JSON
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
http.request(request)
end
puts response.body
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{
"print_areas": [
{
"points": [
[
200,
150
],
[
600,
150
],
[
620,
550
],
[
180,
550
]
]
}
]
}`)
req, err := http.NewRequest("PUT", "https://api.sudomock.com/api/v1/photo-mockups/3fa85f64-5717-4562-b3fc-2c963f66afa6/print-areas", bytes.NewBuffer(payload))
if err != nil {
panic(err)
}
req.Header.Set("x-api-key", "sm_your_api_key")
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
String payload = """
{
"print_areas": [
{
"points": [
[
200,
150
],
[
600,
150
],
[
620,
550
],
[
180,
550
]
]
}
]
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.sudomock.com/api/v1/photo-mockups/3fa85f64-5717-4562-b3fc-2c963f66afa6/print-areas"))
.header("x-api-key", "sm_your_api_key")
.header("Content-Type", "application/json")
.PUT(HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
using System.Net.Http;
using System.Text;
var payload = """
{
"print_areas": [
{
"points": [
[
200,
150
],
[
600,
150
],
[
620,
550
],
[
180,
550
]
]
}
]
}
""";
var request = new HttpRequestMessage(HttpMethod.Put, "https://api.sudomock.com/api/v1/photo-mockups/3fa85f64-5717-4562-b3fc-2c963f66afa6/print-areas");
request.Headers.Add("x-api-key", "sm_your_api_key");
request.Content = new StringContent(payload, Encoding.UTF8, "application/json");
var client = new HttpClient();
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
curl -X PUT "https://api.sudomock.com/api/v1/photo-mockups/3fa85f64-5717-4562-b3fc-2c963f66afa6/print-areas" \
-H "x-api-key: sm_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"print_areas": [
{
"points": [
[
200,
150
],
[
600,
150
],
[
620,
550
],
[
180,
550
]
]
}
]
}'
{
"data": {
"mockup_id": "893ea326-278b-480b-b130-87dd6aee06dc",
"print_areas": [
{
"name": "Front",
"points": [
[
518.0,
646.0
],
[
1534.0,
638.0
],
[
1541.0,
1662.0
],
[
511.0,
1670.0
]
],
"print_area_id": "19be48d4-c810-4420-86e3-7ec2a4d85571",
"sort_order": 0
},
{
"points": [
[
742.0,
1742.0
],
[
1312.0,
1735.0
],
[
1318.0,
2010.0
],
[
736.0,
2017.0
]
],
"print_area_id": "a0c7d215-93f8-4f0b-9a64-58b1e2c7d430",
"sort_order": 1,
"name": null
}
]
},
"success": true
}
const response = await fetch("https://api.sudomock.com/api/v1/photo-mockups/3fa85f64-5717-4562-b3fc-2c963f66afa6/print-areas", {
method: "PUT",
headers: {
"x-api-key": "sm_your_api_key",
"Content-Type": "application/json",
},
body: JSON.stringify({
"print_areas": [
{
"points": [
[
200,
150
],
[
600,
150
],
[
620,
550
],
[
180,
550
]
]
}
]
}),
});
const data = await response.json();
console.log(data);
<?php
$payload = <<<'JSON'
{
"print_areas": [
{
"points": [
[
200,
150
],
[
600,
150
],
[
620,
550
],
[
180,
550
]
]
}
]
}
JSON;
$ch = curl_init("https://api.sudomock.com/api/v1/photo-mockups/3fa85f64-5717-4562-b3fc-2c963f66afa6/print-areas");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"x-api-key: sm_your_api_key",
"Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import requests
payload = {'print_areas': [{'points': [[200, 150],
[600, 150],
[620, 550],
[180, 550]]}]}
response = requests.put(
"https://api.sudomock.com/api/v1/photo-mockups/3fa85f64-5717-4562-b3fc-2c963f66afa6/print-areas",
headers={"x-api-key": "sm_your_api_key"},
json=payload,
)
response.raise_for_status()
print(response.json())
require "net/http"
require "uri"
uri = URI("https://api.sudomock.com/api/v1/photo-mockups/3fa85f64-5717-4562-b3fc-2c963f66afa6/print-areas")
request = Net::HTTP::Put.new(uri)
request["x-api-key"] = "sm_your_api_key"
request["Content-Type"] = "application/json"
request.body = <<~JSON
{
"print_areas": [
{
"points": [
[
200,
150
],
[
600,
150
],
[
620,
550
],
[
180,
550
]
]
}
]
}
JSON
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
http.request(request)
end
puts response.body
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{
"print_areas": [
{
"points": [
[
200,
150
],
[
600,
150
],
[
620,
550
],
[
180,
550
]
]
}
]
}`)
req, err := http.NewRequest("PUT", "https://api.sudomock.com/api/v1/photo-mockups/3fa85f64-5717-4562-b3fc-2c963f66afa6/print-areas", bytes.NewBuffer(payload))
if err != nil {
panic(err)
}
req.Header.Set("x-api-key", "sm_your_api_key")
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
String payload = """
{
"print_areas": [
{
"points": [
[
200,
150
],
[
600,
150
],
[
620,
550
],
[
180,
550
]
]
}
]
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.sudomock.com/api/v1/photo-mockups/3fa85f64-5717-4562-b3fc-2c963f66afa6/print-areas"))
.header("x-api-key", "sm_your_api_key")
.header("Content-Type", "application/json")
.PUT(HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
using System.Net.Http;
using System.Text;
var payload = """
{
"print_areas": [
{
"points": [
[
200,
150
],
[
600,
150
],
[
620,
550
],
[
180,
550
]
]
}
]
}
""";
var request = new HttpRequestMessage(HttpMethod.Put, "https://api.sudomock.com/api/v1/photo-mockups/3fa85f64-5717-4562-b3fc-2c963f66afa6/print-areas");
request.Headers.Add("x-api-key", "sm_your_api_key");
request.Content = new StringContent(payload, Encoding.UTF8, "application/json");
var client = new HttpClient();
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
curl -X PUT "https://api.sudomock.com/api/v1/photo-mockups/3fa85f64-5717-4562-b3fc-2c963f66afa6/print-areas" \
-H "x-api-key: sm_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"print_areas": [
{
"points": [
[
200,
150
],
[
600,
150
],
[
620,
550
],
[
180,
550
]
]
}
]
}'
{
"data": {
"mockup_id": "893ea326-278b-480b-b130-87dd6aee06dc",
"print_areas": [
{
"name": "Front",
"points": [
[
518.0,
646.0
],
[
1534.0,
638.0
],
[
1541.0,
1662.0
],
[
511.0,
1670.0
]
],
"print_area_id": "19be48d4-c810-4420-86e3-7ec2a4d85571",
"sort_order": 0
},
{
"points": [
[
742.0,
1742.0
],
[
1312.0,
1735.0
],
[
1318.0,
2010.0
],
[
736.0,
2017.0
]
],
"print_area_id": "a0c7d215-93f8-4f0b-9a64-58b1e2c7d430",
"sort_order": 1,
"name": null
}
]
},
"success": true
}
Authorizations
API key with sm_ prefix. Get your key at https://sudomock.com/dashboard/api-keys
Path Parameters
Id of the photo mockup whose print areas are replaced.
Body
application/json
Replace a mockup's printable areas.
Up to eight printable areas, saved row by row from the top and left to right inside each row, whatever the array order. An empty array saves the mockup without bounded placement zones.
Maximum array length:
8Show child attributes
Show child attributes
Was this page helpful?
⌘I
const response = await fetch("https://api.sudomock.com/api/v1/photo-mockups/3fa85f64-5717-4562-b3fc-2c963f66afa6/print-areas", {
method: "PUT",
headers: {
"x-api-key": "sm_your_api_key",
"Content-Type": "application/json",
},
body: JSON.stringify({
"print_areas": [
{
"points": [
[
200,
150
],
[
600,
150
],
[
620,
550
],
[
180,
550
]
]
}
]
}),
});
const data = await response.json();
console.log(data);
<?php
$payload = <<<'JSON'
{
"print_areas": [
{
"points": [
[
200,
150
],
[
600,
150
],
[
620,
550
],
[
180,
550
]
]
}
]
}
JSON;
$ch = curl_init("https://api.sudomock.com/api/v1/photo-mockups/3fa85f64-5717-4562-b3fc-2c963f66afa6/print-areas");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"x-api-key: sm_your_api_key",
"Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import requests
payload = {'print_areas': [{'points': [[200, 150],
[600, 150],
[620, 550],
[180, 550]]}]}
response = requests.put(
"https://api.sudomock.com/api/v1/photo-mockups/3fa85f64-5717-4562-b3fc-2c963f66afa6/print-areas",
headers={"x-api-key": "sm_your_api_key"},
json=payload,
)
response.raise_for_status()
print(response.json())
require "net/http"
require "uri"
uri = URI("https://api.sudomock.com/api/v1/photo-mockups/3fa85f64-5717-4562-b3fc-2c963f66afa6/print-areas")
request = Net::HTTP::Put.new(uri)
request["x-api-key"] = "sm_your_api_key"
request["Content-Type"] = "application/json"
request.body = <<~JSON
{
"print_areas": [
{
"points": [
[
200,
150
],
[
600,
150
],
[
620,
550
],
[
180,
550
]
]
}
]
}
JSON
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
http.request(request)
end
puts response.body
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{
"print_areas": [
{
"points": [
[
200,
150
],
[
600,
150
],
[
620,
550
],
[
180,
550
]
]
}
]
}`)
req, err := http.NewRequest("PUT", "https://api.sudomock.com/api/v1/photo-mockups/3fa85f64-5717-4562-b3fc-2c963f66afa6/print-areas", bytes.NewBuffer(payload))
if err != nil {
panic(err)
}
req.Header.Set("x-api-key", "sm_your_api_key")
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
String payload = """
{
"print_areas": [
{
"points": [
[
200,
150
],
[
600,
150
],
[
620,
550
],
[
180,
550
]
]
}
]
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.sudomock.com/api/v1/photo-mockups/3fa85f64-5717-4562-b3fc-2c963f66afa6/print-areas"))
.header("x-api-key", "sm_your_api_key")
.header("Content-Type", "application/json")
.PUT(HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
using System.Net.Http;
using System.Text;
var payload = """
{
"print_areas": [
{
"points": [
[
200,
150
],
[
600,
150
],
[
620,
550
],
[
180,
550
]
]
}
]
}
""";
var request = new HttpRequestMessage(HttpMethod.Put, "https://api.sudomock.com/api/v1/photo-mockups/3fa85f64-5717-4562-b3fc-2c963f66afa6/print-areas");
request.Headers.Add("x-api-key", "sm_your_api_key");
request.Content = new StringContent(payload, Encoding.UTF8, "application/json");
var client = new HttpClient();
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
curl -X PUT "https://api.sudomock.com/api/v1/photo-mockups/3fa85f64-5717-4562-b3fc-2c963f66afa6/print-areas" \
-H "x-api-key: sm_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"print_areas": [
{
"points": [
[
200,
150
],
[
600,
150
],
[
620,
550
],
[
180,
550
]
]
}
]
}'
{
"data": {
"mockup_id": "893ea326-278b-480b-b130-87dd6aee06dc",
"print_areas": [
{
"name": "Front",
"points": [
[
518.0,
646.0
],
[
1534.0,
638.0
],
[
1541.0,
1662.0
],
[
511.0,
1670.0
]
],
"print_area_id": "19be48d4-c810-4420-86e3-7ec2a4d85571",
"sort_order": 0
},
{
"points": [
[
742.0,
1742.0
],
[
1312.0,
1735.0
],
[
1318.0,
2010.0
],
[
736.0,
2017.0
]
],
"print_area_id": "a0c7d215-93f8-4f0b-9a64-58b1e2c7d430",
"sort_order": 1,
"name": null
}
]
},
"success": true
}