REST API · v1

توثيق MakeFav API

أنشئ حزم favicon كاملة من الكود الخاص بك وسكربتات البناء وخطوط CI. طلب واحد يحوّل أي صورة إلى favicon.ico وأيقونات Apple touch وأيقونات Android وPWA وملف manifest وكود HTML جاهز للصق.

في هذه الصفحة

بداية سريعة

MakeFav API هي واجهة REST بسيطة تعتمد على HTTPS وJSON. جميع نقاط النهاية تحت عنوان أساسي واحد:

https://makefav.com/api/v1
  1. أنشئ حسابًا مجانيًا
    سجّل، وأكّد عنوان بريدك الإلكتروني، وأبقِ اشتراكك في نشرة MakeFav البريدية فعّالًا – هذا هو الشرط الوحيد للخطة المجانية.
  2. أنشئ مفتاح API
    افتح صفحة مفاتيح API في حسابك وأنشئ مفتاحًا شخصيًا. يبدأ بـ mf_ ويُعرض مرة واحدة فقط، لذا احفظه في مكان آمن. إدارة مفاتيح API
  3. أرسل طلبك الأول
    ارفع صورة إلى نقطة نهاية generate واحفظ ملف ZIP المُرجَع:
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.

المصادقة

يجب أن يتضمن كل طلب إلى نقطة نهاية محمية مفتاح API شخصيًا. يمكنك إنشاء المفاتيح وتسميتها وإلغاؤها في أي وقت من صفحة حسابك: مفاتيح API

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
تنتمي المفاتيح إلى مستخدم تم تأكيد بريده الإلكتروني واشتراكه في النشرة البريدية فعّال (شرط الخطة المجانية). إذا لم يتم تأكيد البريد، أو تم تعطيل النشرة، أو حُظر الحساب، فسيُرجع كل طلب الخطأ 403 Forbidden.
تعامل مع مفاتيح API كما تتعامل مع كلمات المرور: احتفظ بها على الخادم أو في أسرار CI، ولا تضعها أبدًا في كود المتصفح أو تطبيقات الجوال أو المستودعات العامة. ألغِ المفتاح فورًا إذا تسرّب.

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

حدود الاستخدام

افتراضيًا يمكن لكل مفتاح API إجراء 100 طلب في الساعة. توضح لك كل استجابة موثّقة وضعك الحالي:

الترويسةالوصف
X-RateLimit-Limitالحد الأقصى لعدد الطلبات المسموح بها في النافذة الحالية.
X-RateLimit-Remainingالطلبات المتبقية في النافذة الحالية.
X-RateLimit-Resetطابع Unix الزمني (بالثواني، UTC) لوقت إعادة تعيين النافذة.
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.

نقاط النهاية

نقطة النهايةالمصادقةالوصف
POST /generateمفتاح APIإنشاء حزمة favicon كاملة.
GET /meمفتاح APIحسابك وحالة حد الاستخدام الحالية.
GET /sizesبدونقائمة بجميع ملفات الأيقونات وأحجامها التي ينتجها المولّد.
GET /openapi.jsonبدونمواصفات OpenAPI 3.1 المقروءة آليًا.

إنشاء حزمة favicon

POST/generate

ينشئ حزمة favicon كاملة من صورة مصدر واحدة. أرسل الصورة بإحدى ثلاث طرق:

نوع المحتوىحقل الصورةالوصف
multipart/form-dataimageرفع ملف. موصى به – الخيار الأكثر كفاءة.
application/jsonimage_base64Base64-encoded image, either raw base64 or a data URL such as data:image/png;base64,iVBOR….
application/jsonimage_urlعنوان URL عام (http أو https) للصورة. يقوم الخادم بتنزيلها (بحد أقصى 10 ميغابايت).

صيغ الإدخال المدعومة: PNG وJPG وWebP وAVIF وGIF وBMP وSVG وICO. الحد الأقصى لحجم الملف: 10 ميغابايت.

المعاملات

جميع المعاملات اختيارية. أرسلها كحقول نموذج (multipart) أو كخصائص JSON. القيم غير الصالحة تعود إلى القيمة الافتراضية.

