Logo ng Larawan sa URL

Dokumentasyon ng API

Kailangan ng aktibong Pro o Premium subscription ang access sa API. Mag-authenticate gamit ang API key, pagkatapos mag-upload ng larawan sa parehong library na nakikita sa Dashboard. Pareho ang quota sa bayad na plan sa website.

Mga larawan ng produkto

Authentication

Ipadala ang key sa Authorization header. Gumawa ng key sa Mga Setting → Mga API key. Isang beses lang ipinapakita ang buong key.

Authorization: Bearer ptu_live_xxxxxxxx

Mag-upload ng larawan

POST multipart form field file sa /api/v1/images.

curl -X POST https://www.phototourl.com/api/v1/images \
  -H "Authorization: Bearer ptu_live_YOUR_KEY" \
  -F "file=@./product.jpg"

Mga field ng sagot

id
Resource id sa library mo.
url
CDN URL na magagamit sa pahina ng produkto.
storage
Identifier ng storage backend (kasalukuyang r2).
plan
Plan ng account na ginamit sa upload na ito (paid).
createdAt
Oras ng upload sa UTC, format na YYYY-MM-DD HH:mm:ss.
{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "url": "https://cdn.phototourl.com/pro/2026-11-05-a1b2c3d4-e5f6-7890-abcd-ef1234567890.jpg",
  "storage": "r2",
  "plan": "paid",
  "createdAt": "2026-11-05 10:20:30"
}

Ilista ang mga larawan

GET /api/v1/images na may opsyonal na page at pageSize (max 100).

curl "https://www.phototourl.com/api/v1/images?page=1&pageSize=20" \
  -H "Authorization: Bearer ptu_live_YOUR_KEY"

Mga field ng sagot

resources
Array ng mga larawan: id, filename, url, fileSize, mimeType, createdAt.
page
Numero ng kasalukuyang page.
pageSize
Item bawat page.
total
Kabuuang larawan sa library.
{
  "resources": [
    {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "filename": "product.jpg",
      "url": "https://cdn.phototourl.com/pro/2026-11-05-a1b2c3d4-e5f6-7890-abcd-ef1234567890.jpg",
      "fileSize": 128472,
      "mimeType": "image/jpeg",
      "createdAt": "2026-11-05 10:20:30"
    }
  ],
  "page": 1,
  "pageSize": 20,
  "total": 1
}

Tanggalin ang larawan

DELETE /api/v1/images/:id. Tinatanggal ang file sa storage at sa library mo.

curl -X DELETE https://www.phototourl.com/api/v1/images/RESOURCE_ID \
  -H "Authorization: Bearer ptu_live_YOUR_KEY"

Mga field ng sagot

success
true kapag natanggal ang larawan.
{ "success": true }

Mga limit

Hindi available ang API sa Free. Ginagamit ng Pro at Premium ang limit sa upload, storage, at laki ng file ng plan mo. Kapag lumampas sa limit, nagbabalik ang API ng error na may upgradeUrl.

Mga error

Ang nabigong request ay nagbabalik ng error code. Puwedeng may upgradeUrl ang mga error sa quota.

  • dailyLimitReached— Naabot na ang arawang limit sa upload (HTTP 429).
  • storageLimitReached— Lumampas sa storage quota (HTTP 413).
  • fileTooLarge— Mas malaki ang file kaysa pinapayagan ng plan (HTTP 400).
  • 401— Nawawala, invalid, o binawi ang API key.
{
  "error": "dailyLimitReached",
  "errorParams": { "limit": 1000 },
  "plan": "paid",
  "limit": 1000,
  "upgradeUrl": "https://www.phototourl.com/pricing"
}