On this page

«حفظ كمسودة» and «الحفظ التلقائي» for the project form, and «نشر».

A draft is the form saved before it is finished: every field optional, nothing visible to anyone but its author — not in the projects list, not to admins, not to guests. Publishing turns it into a project through the same path as POST /projects (webhook, types, AI index) and deletes the draft.

  • Who: the same callers as creating a project (projects:manage, projects:create or projects:moderate), not restricted from media (403 RESTRICTION_BLOCKED). Only the author reads or writes a draft: anyone else's answers 404 PROJECT_DRAFT_NOT_FOUND.
  • Saving: PUT changes only the fields sent (absent = unchanged, null / "" = cleared). JSON is fine for text-only autosaves; send multipart when a file is attached. Send back the revision you last got: if another tab saved since, nothing is written and the answer is 409 PROJECT_DRAFT_CONFLICT with the current revision.
  • Limits: at most 20 drafts per author per community (409 PROJECT_DRAFT_LIMIT); a draft above 2 MB answers 413 PROJECT_DRAFT_TOO_LARGE.
  • Publishing: 400 PROJECT_DRAFT_INCOMPLETE with missing while name, nameArabic, description or the logo is missing. Publishing the same draft twice creates ONE project: the second answers 409 PROJECT_DRAFT_ALREADY_PUBLISHED with projectId. The project's id is the draft's id.
  • «إشعار الأعضاء عند النشر»: notifyMembers in the publish body, else the value the draft stored, else no notice.
  • «المشاريع 2» has the same endpoints under /projects2/drafts (tag Project 2 Drafts); a draft belongs to one section and is invisible from the other.

6 endpoints.

MethodPathSummary
GET/api/communities/{communityId}/project-draftsMy drafts in this community, most recently saved first
POST/api/communities/{communityId}/project-draftsSave a new draft (the first «حفظ كمسودة» or autosave)
DELETE/api/communities/{communityId}/project-drafts/{draftId}Discard a draft
GET/api/communities/{communityId}/project-drafts/{draftId}One of my drafts (to reopen it in the form)
PUT/api/communities/{communityId}/project-drafts/{draftId}Autosave / save — only the fields sent change
POST/api/communities/{communityId}/project-drafts/{draftId}/publishPublish — the draft becomes a project

Auth: Bearer JWT required.

Parameters

NameInRequiredTypeDescription
communityIdpathyesstring (uuid)—

Responses

StatusDescriptionBody
200{ success, data: ProjectDraftSummary[] } — a summary per draft; open one with GET /draftIdobject

Auth: Bearer JWT required.

Parameters

NameInRequiredTypeDescription
communityIdpathyesstring (uuid)—

Request body — application/json

Type: ProjectDraftSaveForm

Responses

StatusDescriptionBody
201data is the ProjectDraft (revision 1)—
400PROJECT_DRAFT_INVALID — a field of the wrong type—
403Missing permission, RESTRICTION_BLOCKED, FEATURE_NOT_AVAILABLE, or storage quota exceeded—
409PROJECT_DRAFT_LIMIT — already 20 drafts—
413PROJECT_DRAFT_TOO_LARGE—

Auth: Bearer JWT required.

Parameters

NameInRequiredTypeDescription
communityIdpathyesstring (uuid)—
draftIdpathyesstring (uuid)—

Responses

StatusDescriptionBody
200Deleted—
404PROJECT_DRAFT_NOT_FOUND—

Auth: Bearer JWT required.

Parameters

NameInRequiredTypeDescription
communityIdpathyesstring (uuid)—
draftIdpathyesstring (uuid)—

Responses

StatusDescriptionBody
200data is the ProjectDraft—
404PROJECT_DRAFT_NOT_FOUND — missing—

Auth: Bearer JWT required.

Parameters

NameInRequiredTypeDescription
communityIdpathyesstring (uuid)—
draftIdpathyesstring (uuid)—

Request body — application/json

Type: ProjectDraftSaveForm

Responses

StatusDescriptionBody
200data is the ProjectDraft, revision + 1—
400PROJECT_DRAFT_INVALID—
404PROJECT_DRAFT_NOT_FOUND—
409PROJECT_DRAFT_CONFLICT — revision is stale; the body carries the current revision—
413PROJECT_DRAFT_TOO_LARGE—

The body is optional and is saved first, exactly like PUT (so «نشر» can carry the last unsaved changes in the same request), then the draft is published and deleted. notifyMembers here overrides the value the draft stored.

Auth: Bearer JWT required.

Parameters

NameInRequiredTypeDescription
communityIdpathyesstring (uuid)—
draftIdpathyesstring (uuid)—

Request body — application/json

Type: ProjectDraftSaveForm

Responses

StatusDescriptionBody
201Published; data is the Project (its id is the draft's id)—
400PROJECT_DRAFT_INCOMPLETE with missing, PROJECT_DRAFT_INVALID, or the create endpoint's own checks (dates, prices, TOO_MANY_PROJECT_TYPES, PROJECT_OWNER_NOT_MEMBER)—
403Missing permission, RESTRICTION_BLOCKED, PROJECT_OWNER_ASSIGN_FORBIDDEN, FEATURE_NOT_AVAILABLE—
404PROJECT_DRAFT_NOT_FOUND—
409PROJECT_DRAFT_ALREADY_PUBLISHED with projectId, or PROJECT_DRAFT_CONFLICT—