FriendChise Docs

Tasks

API reference for creating, reading, and updating tasks (recipes, procedures, checklists)

Tasks are the core unit in FriendChise. A task can represent a recipe, a preparation procedure, a daily checklist item, or any operational step a franchise team needs to track.

All task endpoints are scoped to an organization (orgId).

Create task

POST /api/orgs/[orgId]/tasks

Creates a new task in the organization.

Authentication

Requires MANAGE_TASKS permission in the org.

Path parameters

ParamDescription
orgIdOrganization ID

Request body

Accepts JSON or FormData.

FieldTypeRequiredConstraintsDescription
titlestringYes1–200 charactersTask name. Must be unique within the org after trimming leading/trailing whitespace and lowercasing (lower(btrim(name))).
colorstringNoHex color #rrggbbDisplay color. Defaults to #6366f1.
descriptionstringNoMax 5000 charactersRecipe notes, steps, or procedure details.
durationMinintegerYes1–1440 (24 hours)Estimated time to complete, in minutes.
preferredStartTimeMinintegerNo0–1439Preferred start time as minutes since midnight.
peopleRequiredintegerNo1–50Number of people needed. Defaults to 1.
minWaitDaysintegerNo¹0–3650Minimum days before the task can repeat.
maxWaitDaysintegerNo¹0–3650Maximum days before the task should repeat.
imageStoragePathstringNoMax 2048 charactersStorage path for a task image (obtained from the image upload endpoint).
roleIdsstring[]NoIDs of roles that can be assigned this task. All IDs must belong to the org.

¹ At least one of minWaitDays or maxWaitDays must be provided. If both are provided, minWaitDays must not exceed maxWaitDays.

Example request

{
  "title": "Prepare doughnut glaze",
  "color": "#f59e0b",
  "description": "Mix icing sugar, whole milk, and vanilla extract until smooth. Consistency should coat the back of a spoon.",
  "durationMin": 10,
  "preferredStartTimeMin": 360,
  "peopleRequired": 1,
  "minWaitDays": 0,
  "maxWaitDays": 1
}

Example response

{ "taskId": "tsk_01abc" }

HTTP status: 201 Created

Errors

StatusReason
400Validation error (see errors field for per-field details)
400Invalid role IDs — one or more roleIds do not belong to the org
401Not authenticated
403User lacks MANAGE_TASKS permission
409A task with this title already exists in the org after trimming leading/trailing whitespace and lowercasing
429Demo account task limit reached
500Unexpected server error

Get task

GET /api/orgs/[orgId]/tasks/[taskId]

Returns a single task by ID.

Authentication

Requires org membership.

Path parameters

ParamDescription
orgIdOrganization ID
taskIdTask ID

Response

{
  "task": {
    "id": "tsk_01abc",
    "name": "Prepare doughnut glaze",
    "color": "#f59e0b",
    "description": "Mix icing sugar...",
    "durationMin": 10,
    "preferredStartTimeMin": 360,
    "peopleRequired": 1,
    "minWaitDays": 0,
    "maxWaitDays": 1,
    "imageUrl": "orgs/abc/tasks/xyz/photo.jpg",
    "imageSignedUrl": "https://...",
    "isOwner": true
  }
}

imageSignedUrl is a short-lived signed URL for the task image, or null if no image is set. isOwner is true if the task belongs directly to this org (vs. inherited from a parent franchise org).

imageUrl is the stored path for the image, not a browser-accessible URL. imageSignedUrl is the derived short-lived URL used by clients to display that stored image.

Errors

StatusReason
401Not authenticated
403Not a member of the org
404Task not found or not accessible from this org

Update task

PATCH /api/orgs/[orgId]/tasks/[taskId]

Partially updates a task. Only the fields you include are changed.

Authentication

Requires org membership and authorization in the task-owning organization. The caller must either be the parent organization owner or have MANAGE_TASKS in the task-owning org; a plain membership is not sufficient. | mode | list | available | shared | shared | Task view mode | | limit | integer | 30 | Items per page |

Path parameters

ParamDescription
orgIdOrganization ID
taskIdTask ID

Request body

All fields are optional. At least one field must be included.

FieldTypeConstraintsDescription
titlestring1–200 charactersNew task name. Must remain unique within the org after trimming leading/trailing whitespace and lowercasing (lower(btrim(name))).
colorstringHex color #rrggbbNew display color
descriptionstring | nullMax 5000 characters, or null to clearUpdated notes or procedure
durationMininteger1–1440New duration in minutes
preferredStartTimeMininteger | null0–1439, or null to clearNew preferred start time
peopleRequiredinteger1–50New people count
minWaitDaysinteger | null0–3650, or null to clearNew minimum repeat interval
maxWaitDaysinteger | null0–3650, or null to clearNew maximum repeat interval
tagIdsstring[]Replace all tags on the task
roleIdsstring[]Replace all role eligibilities
toolPathsstring[]Replace linked tool paths; must be sent with toolLabels
toolLabels(string | null)[]Same length as toolPathsDisplay labels for linked tools
imageStoragePathstringNon-empty, max 2048 charactersNew image storage path

Response

{ "ok": true }

Errors

StatusReason
400No fields provided, or validation failure
400toolLabels provided without toolPaths
401Not authenticated
403Not a member, or task is outside this franchise scope
404Task not found
409The updated title collides with another task in the org after trimming leading/trailing whitespace and lowercasing

List tasks (paginated — cursor-based)

GET /api/orgs/[orgId]/tasks/paginated

Fetches tasks in pages using cursor-based pagination. Used by the task table for infinite scroll.

Authentication

Requires org membership.

Query parameters

ParamTypeDefaultDescription
modelist | available | sharedsharedTask view mode
cursorstringID of the last item from the previous page
limitinteger30Items per page
sortstringname-ascAccepted values: name-asc, name-desc, duration-asc, duration-desc, people-asc, people-desc. Invalid values fall back to name-asc.
roleIdstringFilter to tasks eligible for a specific role
tagIdstringFilter to tasks with a specific tag
searchstringText search across task names

Response

{
  "tasks": [ { "id": "...", "name": "...", "imageSignedUrl": null, ... } ],
  "nextCursor": "tsk_last_id_on_page"
}

nextCursor is null when there are no more pages.


List tasks (simple)

GET /api/orgs/[orgId]/tasks/simple

Returns a lightweight, unpaginated list of tasks for use in pickers and dropdowns. Does not include image URLs or full field sets.

Authentication

Requires org membership.

Response

{
  "tasks": [
    { "id": "tsk_01abc", "name": "Prepare doughnut glaze" }
  ]
}