REST API · v1

Dokumentasyon ng MakeFav API

Gumawa ng kumpletong favicon package mula sa sarili mong code, build script at CI pipeline. Sa isang request, magiging favicon.ico, Apple touch icon, Android at PWA icon, web manifest at handang i-paste na HTML ang anumang larawan.

Sa pahinang ito

Mabilis na simula

Ang MakeFav API ay isang simpleng HTTPS + JSON REST API. Lahat ng endpoint ay nasa ilalim ng iisang base URL:

https://makefav.com/api/v1
  1. Gumawa ng libreng account
    Mag-sign up, kumpirmahin ang iyong email address at panatilihing aktibo ang subscription sa MakeFav newsletter – iyon lang ang kundisyon ng libreng plano.
  2. Gumawa ng API key
    Buksan ang pahina ng mga API key sa iyong account at gumawa ng personal na key. Nagsisimula ito sa mf_ at isang beses lang ipinapakita, kaya itago ito nang ligtas. Pamahalaan ang mga API key
  3. Ipadala ang una mong request
    Mag-upload ng larawan sa generate endpoint at i-save ang ibinalik na ZIP file:
curl --fail-with-body -sS https://makefav.com/api/v1/generate \
  -H "Authorization: Bearer $MAKEFAV_API_KEY" \
  -F "[email protected]" \
  -F "app_name=My App" \
  -F "theme_color=#2f9e68" \
  -F "radius=20" \
  -o favicons.zip

Unzip favicons.zip, upload the files to your website and paste the HTML code from the end of readme-makefav.txt into the <head> of every page.

Authentication

Bawat request sa protektadong endpoint ay dapat may kasamang personal na API key. Puwede kang gumawa, magpangalan at mag-revoke ng mga key anumang oras sa pahina ng iyong account: Mga API key

Send the key as a bearer token in the Authorization header, or – if your HTTP client makes that awkward – in the X-API-Key header. Both are equivalent.

Authorization: Bearer mf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# or, alternatively
X-API-Key: mf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ang mga key ay pag-aari ng user na kumpirmado ang email address at aktibo ang subscription sa newsletter (kundisyon ng libreng plano). Kung hindi kumpirmado ang email, naka-disable ang newsletter o na-ban ang account, 403 Forbidden ang ibabalik sa bawat request.
Ituring ang mga API key na parang password: itago ang mga ito sa server o sa mga CI secret, huwag kailanman sa browser code, mobile app o pampublikong repository. I-revoke agad ang key kapag na-leak ito.

Missing or invalid keys return 401 Unauthorized. The GET /sizes and GET /openapi.json endpoints do not require a key.

Rate limit

Bilang default, ang bawat API key ay puwedeng gumawa ng 100 request kada oras. Ipinapakita ng bawat authenticated na response kung nasaan ka na:

HeaderPaglalarawan
X-RateLimit-LimitPinakamaraming request na pinapayagan sa kasalukuyang window.
X-RateLimit-RemainingNatitirang request sa kasalukuyang window.
X-RateLimit-ResetUnix timestamp (segundo, UTC) kung kailan magre-reset ang window.
HTTP/1.1 200 OK
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 97
X-RateLimit-Reset: 1767225600

When the limit is exceeded the API responds with HTTP 429 and the error code rate_limited. Wait until the time in X-RateLimit-Reset before retrying – do not retry in a tight loop.

HTTP/1.1 429 Too Many Requests
Content-Type: application/json
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1767225600

{"error": {"code": "rate_limited", "message": "Rate limit exceeded. Try again after the reset time."}}

You can check your current quota at any time with GET /me.

Mga endpoint

EndpointAuthPaglalarawan
POST /generateAPI keyGumawa ng kumpletong favicon package.
GET /meAPI keyAng iyong account at kasalukuyang status ng rate limit.
GET /sizesWalaListahan ng lahat ng icon file at laki na nililikha ng generator.
GET /openapi.jsonWalaMachine-readable na OpenAPI 3.1 specification.

Gumawa ng favicon package

POST/generate

Gumagawa ng kumpletong favicon package mula sa isang source image. Ipadala ang larawan sa isa sa tatlong paraan:

Content typeImage fieldPaglalarawan
multipart/form-dataimageFile upload. Inirerekomenda – ang pinakamabisang opsyon.
application/jsonimage_base64Base64-encoded image, either raw base64 or a data URL such as data:image/png;base64,iVBOR….
application/jsonimage_urlPampublikong http o https URL ng larawan. Dina-download ito ng server (hanggang 10 MB).

