PixelForge
Iniciar sesionComenzar

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.

bash
curl -H "Authorization: Bearer pfk_your_api_key" \
  https://pixelforge.vip/api/v1/jobs

Endpoints

POST/v1/upscale1–2 credits

Upscale an image 2x or 4x using AI super-resolution. Returns job_id for async polling.

ParamTypeDefault
imageFilerequired
scaleint2
POST/v1/remove-background1 credit

Remove the background from an image. Returns transparent PNG.

ParamTypeDefault
imageFilerequired
formatstringpng
POST/v1/restore-face1 credit

Restore and enhance faces in old or damaged photos.

ParamTypeDefault
imageFilerequired
fidelityfloat0.7
POST/v1/enhance1 credit

Improve color, exposure, contrast, and overall image quality.

ParamTypeDefault
imageFilerequired
POST/v1/erase-object1 credit

Erase objects from an image using a mask. Requires a binary mask (white = erase).

ParamTypeDefault
imageFilerequired
maskFilerequired
POST/v1/inpaint2 credits

Replace masked area with AI-generated content guided by a text prompt.

ParamTypeDefault
imageFilerequired
maskFilerequired
promptstring"high quality photo"
stepsint30
cfg_scalefloat7.0
strengthfloat0.85
GET/v1/jobs/{job_id}

Check the status of a submitted job. Returns status, result_url (when done), and error (when failed).

GET/v1/jobs/{job_id}/download

Download the processed image. Add ?download=true for attachment header.

Rate Limits

PlanRequests/minAPI Access
Free5No
Starter20No
Pro60Yes
API120Yes

Error Codes

CodeMeaning
401Authentication required or invalid API key
402Insufficient credits
404Job not found
422Validation error (bad input, unsupported format)
429Rate limit exceeded
502Inference or storage error (retry later)

Code Examples

Python

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)

javascript
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

bash
# 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"
API Documentation — PixelForge AI