الملفات

ملفات المشروع والروابط الخارجية. معرّفات رقمية.

عنوان الخدمة https://app.fareeqy.com/api/v1

شكل المورد

الحقول التي ترجع داخل data في مسارات هذه المجموعة.

idinteger

معرّف رقمي، فالملفات بلا slug.

namestring
pathstring

مسار المجلد الذي يوجد فيه الملف.

folder_idinteger | null
content_typestring | null
size_bytesinteger | null
size_humanstring | null
external_urlstring | null

له قيمة في الرابط الخارجي، ويكون null في الملف المرفوع.

sourcestring | null

الاسم المعروض للمصدر.

scan_statestring

حالة فحص الفيروسات، مثل pending أو clean.

downloadableboolean

تصبح true بعد أن يجتاز الملف الفحص.

uploaded_bystring | null
created_atstring (date-time)
ProjectFile
{
  "id": 108,
  "name": "الهوية-البصرية.pdf",
  "path": "التصاميم/الهوية-البصرية.pdf",
  "folder_id": 42,
  "content_type": "application/pdf",
  "size_bytes": 2418176,
  "size_human": "2.31 م.بايت",
  "external_url": null,
  "source": null,
  "scan_state": "clean",
  "downloadable": true,
  "uploaded_by": "سارة العتيبي",
  "created_at": "2026-07-10T16:31:44.000+03:00"
}

عرض مستوى واحد من متصفح ملفات المشروع

GET/projects/{project_id}/filesيتطلب files:read

المجلدات والملفات الموجودة مباشرة داخل folder_id، أو في جذر المشروع. ليست تنازلية: انزل مستوى بإرسال معرّف المجلد الفرعي. الملفات مقسّمة إلى صفحات، والمجلدات ليست كذلك.

بارامترات المسار

project_idstringمطلوب

الـ slug الخاص بالمشروع.

بارامترات الاستعلام

folder_idinteger

المجلد الذي تعرض محتواه. اتركه لعرض جذر المشروع.

limitinteger

حجم الصفحة. الافتراضي 50، والحد الأقصى 100، وما زاد عنه يُقصَر عليه.

الافتراضي: 50

offsetinteger

عدد السجلات التي تُتخطّى. الافتراضي 0.

الافتراضي: 0

مثال الطلب

cURL
curl "https://app.fareeqy.com/api/v1/projects/تطوير-الموقع/files" \
  -H "Authorization: Bearer $FAREEQY_API_KEY"

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

200
{
  "data": {
    "folder": {
      "id": 42,
      "name": "التصاميم",
      "path": "التصاميم",
      "description": "ملفات الهوية وواجهات الموقع.",
      "parent_folder_id": null,
      "created_at": "2026-07-05T08:20:00.000+03:00"
    },
    "folders": [
      {
        "id": 51,
        "name": "الأيقونات",
        "path": "التصاميم/الأيقونات",
        "description": null,
        "parent_folder_id": 42,
        "created_at": "2026-07-06T09:02:14.000+03:00"
      }
    ],
    "files": [
      {
        "id": 108,
        "name": "الهوية-البصرية.pdf",
        "path": "التصاميم/الهوية-البصرية.pdf",
        "folder_id": 42,
        "content_type": "application/pdf",
        "size_bytes": 2418176,
        "size_human": "2.31 م.بايت",
        "external_url": null,
        "source": null,
        "scan_state": "clean",
        "downloadable": true,
        "uploaded_by": "سارة العتيبي",
        "created_at": "2026-07-10T16:31:44.000+03:00"
      },
      {
        "id": 131,
        "name": "واجهات الصفحة الرئيسية",
        "path": "التصاميم/واجهات الصفحة الرئيسية",
        "folder_id": 42,
        "content_type": null,
        "size_bytes": null,
        "size_human": null,
        "external_url": "https://www.figma.com/design/9aZq/home-v3",
        "source": "Figma",
        "scan_state": "skipped",
        "downloadable": true,
        "uploaded_by": "سارة العتيبي",
        "created_at": "2026-07-12T11:04:20.000+03:00"
      },
      {
        "id": 147,
        "name": "لقطة-الصفحة-الرئيسية.png",
        "path": "التصاميم/لقطة-الصفحة-الرئيسية.png",
        "folder_id": 42,
        "content_type": "image/png",
        "size_bytes": 884736,
        "size_human": "864 ك.بايت",
        "external_url": null,
        "source": null,
        "scan_state": "clean",
        "downloadable": true,
        "uploaded_by": "عبدالله المطيري",
        "created_at": "2026-07-14T10:22:07.000+03:00"
      },
      {
        "id": 152,
        "name": "عرض-التدفق-الجديد.mp4",
        "path": "التصاميم/عرض-التدفق-الجديد.mp4",
        "folder_id": 42,
        "content_type": "video/mp4",
        "size_bytes": 41943040,
        "size_human": "40 م.بايت",
        "external_url": null,
        "source": null,
        "scan_state": "pending",
        "downloadable": false,
        "uploaded_by": "نورة الحربي",
        "created_at": "2026-07-15T13:47:58.000+03:00"
      }
    ]
  },
  "meta": {
    "total": 4,
    "limit": 50,
    "offset": 0
  }
}
حالات الرفض:401403404429اعرض أمثلة الرفض
401default