Mga sinusuportahang input format: PNG, JPG, WebP, AVIF, GIF, BMP, SVG at ICO. Pinakamalaking sukat ng file: 10 MB.

Mga parameter

Opsyonal ang lahat ng parameter. Ipadala ang mga ito bilang form field (multipart) o bilang JSON property. Ang mga di-wastong value ay babalik sa default.

PangalanUri / saklawDefaultPaglalarawan
app_namestring, hanggang 60 characterMy WebsitePangalan ng iyong website o app, ginagamit sa manifest.json at sa halimbawang pahina.
short_namestring, hanggang 24 na characterunang 12 character ng app_nameMaikling pangalan na makikita sa ilalim ng icon sa home screen ng Android.
theme_color#rrggbb#ffffffKulay ng UI ng browser (theme-color meta tag at manifest).
tile_color#rrggbbkapareho ng theme_colorKulay ng background ng mga Windows Start tile.
backgroundtransparent | #rrggbbtransparentBackground ng mga icon ng browser, Android at Windows.
apple_background#rrggbb#ffffffBackground ng mga Apple touch icon at ng maskable icon (hindi sinusuportahan ng iOS ang transparency). Hindi ito ginagamit kapag kulay ang background – ang kulay na iyon ang gagamitin.
paddinginteger, 0–40 (%)0Bakanteng espasyo sa paligid ng larawan, bilang porsyento ng laki ng icon.
radiusinteger, 0–50 (%)0Bilugang mga sulok. Ang 50 ay gumagawa ng bilog. Hindi ito inilalapat sa mga Apple icon, na ang iOS mismo ang nagbibilog.
zoominteger, 50–400 (%)100Laki ng larawan sa loob ng icon. Ang mga value na higit sa 100 ay kukunin lang ang bahagi ng larawan (crop).
offset_x, offset_ynumber, -1 hanggang 10Inililipat ang larawan nang pahalang / patayo, bilang bahagi ng laki ng icon.
pathstring/Folder sa iyong server kung saan ilalagay ang mga icon. Ginagamit sa HTML snippet, manifest at browserconfig.
displaystandalone | fullscreen | minimal-ui | browserstandalonePWA display mode na isusulat sa manifest.
pixelatedauto | 1 | 0autoMatalim na nearest-neighbour scaling para sa pixel art. Ino-on ito ng auto para sa mga source na 64 px o mas maliit.
maskable1 | 01Gumawa rin ng maskable-icon-512x512.png na may safe-zone padding para sa mga adaptive icon ng Android.
ico_sizeslistahang pinaghihiwalay ng kuwit ng 16, 24, 32, 48, 64, 128, 25616,32,48Mga laking isasama sa favicon.ico.
groupslistahang pinaghihiwalay ng kuwit ng favicon, apple, android, msfavicon,apple,android,msMga icon set na gagawin: mga favicon ng browser, Apple touch icon, Android / PWA icon at Windows tile.
formatzip | jsonzipFormat ng response – tingnan sa ibaba.

Response

format=zip
Binary ZIP archive with Content-Type: application/zip and Content-Disposition: attachment. Default.
format=json
JSON object with the package id (32 hex characters), the html snippet for your <head> and a files array; each file has name, mime, size (bytes) and base64 contents.

Halimbawang request – multipart, ZIP response

curl --fail-with-body -sS https://makefav.com/api/v1/generate \
  -H "Authorization: Bearer $MAKEFAV_API_KEY" \
  -F "[email protected]" \
  -F "app_name=My App" \
  -F "theme_color=#2f9e68" \
  -F "radius=20" \
  -o favicons.zip
HTTP/1.1 200 OK
Content-Type: application/zip
Content-Disposition: attachment
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 99
X-RateLimit-Reset: 1767225600

<binary ZIP data>

Halimbawang request – JSON na may image URL, JSON response

