API QUICKSTARTMake your first
Make your first
API request.
Use the HTTP client you already know. Send a file and your processing options, then use the URL in the response.
Explore the API reference- Get API access
Request access, or sign in if you already have an account.
- Create an API key
Open API keys in the dashboard. Copy the key and keep it on your server.
- Set your environment variable
export LATTICE_API_KEY='your_api_key' - Send a file and use the result
Save an image as
photo.jpg, run an example, and use the returnedurl. Download links expire after one hour.
# One image. Ready for the web.
curl https://api.latticemedia.xyz/v1/process/image \
-H "X-API-Key: $LATTICE_API_KEY" \
-F 'file=@photo.jpg' \
-F 'options={"format":"webp","quality":80}'// Node.js 22+ · native fetch
import { openAsBlob } from 'node:fs';
const form = new FormData();
form.append('file', await openAsBlob('photo.jpg'),
'photo.jpg');
form.append('options', JSON.stringify({
format: 'webp', quality: 80
}));
const response = await fetch(
'https://api.latticemedia.xyz/v1/process/image',
{ method: 'POST', body: form,
headers: { 'X-API-Key': process.env.LATTICE_API_KEY }
}
);
if (!response.ok) throw new Error(await response.text());
const result = await response.json();
console.log(result.url);# pip install requests
import json
import os
import requests
with open('photo.jpg', 'rb') as image:
response = requests.post(
'https://api.latticemedia.xyz/v1/process/image',
headers={'X-API-Key': os.environ['LATTICE_API_KEY']},
files={'file': image},
data={'options': json.dumps({
'format': 'webp', 'quality': 80
})},
timeout=60,
)
response.raise_for_status()
result = response.json()
print(result['url'])Example response · 200 OK
{
"id": "example-file-id",
"url": "https://your-storage.example/file.webp?…",
"key": "example-file.webp"
}The examples run on your server. This page does not send a request.