Missing or invalid API key.

default
{
  "error": {
    "code": "unauthorized",
    "message": "Invalid or missing API key."
  }
}
403forbidden

Two different refusals share this status, and a client must tell them apart by error.code. forbidden means the key's scope or allowlist does not permit this operation, or Pundit denied the action. plan_upgrade_required means the company's plan carries no API access at all, so no key on it can ever succeed and there is nothing to retry.

This key may not perform this operation
{
  "error": {
    "code": "forbidden",
    "message": "This API key is not permitted to perform this operation."
  }
}
The company's plan carries no API access
{
  "error": {
    "code": "plan_upgrade_required",
    "message": "خطة «الاحترافي» لا تشمل الوصول إلى API. رقِّ إلى «المتطور» أو «الانتاجي» لتفعيله. — The الاحترافي plan does not include API access. Upgrade to «المتطور» or «الانتاجي» to enable it."
  }
}
404default

Resource not found or not accessible — also returned for EVERY endpoint when the company's rest_api feature flag is disabled (the surface is hidden). Lookups drill through the URL hierarchy, so another company's record is a 404 and never a leak. A path that matches no route at all answers 404 with the distinct code unknown_endpoint and echoes the path back, so a mistyped or half-built URL is told apart from a record that is missing or out of reach.

default
{
  "error": {
    "code": "not_found",
    "message": "Resource not found, or you do not have access to it."
  }
}
429rate_limit_exceeded

Either the company's daily API allowance is spent (rate_limit_exceeded), or the per-key / per-IP burst throttle of 300 requests per minute fired. Both come back after a wait, so Retry-After is honest here. The two bodies are not the same shape. The daily-quota refusal uses the standard error envelope. The burst throttle is served by Rack::Attack ahead of the application, so its body is a flat {"error": "<string>"} with no code. A client that reads error.code has to tolerate error being a plain string.

Today's daily allowance is spent (application envelope)
{
  "error": {
    "code": "rate_limit_exceeded",
    "message": "استهلكت رصيد اليوم من طلبات API في خطة «المتطور» (1000 طلب يوميًا). يتجدد الرصيد عند منتصف الليل بتوقيت Asia/Riyadh. — Daily API quota exhausted: the المتطور plan allows 1000 calls per day. It resets at midnight Asia/Riyadh."
  }
}
Over 300 requests in a minute (Rack::Attack body, flat error)
{
  "error": "Rate limit exceeded. Please try again later."
}
الأخطاء

رفع ملف من محتوى مباشر

POST/projects/{project_id}/filesيتطلب files:write

