FriendChise Docs

Organizations

Endpoints for memberships, announcements, roster, and org ownership checks

All organization endpoints are scoped to orgId. The caller must be a member or have a relevant permission.

List memberships

GET /api/orgs/[orgId]/memberships

Returns a paginated list of members in the organization. Supports filtering by role, search, exclusion lists, and bot exclusion.

Authentication

Requires org membership.

Query parameters

ParamTypeDefaultMaxDescription
pageinteger1Page number
pageSizeinteger1050Items per page
searchstringFilter by user name or email
roleIdstringFilter to members with a specific role
excludeIdsstring[]Member IDs to exclude (repeatable: ?excludeIds=a&excludeIds=b)
excludeBotsbooleanfalseWhen true, exclude bot/system members

Response

{
  "memberships": [
    {
      "id": "mem_01abc",
      "userId": "usr_01abc",
      "botName": null,
      "status": "ACTIVE",
      "joinedAt": "2026-01-15T09:00:00.000Z",
      "workingDays": ["MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY"],
      "user": {
        "id": "usr_01abc",
        "name": "Alex Chen",
        "email": "alex@example.com",
        "image": null
      },
      "memberRoles": [
        { "role": { "id": "role_01", "name": "Baker", "color": "#f59e0b" } }
      ],
      "name": "Alex Chen",
      "description": "alex@example.com"
    }
  ],
  "totalCount": 8,
  "totalPages": 1,
  "page": 1,
  "pageSize": 10,
  "hasMore": false
}

List announcements

GET /api/orgs/[orgId]/announcements

Returns paginated announcements for the organization, ordered by newest or oldest.

Authentication

Requires org membership.

Query parameters

ParamTypeDefaultMaxDescription
pageinteger1Page number
pageSizeinteger1050Items per page
ordernewest | oldestnewestSort direction

Response

{
  "announcements": [
    {
      "id": "ann_01abc",
      "title": "New opening hours for the holiday weekend",
      "body": "...",
      "createdAt": "2026-08-10T12:00:00.000Z"
    }
  ],
  "page": 1,
  "totalPages": 2,
  "pageSize": 10,
  "order": "newest"
}

Get roster entries

GET /api/orgs/[orgId]/roster-entries

Returns roster entries for one or more week-start dates. Used by the roster page to load the visible schedule window incrementally.

Authentication

Requires org membership.

Query parameters

ParamTypeRequiredDescription
weeksstringYesComma-separated ISO 8601 week-start dates (e.g. 2026-08-10,2026-08-17). Maximum 20 weeks per request.

Example request

GET /api/orgs/org_01abc/roster-entries?weeks=2026-08-10,2026-08-17

Response

Array of roster entry objects for the requested weeks.

[
  {
    "id": "entry_01",
    "orgId": "org_01abc",
    "membershipId": "mem_01abc",
    "weekStart": "2026-08-10T00:00:00.000Z",
    "data": { ... }
  }
]

Returns an empty array if weeks is missing or none of the provided dates are valid ISO dates.


Check parent owner status

GET /api/orgs/[orgId]/is-parent-owner

Checks whether the current user is the franchisor owner of this org or its parent. Used by the app shell to show or hide franchisor-only navigation.

Authentication

Requires a signed-in user (session cookie or bearer token).

Response

{
  "isParentOwner": true,
  "parentOrgId": null
}
FieldDescription
isParentOwnertrue if the current user owns the root (parent) franchise org
parentOrgIdID of the parent org if the current user owns it but is viewing a child org; null otherwise

Errors

StatusReason
401Not authenticated