الاسمالنوع / النطاقالافتراضيالوصف
app_nameنص، بحد أقصى 60 حرفًاMy Websiteاسم موقعك أو تطبيقك، يُستخدم في manifest.json وصفحة المثال.
short_nameنص، بحد أقصى 24 حرفًاأول 12 حرفًا من app_nameالاسم المختصر الذي يظهر تحت الأيقونة على الشاشات الرئيسية في Android.
theme_color#rrggbb#ffffffلون واجهة المتصفح (وسم theme-color وmanifest).
tile_color#rrggbbنفس theme_colorلون خلفية بلاطات قائمة ابدأ في Windows.
backgroundtransparent | #rrggbbtransparentخلفية أيقونات المتصفح وAndroid وWindows.
apple_background#rrggbb#ffffffخلفية أيقونات Apple touch والأيقونة القابلة للقناع maskable (لا يدعم iOS الشفافية). يتم تجاهله عندما تكون الخلفية لونًا – ويُستخدم ذلك اللون بدلًا منه.
paddingعدد صحيح، 0–40 (%)0مساحة فارغة حول الصورة، كنسبة مئوية من حجم الأيقونة.
radiusعدد صحيح، 0–50 (%)0زوايا مستديرة. القيمة 50 تصنع دائرة. لا تُطبَّق على أيقونات Apple، إذ يقوم iOS بتدوير زواياها بنفسه.
zoomعدد صحيح، 50–400 (%)100مقياس الصورة داخل الأيقونة. القيم الأكبر من 100 تقتطع جزءًا من الصورة.
offset_x, offset_yرقم، من -1 إلى 10يحرّك الصورة أفقيًا / عموديًا، كنسبة من حجم الأيقونة.
pathنص/المجلد على خادمك الذي ستوضع فيه الأيقونات. يُستخدم في مقتطف HTML وmanifest وbrowserconfig.
displaystandalone | fullscreen | minimal-ui | browserstandaloneوضع عرض PWA المكتوب في manifest.
pixelatedauto | 1 | 0autoتحجيم حاد بأقرب جار (nearest-neighbour) لفن البكسل. يفعّله الوضع auto للمصادر بحجم 64 بكسل أو أقل.
maskable1 | 01أنشئ أيضًا maskable-icon-512x512.png مع هامش منطقة آمنة لأيقونات Android التكيفية.
ico_sizesقائمة مفصولة بفواصل من 16 و24 و32 و48 و64 و128 و25616,32,48الأحجام المضمّنة في favicon.ico.
groupsقائمة مفصولة بفواصل من favicon وapple وandroid وmsfavicon,apple,android,msمجموعات الأيقونات المراد إنشاؤها: أيقونات favicon للمتصفحات، وأيقونات Apple touch، وأيقونات Android / PWA، وبلاطات Windows.
formatzip | jsonzipتنسيق الاستجابة – انظر أدناه.

الاستجابة

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.

مثال على طلب – multipart، استجابة ZIP

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>

مثال على طلب – JSON مع رابط صورة، استجابة JSON

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…"}
  ]
}

احصل على حسابك

GET/me

تعرض المستخدم الذي يعود إليه مفتاح API وحالة حد الطلبات الحالية. مفيدة للتحقق من المفتاح. تتطلب المصادقة؛ بلا معلمات.

مثال على طلب

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

مثال على استجابة

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

عرض أحجام الأيقونات

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.

مثال على طلب

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

مثال على استجابة

{
  "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

GET/openapi.json

تعرض وصف OpenAPI 3.1 لواجهة API هذه. بدون مصادقة. استوردها في Postman أو Insomnia أو Swagger UI، أو استخدمها لإنشاء عميل مُنمَّط للغتك.

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

الأخطاء

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رمز الخطأالمعنى
400bad_requestالطلب غير صحيح التكوين، مثلًا لم تُرسل أي صورة أو أن نص JSON غير صالح.
401unauthorizedمفتاح API مفقود أو غير صالح.
403forbiddenالبريد الإلكتروني لمالك المفتاح غير مؤكد، أو أن الاشتراك في النشرة البريدية معطّل، أو أن الحساب محظور.
413file_too_largeحجم الصورة أكبر من 10 ميغابايت.
415unsupported_typeنوع الملف أو نوع محتوى الطلب غير مدعوم.
422invalid_imageتعذّر فك ترميز الملف كصورة، أو تعذّر تنزيل الصورة من الرابط.
429rate_limitedطلبات كثيرة جدًا. انتظر حتى X-RateLimit-Reset.
500server_errorحدث خطأ من جانبنا. أعد المحاولة لاحقًا، وتواصل مع الدعم إذا استمرت المشكلة.

ملفات المخرجات

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

الملفالحجمالمجموعة
favicon.ico16, 32, 48 (قابل للتكوين)دائمًا
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

ملفات إضافية

الملفمضمّنالوصف
favicon.svgفقط لمدخلات SVG بدون قص أو تكبير أو حشو أو زوايا أو خلفيةنسخة منقّاة من ملف SVG للمتصفحات التي تدعم أيقونات favicon المتجهة.
manifest.json, site.webmanifestandroidملف manifest لتطبيق الويب لنظام Android وتطبيقات PWA القابلة للتثبيت (نسختان متطابقتان).
browserconfig.xmlmsإعدادات بلاطات Windows بلون البلاطة الذي اخترته.
readme-makefav.txtدائمًاتعليمات التثبيت مع شيفرة HTML الخاصة بالعنصر <head> في النهاية.

أمثلة برمجية

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:

# 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 مع صورة بترميز base64 (يتطلب 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; }

استخدام 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>

بعد النشر، امسح ذاكرة التخزين المؤقت للمتصفح أو افتح الموقع في نافذة خاصة – فالمتصفحات تخزّن أيقونات favicon مؤقتًا بشكل مكثّف.

سجل التغييرات

v1

  • الإصدار العام الأول من واجهة MakeFav REST API.
  • Endpoints POST /generate, GET /me, GET /sizes and GET /openapi.json.
  • تنسيقا استجابة ZIP وJSON، ودعم multipart وbase64 وإدخال الصور عبر الرابط.
  • مفاتيح API شخصية بحد 100 طلب في الساعة.

الإصدار 1 مستقر: نضيف فقط معلمات وحقولًا اختيارية. وستُطرح التغييرات الجذرية كإصدار جديد مع إشعار مسبق.

الدعم

لديك أسئلة أو تقارير أخطاء أو تحتاج إلى حد طلبات أعلى؟ يسعدنا مساعدتك. يُرجى ذكر وقت الطلب ورمز الخطأ في رسالتك – ولا ترسل مفتاح API أبدًا.