Generate Mockup
curl --request POST \
--url https://api.example.com/api/v1/generate \
--header 'Content-Type: application/json' \
--data '
{
"designUrl": "<string>",
"garmentId": "<string>",
"garmentImageUrl": "<string>",
"color": "<string>",
"zone": "<string>",
"placement": {
"placement.x": 123,
"placement.y": 123,
"placement.scale": 123,
"placement.rotation": 123
},
"applyTexture": true,
"webhookUrl": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/generate"
payload = {
"designUrl": "<string>",
"garmentId": "<string>",
"garmentImageUrl": "<string>",
"color": "<string>",
"zone": "<string>",
"placement": {
"placement.x": 123,
"placement.y": 123,
"placement.scale": 123,
"placement.rotation": 123
},
"applyTexture": True,
"webhookUrl": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
designUrl: '<string>',
garmentId: '<string>',
garmentImageUrl: '<string>',
color: '<string>',
zone: '<string>',
placement: {
'placement.x': 123,
'placement.y': 123,
'placement.scale': 123,
'placement.rotation': 123
},
applyTexture: true,
webhookUrl: '<string>'
})
};
fetch('https://api.example.com/api/v1/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/generate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'designUrl' => '<string>',
'garmentId' => '<string>',
'garmentImageUrl' => '<string>',
'color' => '<string>',
'zone' => '<string>',
'placement' => [
'placement.x' => 123,
'placement.y' => 123,
'placement.scale' => 123,
'placement.rotation' => 123
],
'applyTexture' => true,
'webhookUrl' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/generate"
payload := strings.NewReader("{\n \"designUrl\": \"<string>\",\n \"garmentId\": \"<string>\",\n \"garmentImageUrl\": \"<string>\",\n \"color\": \"<string>\",\n \"zone\": \"<string>\",\n \"placement\": {\n \"placement.x\": 123,\n \"placement.y\": 123,\n \"placement.scale\": 123,\n \"placement.rotation\": 123\n },\n \"applyTexture\": true,\n \"webhookUrl\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/generate")
.header("Content-Type", "application/json")
.body("{\n \"designUrl\": \"<string>\",\n \"garmentId\": \"<string>\",\n \"garmentImageUrl\": \"<string>\",\n \"color\": \"<string>\",\n \"zone\": \"<string>\",\n \"placement\": {\n \"placement.x\": 123,\n \"placement.y\": 123,\n \"placement.scale\": 123,\n \"placement.rotation\": 123\n },\n \"applyTexture\": true,\n \"webhookUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"designUrl\": \"<string>\",\n \"garmentId\": \"<string>\",\n \"garmentImageUrl\": \"<string>\",\n \"color\": \"<string>\",\n \"zone\": \"<string>\",\n \"placement\": {\n \"placement.x\": 123,\n \"placement.y\": 123,\n \"placement.scale\": 123,\n \"placement.rotation\": 123\n },\n \"applyTexture\": true,\n \"webhookUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"status": "<string>",
"mockupUrl": "<string>",
"thumbnailUrl": "<string>",
"tokensUsed": 123,
"createdAt": "<string>",
"completedAt": "<string>",
"error": "<string>"
}Endpoints
Generate Mockup
Create apparel mockups by compositing designs onto garments
POST
/
api
/
v1
/
generate
Generate Mockup
curl --request POST \
--url https://api.example.com/api/v1/generate \
--header 'Content-Type: application/json' \
--data '
{
"designUrl": "<string>",
"garmentId": "<string>",
"garmentImageUrl": "<string>",
"color": "<string>",
"zone": "<string>",
"placement": {
"placement.x": 123,
"placement.y": 123,
"placement.scale": 123,
"placement.rotation": 123
},
"applyTexture": true,
"webhookUrl": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/generate"
payload = {
"designUrl": "<string>",
"garmentId": "<string>",
"garmentImageUrl": "<string>",
"color": "<string>",
"zone": "<string>",
"placement": {
"placement.x": 123,
"placement.y": 123,
"placement.scale": 123,
"placement.rotation": 123
},
"applyTexture": True,
"webhookUrl": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
designUrl: '<string>',
garmentId: '<string>',
garmentImageUrl: '<string>',
color: '<string>',
zone: '<string>',
placement: {
'placement.x': 123,
'placement.y': 123,
'placement.scale': 123,
'placement.rotation': 123
},
applyTexture: true,
webhookUrl: '<string>'
})
};
fetch('https://api.example.com/api/v1/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/generate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'designUrl' => '<string>',
'garmentId' => '<string>',
'garmentImageUrl' => '<string>',
'color' => '<string>',
'zone' => '<string>',
'placement' => [
'placement.x' => 123,
'placement.y' => 123,
'placement.scale' => 123,
'placement.rotation' => 123
],
'applyTexture' => true,
'webhookUrl' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/generate"
payload := strings.NewReader("{\n \"designUrl\": \"<string>\",\n \"garmentId\": \"<string>\",\n \"garmentImageUrl\": \"<string>\",\n \"color\": \"<string>\",\n \"zone\": \"<string>\",\n \"placement\": {\n \"placement.x\": 123,\n \"placement.y\": 123,\n \"placement.scale\": 123,\n \"placement.rotation\": 123\n },\n \"applyTexture\": true,\n \"webhookUrl\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/generate")
.header("Content-Type", "application/json")
.body("{\n \"designUrl\": \"<string>\",\n \"garmentId\": \"<string>\",\n \"garmentImageUrl\": \"<string>\",\n \"color\": \"<string>\",\n \"zone\": \"<string>\",\n \"placement\": {\n \"placement.x\": 123,\n \"placement.y\": 123,\n \"placement.scale\": 123,\n \"placement.rotation\": 123\n },\n \"applyTexture\": true,\n \"webhookUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"designUrl\": \"<string>\",\n \"garmentId\": \"<string>\",\n \"garmentImageUrl\": \"<string>\",\n \"color\": \"<string>\",\n \"zone\": \"<string>\",\n \"placement\": {\n \"placement.x\": 123,\n \"placement.y\": 123,\n \"placement.scale\": 123,\n \"placement.rotation\": 123\n },\n \"applyTexture\": true,\n \"webhookUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"status": "<string>",
"mockupUrl": "<string>",
"thumbnailUrl": "<string>",
"tokensUsed": 123,
"createdAt": "<string>",
"completedAt": "<string>",
"error": "<string>"
}Generate Mockup
Composite a design image onto a garment blank to create a realistic mockup.Each generation costs 1 token.
Endpoint
POST https://garmint.app/api/v1/generate
Request Body
string
required
URL of the design image to place on the garment. Must be publicly accessible.
string
required
ID of the garment from the
/garments endpoint.string
required
Direct URL to the garment blank image (specific color variant).
string
Color variant name (e.g., “Black”, “White”, “Navy”).
string
default:"front"
Print zone to use. Options:
front, back, left-chest, right-chest.object
Design placement configuration.
boolean
default:"true"
Apply subtle fabric texture effect for realism.
string
URL to receive a POST callback when generation completes.
Response
string
Unique generation ID (e.g.,
gen_1703001234_abc123).string
Generation status:
pending, processing, completed, or failed.string
URL of the generated mockup image (when completed).
string
URL of a smaller thumbnail version.
number
Number of tokens consumed (always 1).
string
ISO 8601 timestamp of when the generation started.
string
ISO 8601 timestamp of when the generation finished.
string
Error message if status is
failed.Example
curl -X POST https://garmint.app/api/v1/generate \
-H "Authorization: Bearer gm_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"designUrl": "https://example.com/my-design.png",
"garmentId": "gildan-5000",
"garmentImageUrl": "https://cdn.shopify.com/s/files/1/.../black-tee.png",
"color": "Black",
"placement": {
"x": 50,
"y": 35,
"scale": 0.8
}
}'
const response = await fetch('https://garmint.app/api/v1/generate', {
method: 'POST',
headers: {
'Authorization': `Bearer ${GARMINT_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
designUrl: 'https://example.com/my-design.png',
garmentId: 'gildan-5000',
garmentImageUrl: 'https://cdn.shopify.com/s/.../black-tee.png',
color: 'Black',
placement: { x: 50, y: 35, scale: 0.8 },
}),
});
const mockup = await response.json();
console.log(mockup.mockupUrl);
import requests
response = requests.post(
'https://garmint.app/api/v1/generate',
headers={'Authorization': f'Bearer {GARMINT_API_KEY}'},
json={
'designUrl': 'https://example.com/my-design.png',
'garmentId': 'gildan-5000',
'garmentImageUrl': 'https://cdn.shopify.com/s/.../black-tee.png',
'color': 'Black',
'placement': {'x': 50, 'y': 35, 'scale': 0.8},
}
)
mockup = response.json()
print(mockup['mockupUrl'])
Response Example
{
"id": "gen_1703001234_abc123",
"status": "completed",
"mockupUrl": "https://res.cloudinary.com/garmint/image/upload/v123/api-generations/abc123.jpg",
"thumbnailUrl": "https://res.cloudinary.com/garmint/image/upload/v123/api-generations/abc123.jpg",
"tokensUsed": 1,
"createdAt": "2024-12-19T12:00:00.000Z",
"completedAt": "2024-12-19T12:00:02.500Z"
}
Webhooks
If you provide awebhookUrl, we’ll POST the completed generation to your endpoint:
{
"event": "generation.completed",
"timestamp": "2024-12-19T12:00:02.500Z",
"data": {
"id": "gen_1703001234_abc123",
"status": "completed",
"mockupUrl": "https://...",
"tokensUsed": 1
}
}
Webhook requests have a 10-second timeout. Respond with a
200 status quickly.Errors
| Code | Status | Description |
|---|---|---|
invalid_request | 400 | Missing required fields or invalid URLs |
insufficient_tokens | 402 | Not enough tokens |
not_found | 404 | Garment ID not found |
⌘I