يرفع ملفاً من content وهو نص UTF-8، أو من content_base64 وهو ثنائي بترميز base64 قياسي بلا فواصل أسطر. أحدهما فقط، لا كلاهما. والحد 5 م.بايت بعد فك الترميز. الملف المرفوع حديثاً يبقى pending وغير قابل للتنزيل حتى يجتاز فحص الفيروسات.

بارامترات المسار

project_idstringمطلوب

الـ slug الخاص بالمشروع.

جسم الطلب

namestringمطلوب

اسم الملف مع امتداده.

folder_idinteger | null

المجلد الوجهة. اتركه للرفع في جذر المشروع.

contentstring | null

محتوى نصي بترميز UTF-8. أرسله أو أرسل content_base64، لا كليهما.

content_base64string | null

بايتات بترميز base64. أرسله أو أرسل content، لا كليهما.

مثال الطلب

cURL
curl -X POST "https://app.fareeqy.com/api/v1/projects/تطوير-الموقع/files" \
  -H "Authorization: Bearer $FAREEQY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"","folder_id":null,"content":null,"content_base64":null}'

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

201
{
  "data": {
    "id": 108,
    "name": "الهوية-البصرية.pdf",
    "path": "التصاميم/الهوية-البصرية.pdf",
    "folder_id": 42,
    "content_type": "application/pdf",
    "size_bytes": 2418176,
    "size_human": "2.31 م.بايت",
    "external_url": null,
    "source": null,
    "scan_state": "clean",
    "downloadable": true,
    "uploaded_by": "سارة العتيبي",
    "created_at": "2026-07-10T16:31:44.000+03:00"
  }
}
حالات الرفض:401403404409422429اعرض أمثلة الرفض
401default

Missing or invalid API key.

default
{
  "error": {
    "code": "unauthorized",
    "message": "Invalid or missing API key."
  }
}
403forbidden

Two different refusals share this status, and a client must tell them apart by error.code. forbidden means the key's scope or allowlist does not permit this operation, or Pundit denied the action. plan_upgrade_required means the company's plan carries no API access at all, so no key on it can ever succeed and there is nothing to retry.

This key may not perform this operation
{
  "error": {
    "code": "forbidden",
    "message": "This API key is not permitted to perform this operation."
  }
}
The company's plan carries no API access
{
  "error": {
    "code": "plan_upgrade_required",
    "message": "خطة «الاحترافي» لا تشمل الوصول إلى API. رقِّ إلى «المتطور» أو «الانتاجي» لتفعيله. — The الاحترافي plan does not include API access. Upgrade to «المتطور» or «الانتاجي» to enable it."
  }
}
404default

Resource not found or not accessible — also returned for EVERY endpoint when the company's rest_api feature flag is disabled (the surface is hidden). Lookups drill through the URL hierarchy, so another company's record is a 404 and never a leak. A path that matches no route at all answers 404 with the distinct code unknown_endpoint and echoes the path back, so a mistyped or half-built URL is told apart from a record that is missing or out of reach.

default
{
  "error": {
    "code": "not_found",
    "message": "Resource not found, or you do not have access to it."
  }
}
409default

A uniqueness/record conflict; retry.

default
{
  "error": {
    "code": "conflict",
    "message": "Could not complete due to a conflict; please retry."
  }
}
422default

A caller-fixable bad request (validation error, bad date, bad enum).

default
{
  "error": {
    "code": "unprocessable_entity",
    "message": "Title can't be blank"
  }
}
429rate_limit_exceeded

Either the company's daily API allowance is spent (rate_limit_exceeded), or the per-key / per-IP burst throttle of 300 requests per minute fired. Both come back after a wait, so Retry-After is honest here. The two bodies are not the same shape. The daily-quota refusal uses the standard error envelope. The burst throttle is served by Rack::Attack ahead of the application, so its body is a flat {"error": "<string>"} with no code. A client that reads error.code has to tolerate error being a plain string.

