API Documentation
Everything you need to integrate PixelForge AI into your application.
Authentication
All API requests require a Bearer token. Create an API key from your Dashboard. API keys start with pfk_ and must be sent in the Authorization header.
curl -H "Authorization: Bearer pfk_your_api_key" \
https://pixelforge.vip/api/v1/jobsEndpoints
/v1/upscale1–2 creditsUpscale an image 2x or 4x using AI super-resolution. Returns job_id for async polling.
| Param | Type | Default |
|---|---|---|
image | File | required |
scale | int | 2 |
/v1/remove-background1 creditRemove the background from an image. Returns transparent PNG.
| Param | Type | Default |
|---|---|---|
image | File | required |
format | string | png |
/v1/restore-face1 creditRestore and enhance faces in old or damaged photos.
| Param | Type | Default |
|---|---|---|
image | File | required |
fidelity | float | 0.7 |
/v1/enhance1 creditImprove color, exposure, contrast, and overall image quality.
| Param | Type | Default |
|---|---|---|
image | File | required |
/v1/erase-object1 creditErase objects from an image using a mask. Requires a binary mask (white = erase).
| Param | Type | Default |
|---|---|---|
image | File | required |
mask | File | required |
/v1/inpaint2 creditsReplace masked area with AI-generated content guided by a text prompt.
| Param | Type | Default |
|---|---|---|
image | File | required |
mask | File | required |
prompt | string | "high quality photo" |
steps | int | 30 |
cfg_scale | float | 7.0 |
strength | float | 0.85 |
/v1/jobs/{job_id}Check the status of a submitted job. Returns status, result_url (when done), and error (when failed).
/v1/jobs/{job_id}/downloadDownload the processed image. Add ?download=true for attachment header.
Rate Limits
| Plan | Requests/min | API Access |
|---|---|---|
| Free | 5 | No |
| Starter | 20 | No |
| Pro | 60 | Yes |
| API | 120 | Yes |
Error Codes
| Code | Meaning |
|---|---|
| 401 | Authentication required or invalid API key |
| 402 | Insufficient credits |
| 404 | Job not found |
| 422 | Validation error (bad input, unsupported format) |
| 429 | Rate limit exceeded |
| 502 | Inference or storage error (retry later) |
Code Examples
Python
import requests
API_KEY = "pfk_your_api_key"
BASE = "https://pixelforge.vip/api/v1"
headers = {"Authorization": f"Bearer {API_KEY}"}
# Submit job
with open("photo.jpg", "rb") as f:
resp = requests.post(
f"{BASE}/remove-background",
headers=headers,
files={"image": f},
)
job_id = resp.json()["job_id"]
# Poll until done
import time
while True:
status = requests.get(
f"{BASE}/jobs/{job_id}", headers=headers
).json()
if status["status"] == "done":
break
time.sleep(2)
# Download result
result = requests.get(
f"{BASE}/jobs/{job_id}/download", headers=headers
)
with open("result.png", "wb") as f:
f.write(result.content)JavaScript (Node.js)
const API_KEY = "pfk_your_api_key";
const BASE = "https://pixelforge.vip/api/v1";
const headers = { Authorization: `Bearer ${API_KEY}` };
// Submit job
const form = new FormData();
form.append("image", fs.createReadStream("photo.jpg"));
const { job_id } = await fetch(`${BASE}/remove-background`, {
method: "POST", headers, body: form,
}).then(r => r.json());
// Poll until done
let status;
do {
await new Promise(r => setTimeout(r, 2000));
status = await fetch(
`${BASE}/jobs/${job_id}`, { headers }
).then(r => r.json());
} while (status.status !== "done" && status.status !== "failed");
// Download result
const result = await fetch(
`${BASE}/jobs/${job_id}/download`, { headers }
);
fs.writeFileSync("result.png", Buffer.from(await result.arrayBuffer()));curl
# Submit job
curl -X POST "https://pixelforge.vip/api/v1/remove-background" \
-H "Authorization: Bearer pfk_your_api_key" \
-F "image=@photo.jpg"
# Returns: {"job_id": "abc-123", "status": "queued"}
# Check status
curl "https://pixelforge.vip/api/v1/jobs/abc-123" \
-H "Authorization: Bearer pfk_your_api_key"
# Download result
curl -o result.png "https://pixelforge.vip/api/v1/jobs/abc-123/download" \
-H "Authorization: Bearer pfk_your_api_key"