Upload Design
curl --request POST \
--url https://api.example.com/api/v1/uploadimport requests
url = "https://api.example.com/api/v1/upload"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/api/v1/upload', 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/upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/upload"
req, _ := http.NewRequest("POST", url, nil)
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/upload")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"id": "<string>",
"url": "<string>",
"thumbnailUrl": "<string>",
"dimensions": {
"width": 123,
"height": 123
},
"fileSize": 123,
"mimeType": "<string>"
}Endpoints
Upload Design
Upload design images for use with generation
POST
/
api
/
v1
/
upload
Upload Design
curl --request POST \
--url https://api.example.com/api/v1/uploadimport requests
url = "https://api.example.com/api/v1/upload"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/api/v1/upload', 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/upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/upload"
req, _ := http.NewRequest("POST", url, nil)
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/upload")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"id": "<string>",
"url": "<string>",
"thumbnailUrl": "<string>",
"dimensions": {
"width": 123,
"height": 123
},
"fileSize": 123,
"mimeType": "<string>"
}Upload Design
Upload a design image and receive a URL for use with the/generate endpoint.
This endpoint is free — no tokens required.
Endpoint
POST https://garmint.app/api/v1/upload
Request Formats
Multipart Form Upload
Send the image asmultipart/form-data:
curl -X POST https://garmint.app/api/v1/upload \
-H "Authorization: Bearer gm_live_xxx" \
-F "file=@my-design.png"
Base64 JSON Upload
Send base64-encoded image data:curl -X POST https://garmint.app/api/v1/upload \
-H "Authorization: Bearer gm_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"imageData": "data:image/png;base64,iVBORw0KGgo..."
}'
Constraints
| Constraint | Value |
|---|---|
| Max file size | 10 MB |
| Allowed formats | PNG, JPEG, WebP, GIF |
| Recommended resolution | 2400x3000px or higher |
Response
string
Unique upload identifier.
string
Public URL of the uploaded image. Use this with
/generate.string
Smaller thumbnail version.
number
File size in bytes.
string
Detected MIME type.
Example
curl -X POST https://garmint.app/api/v1/upload \
-H "Authorization: Bearer gm_live_xxx" \
-F "file=@my-design.png"
// Using FormData (browser or Node 18+)
const formData = new FormData();
formData.append('file', fileBlob, 'design.png');
const response = await fetch('https://garmint.app/api/v1/upload', {
method: 'POST',
headers: {
'Authorization': `Bearer ${GARMINT_API_KEY}`,
},
body: formData,
});
const upload = await response.json();
console.log(upload.url); // Use this with /generate
// From base64 data URL
const response = await fetch('https://garmint.app/api/v1/upload', {
method: 'POST',
headers: {
'Authorization': `Bearer ${GARMINT_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
imageData: 'data:image/png;base64,iVBORw0KGgo...',
}),
});
const upload = await response.json();
import requests
# Form upload
with open('my-design.png', 'rb') as f:
response = requests.post(
'https://garmint.app/api/v1/upload',
headers={'Authorization': f'Bearer {GARMINT_API_KEY}'},
files={'file': f}
)
upload = response.json()
print(upload['url'])
Response Example
{
"id": "upl_1703001234_xyz789",
"url": "https://res.cloudinary.com/garmint/image/upload/v123/api-uploads/xyz789.png",
"thumbnailUrl": "https://res.cloudinary.com/garmint/image/upload/v123/api-uploads/xyz789.png",
"dimensions": {
"width": 2400,
"height": 3000
},
"fileSize": 1548276,
"mimeType": "image/png"
}
Full Workflow
Upload → Analyze → Generate:async function createMockup(file: File, garmentId: string) {
// 1. Upload the design
const formData = new FormData();
formData.append('file', file);
const uploadRes = await fetch('https://garmint.app/api/v1/upload', {
method: 'POST',
headers: { 'Authorization': `Bearer ${API_KEY}` },
body: formData,
});
const upload = await uploadRes.json();
// 2. Analyze (optional but recommended)
const analyzeRes = await fetch('https://garmint.app/api/v1/analyze', {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ imageUrl: upload.url }),
});
const analysis = await analyzeRes.json();
if (analysis.warnings.length > 0) {
console.warn('Design warnings:', analysis.warnings);
}
// 3. Generate mockup
const generateRes = await fetch('https://garmint.app/api/v1/generate', {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
designUrl: upload.url,
garmentId,
garmentImageUrl: '...', // Get from /garments
placement: { x: 50, y: 35, scale: 0.8 },
}),
});
return generateRes.json();
}
Image Preparation Tips
Use PNG for designs with transparency
Use PNG for designs with transparency
PNG preserves alpha channels for transparent backgrounds, essential for printing on colored garments.
High resolution = better prints
High resolution = better prints
Upload at 300 DPI or higher. For a 12” wide print, that’s at least 3600px wide.
sRGB color space
sRGB color space
Ensure images are in sRGB color space for consistent color representation.
Remove excess transparency
Remove excess transparency
Trim transparent borders to get accurate placement calculations.
Errors
| Code | Status | Description |
|---|---|---|
invalid_request | 400 | No file provided or invalid format |
invalid_request | 400 | File too large (max 10MB) |
invalid_request | 400 | Could not read image |