Today's daily allowance is spent (application envelope)
{
  "error": {
    "code": "rate_limit_exceeded",
    "message": "استهلكت رصيد اليوم من طلبات API في خطة «المتطور» (1000 طلب يوميًا). يتجدد الرصيد عند منتصف الليل بتوقيت Asia/Riyadh. — Daily API quota exhausted: the المتطور plan allows 1000 calls per day. It resets at midnight Asia/Riyadh."
  }
}
Over 300 requests in a minute (Rack::Attack body, flat error)
{
  "error": "Rate limit exceeded. Please try again later."
}
الأخطاء

حذف ملف

DELETE/projects/{project_id}/files/{id}يتطلب files:destructive

حذف نهائي. تستطيع حذف ما رفعته أنت، وحذف ملف غيرك يتطلب delete_any_file.

بارامترات المسار

project_idstringمطلوب

الـ slug الخاص بالمشروع.

idintegerمطلوب

المعرّف الرقمي للملف، فالملفات بلا slug.

مثال الطلب

cURL
curl -X DELETE "https://app.fareeqy.com/api/v1/projects/تطوير-الموقع/files/108" \
  -H "Authorization: Bearer $FAREEQY_API_KEY"

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

200
{
  "data": {
    "deleted": true,
    "file": {
      "id": 108,
      "name": "الهوية-البصرية.pdf"
    }
  }
}
حالات الرفض:401403404429اعرض أمثلة الرفض
401default

Missing or invalid API key.

default
{
  "error": {
    "code": "unauthorized",
    "message": "Invalid or missing API key."
  }
}
403forbidden

Two different refusals share this status, and a client must tell them apart by error.code. forbidden means the key's scope or allowlist does not permit this operation, or Pundit denied the action. plan_upgrade_required means the company's plan carries no API access at all, so no key on it can ever succeed and there is nothing to retry.

This key may not perform this operation
{
  "error": {
    "code": "forbidden",
    "message": "This API key is not permitted to perform this operation."
  }
}
The company's plan carries no API access
{
  "error": {
    "code": "plan_upgrade_required",
    "message": "خطة «الاحترافي» لا تشمل الوصول إلى API. رقِّ إلى «المتطور» أو «الانتاجي» لتفعيله. — The الاحترافي plan does not include API access. Upgrade to «المتطور» or «الانتاجي» to enable it."
  }
}
404default

Resource not found or not accessible — also returned for EVERY endpoint when the company's rest_api feature flag is disabled (the surface is hidden). Lookups drill through the URL hierarchy, so another company's record is a 404 and never a leak. A path that matches no route at all answers 404 with the distinct code unknown_endpoint and echoes the path back, so a mistyped or half-built URL is told apart from a record that is missing or out of reach.

default
{
  "error": {
    "code": "not_found",
    "message": "Resource not found, or you do not have access to it."
  }
}
429rate_limit_exceeded

Either the company's daily API allowance is spent (rate_limit_exceeded), or the per-key / per-IP burst throttle of 300 requests per minute fired. Both come back after a wait, so Retry-After is honest here. The two bodies are not the same shape. The daily-quota refusal uses the standard error envelope. The burst throttle is served by Rack::Attack ahead of the application, so its body is a flat {"error": "<string>"} with no code. A client that reads error.code has to tolerate error being a plain string.

Today's daily allowance is spent (application envelope)
{
  "error": {
    "code": "rate_limit_exceeded",
    "message": "استهلكت رصيد اليوم من طلبات API في خطة «المتطور» (1000 طلب يوميًا). يتجدد الرصيد عند منتصف الليل بتوقيت Asia/Riyadh. — Daily API quota exhausted: the المتطور plan allows 1000 calls per day. It resets at midnight Asia/Riyadh."
  }
}
Over 300 requests in a minute (Rack::Attack body, flat error)
{
  "error": "Rate limit exceeded. Please try again later."
}
الأخطاء