curl --fail-with-body -sS https://makefav.com/api/v1/generate \
  -H "Authorization: Bearer $MAKEFAV_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image_url": "https://example.com/logo.png",
    "app_name": "My App",
    "theme_color": "#2f9e68",
    "radius": 20,
    "groups": "favicon,apple,android",
    "format": "json"
  }'
{
  "id": "9f86d081884c7d659a2feaa0c55ad015",
  "html": "<link rel=\"apple-touch-icon\" sizes=\"57x57\" href=\"/apple-icon-57x57.png\">\n…\n<meta name=\"theme-color\" content=\"#2f9e68\">",
  "files": [
    {"name": "favicon.ico", "mime": "image/x-icon", "size": 15086, "base64": "AAABAAMAEBAAAAEAIABoBAAANgAAACAg…"},
    {"name": "favicon-16x16.png", "mime": "image/png", "size": 612, "base64": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQ…"},
    {"name": "manifest.json", "mime": "application/json", "size": 1094, "base64": "ewogICAgIm5hbWUiOiAiTXkgQXBwIiwK…"}
  ]
}

Kunin ang iyong account

GET/me

Ibinabalik ang user na pag-aari ng API key at ang kasalukuyang rate-limit status. Kapaki-pakinabang para i-verify ang key. Nangangailangan ng authentication; walang parameter.

Halimbawang request

curl -sS https://makefav.com/api/v1/me \
  -H "Authorization: Bearer $MAKEFAV_API_KEY"

Halimbawang response

{
  "id": 1,
  "email": "[email protected]",
  "name": "Jane Doe",
  "rate_limit": {"limit": 100, "remaining": 97, "reset": 1767225600}
}

Ilista ang mga laki ng icon

GET/sizes

Returns every icon file the generator can produce, with its pixel size and group. No authentication and no parameters. The group value matches the groups parameter of POST /generate.

Halimbawang request

curl -sS https://makefav.com/api/v1/sizes

Halimbawang response

{
  "files": [
    {"name": "favicon-16x16.png", "size": 16, "group": "favicon"},
    {"name": "favicon-32x32.png", "size": 32, "group": "favicon"},
    {"name": "apple-touch-icon.png", "size": 180, "group": "apple"},
    {"name": "android-icon-192x192.png", "size": 192, "group": "android"},
    {"name": "ms-icon-144x144.png", "size": 144, "group": "ms"}
  ]
}

OpenAPI specification

GET/openapi.json

Ibinabalik ang OpenAPI 3.1 na paglalarawan ng API na ito. Walang authentication. I-import ito sa Postman, Insomnia o Swagger UI, o gamitin para gumawa ng typed client para sa iyong wika.

curl -sS https://makefav.com/api/v1/openapi.json -o makefav-openapi.json

Mga error

Successful requests return HTTP 200. Every error returns a JSON body with a stable, machine-readable code and a human-readable message. Always branch on the code, not on the message text.

HTTP/1.1 422 Unprocessable Content
Content-Type: application/json

{
  "error": {
    "code": "invalid_image",
    "message": "The uploaded file could not be decoded as an image."
  }
}
HTTP statusError codeKahulugan
400bad_requestMali ang pagkakabuo ng request, halimbawa ay walang ipinadalang larawan o di-wasto ang JSON body.
401unauthorizedWalang API key o di-wasto ito.
403forbiddenHindi pa kumpirmado ang email ng may-ari ng key, naka-disable ang subscription sa newsletter, o na-ban ang account.
413file_too_largeMas malaki sa 10 MB ang larawan.
415unsupported_typeHindi sinusuportahan ang uri ng file o content type ng request.
422invalid_imageHindi ma-decode ang file bilang larawan, o hindi ma-download ang image URL.
429rate_limitedNapakaraming request. Maghintay hanggang X-RateLimit-Reset.
500server_errorMay nangyaring mali sa aming panig. Subukan muli mamaya; makipag-ugnayan sa support kung magpapatuloy ito.

Mga output file

With all groups enabled, a package contains the files below. Files from disabled groups are left out.

FileLakiGrupo
favicon.ico16, 32, 48 (nako-configure)palagi
favicon-16x16.png16 × 16favicon
favicon-32x32.png32 × 32favicon
favicon-96x96.png96 × 96favicon
apple-icon-57x57.png57 × 57apple
apple-icon-60x60.png60 × 60apple
apple-icon-72x72.png72 × 72apple
apple-icon-76x76.png76 × 76apple
apple-icon-114x114.png114 × 114apple
apple-icon-120x120.png120 × 120apple
apple-icon-144x144.png144 × 144apple
apple-icon-152x152.png152 × 152apple
apple-icon-180x180.png180 × 180apple
apple-icon.png192 × 192apple
apple-icon-precomposed.png192 × 192apple
apple-touch-icon.png180 × 180apple
android-icon-36x36.png36 × 36android
android-icon-48x48.png48 × 48android
android-icon-72x72.png72 × 72android
android-icon-96x96.png96 × 96android
android-icon-144x144.png144 × 144android
android-icon-192x192.png192 × 192android
android-icon-512x512.png512 × 512android
web-app-manifest-192x192.png192 × 192android
web-app-manifest-512x512.png512 × 512android
maskable-icon-512x512.png512 × 512android
ms-icon-70x70.png70 × 70ms
ms-icon-144x144.png144 × 144ms
ms-icon-150x150.png150 × 150ms
ms-icon-310x310.png310 × 310ms

Karagdagang mga file

FileKasamaPaglalarawan
favicon.svgPara lang sa SVG input na walang crop, zoom, padding, sulok o backgroundNilinis na kopya ng iyong SVG para sa mga browser na sumusuporta sa vector favicon.
manifest.json, site.webmanifestandroidWeb app manifest para sa Android at mga mai-install na PWA (dalawang magkaparehong kopya).
browserconfig.xmlmsConfiguration ng Windows tile gamit ang kulay ng iyong tile.
readme-makefav.txtpalagiMga tagubilin sa pag-install na may HTML code para sa iyong <head> sa dulo.

Mga halimbawa ng code

Each example uploads logo.png with a few options and saves favicons.zip, handling API errors. Set the environment variable MAKEFAV_API_KEY to your API key first.

Multipart upload:

# Multipart upload (recommended). --fail-with-body exits non-zero on HTTP errors
# and still saves the JSON error body, so you can inspect it.
curl --fail-with-body -sS https://makefav.com/api/v1/generate \
  -H "Authorization: Bearer $MAKEFAV_API_KEY" \
  -F "[email protected]" \
  -F "app_name=My App" \
  -F "theme_color=#2f9e68" \
  -F "radius=20" \
  -o favicons.zip \
  || { echo "Request failed:"; cat favicons.zip; rm -f favicons.zip; exit 1; }

JSON body na may base64-encoded na larawan (nangangailangan ng jq):

# JSON body with a base64-encoded image (built with jq to avoid argument length limits)
base64 < logo.png | tr -d '\n' > logo.b64
jq -n --rawfile img logo.b64 \
  '{image_base64: $img, app_name: "My App", theme_color: "#2f9e68", radius: 20}' \
| curl --fail-with-body -sS https://makefav.com/api/v1/generate \
    -H "Authorization: Bearer $MAKEFAV_API_KEY" \
    -H "Content-Type: application/json" \
    --data-binary @- \
    -o favicons.zip \
  || { echo "Request failed:"; cat favicons.zip; rm -f favicons.zip; exit 1; }

Paggamit sa HTML

Upload all files to the folder you set with path, then paste the snippet into the <head> of every page. It is included at the end of readme-makefav.txt in the package and, with format=json, returned in the html field. Example for the options used in the code examples above:

<head>
  <meta charset="utf-8">
  <title>My App</title>

  <link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
  <link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">
  <link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png">
  <link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png">
  <link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png">
  <link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png">
  <link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png">
  <link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png">
  <link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png">
  <link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
  <link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
  <link rel="icon" href="/favicon.ico" sizes="any">
  <link rel="manifest" href="/manifest.json">
  <meta name="msapplication-TileColor" content="#2f9e68">
  <meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
  <meta name="msapplication-config" content="/browserconfig.xml">
  <meta name="theme-color" content="#2f9e68">
</head>

Pagkatapos mag-deploy, i-clear ang cache ng iyong browser o buksan ang site sa private window – malakas mag-cache ng favicon ang mga browser.

Changelog

v1

  • Unang pampublikong release ng MakeFav REST API.
  • Endpoints POST /generate, GET /me, GET /sizes and GET /openapi.json.
  • Mga response format na ZIP at JSON, multipart, base64 at URL image input.
  • Personal na API key na may 100 request kada oras.

Stable ang Version 1: mga opsyonal na parameter at field lang ang idaragdag namin. Ilalabas bilang bagong bersyon ang mga breaking change nang may paunang abiso.

Suporta

May mga tanong, bug report, o kailangan ng mas mataas na rate limit? Masaya kaming tumulong. Isama ang oras ng request at ang error code sa iyong mensahe – huwag kailanman ang iyong API key.