API Reference
Organizations & Members

Organizations & Members

Organizations are sub-groups within a workspace. Each workspace can contain multiple organizations — for example, separate brands, teams, or clients. Members belong to a specific organization and their access is scoped to it.

All endpoints on this page require a valid JWT token. For server-to-server access, use API keys instead — see Authentication.

Base URL: https://pharlo.io
Auth: Authorization: Bearer <jwt_token>


Roles

RoleCan manage membersCan change rolesCan remove membersCan invite
ownerYesYesYesYes
adminYesMembers onlyYesYes
memberNoNoNoNo

The owner role is assigned to the organization creator and cannot be transferred via API — only one owner per organization is allowed.

To invite a new user, see Invitations.


Endpoints

MethodPathRole requiredDescriptionStatus
GET/api/v1/auth/organizationsAnyList user's organizations200
GET/api/v1/auth/organizations/{id}AnyOrganization detail200
GET/api/v1/auth/organizations/{id}/membersAnyList members200
PATCH/api/v1/auth/organizations/{orgId}/members/{memberId}/roleowner / adminChange member role200
DELETE/api/v1/auth/organizations/{orgId}/members/{memberId}owner / adminRemove member204

GET /api/v1/auth/organizations

Returns all organizations the authenticated user belongs to, along with the user's role in each.

Example request

curl https://pharlo.io/api/v1/auth/organizations \
  -H "Authorization: Bearer $JWT_TOKEN"

Response 200 OK

FieldTypeDescription
itemsarrayList of organizations the user belongs to
items[].idUUIDOrganization identifier
items[].namestringDisplay name of the organization
items[].slugstringURL-friendly identifier
items[].rolestringThe current user's role in this organization: owner, admin, or member
items[].memberCountintegerTotal number of members
{
  "items": [
    {
      "id": "018e1f3a-7c2b-7000-8f4d-1a2b3c4d5e6f",
      "name": "Acme Corp",
      "slug": "acme-corp",
      "role": "owner",
      "memberCount": 4
    }
  ]
}

GET /api/v1/auth/organizations/{id}

Returns full details of a specific organization. The authenticated user must be a member of it.

Path parameters

ParameterTypeDescription
idUUIDOrganization identifier

Example request

curl https://pharlo.io/api/v1/auth/organizations/018e1f3a-7c2b-7000-8f4d-1a2b3c4d5e6f \
  -H "Authorization: Bearer $JWT_TOKEN"

Response 200 OK

FieldTypeDescription
idUUIDOrganization identifier
namestringDisplay name
slugstringURL-friendly identifier
ownerobjectUser object of the organization owner
owner.idUUIDOwner's user ID
owner.namestringOwner's display name
owner.emailstringOwner's email address
createdAtISO 8601When the organization was created
{
  "id": "018e1f3a-7c2b-7000-8f4d-1a2b3c4d5e6f",
  "name": "Acme Corp",
  "slug": "acme-corp",
  "owner": {
    "id": "018e1f3a-9d3c-7000-af5e-2b3c4d5e6f7a",
    "name": "Alice",
    "email": "alice@example.com"
  },
  "createdAt": "2026-01-01T00:00:00Z"
}

GET /api/v1/auth/organizations/{id}/members

Returns a list of all members in the organization. Available to any organization member.

Path parameters

ParameterTypeDescription
idUUIDOrganization identifier

Example request

curl https://pharlo.io/api/v1/auth/organizations/018e1f3a-7c2b-7000-8f4d-1a2b3c4d5e6f/members \
  -H "Authorization: Bearer $JWT_TOKEN"

Response 200 OK

FieldTypeDescription
itemsarrayList of members
items[].idUUIDMember record identifier (distinct from the user's ID)
items[].userobjectUser details
items[].user.idUUIDUser identifier
items[].user.namestringDisplay name
items[].user.emailstringEmail address
items[].rolestringOrganization role: owner, admin, or member
items[].joinedAtISO 8601When the user joined the organization
{
  "items": [
    {
      "id": "018e2a4b-1c3d-7000-9e5f-3c4d5e6f7a8b",
      "user": {
        "id": "018e1f3a-9d3c-7000-af5e-2b3c4d5e6f7a",
        "name": "Alice",
        "email": "alice@example.com"
      },
      "role": "owner",
      "joinedAt": "2026-01-01T00:00:00Z"
    },
    {
      "id": "018e3b5c-2d4e-7000-af6a-4d5e6f7a8b9c",
      "user": {
        "id": "018e3b5c-8e4f-7000-bf7b-5e6f7a8b9c0d",
        "name": "Bob",
        "email": "bob@example.com"
      },
      "role": "member",
      "joinedAt": "2026-02-15T00:00:00Z"
    }
  ]
}

PATCH /api/v1/auth/organizations/{orgId}/members/{memberId}/role

Changes a member's role within the organization. Requires owner or admin role.

⚠️

An admin can only promote or demote member-level users. Only the owner can change an admin's role. The owner role itself cannot be reassigned via API.

Path parameters

ParameterTypeDescription
orgIdUUIDOrganization identifier
memberIdUUIDMember record identifier (from the members list, not the user's ID)

Request body

FieldTypeRequiredDescription
rolestringYesNew role to assign: admin or member

Example request

curl -X PATCH \
  https://pharlo.io/api/v1/auth/organizations/018e1f3a-7c2b-7000-8f4d-1a2b3c4d5e6f/members/018e3b5c-2d4e-7000-af6a-4d5e6f7a8b9c/role \
  -H "Authorization: Bearer $JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"role": "admin"}'

Response 200 OK

{
  "id": "018e3b5c-2d4e-7000-af6a-4d5e6f7a8b9c",
  "role": "admin"
}

DELETE /api/v1/auth/organizations/{orgId}/members/{memberId}

Removes a member from the organization. Requires owner or admin role.

⚠️

The owner cannot be removed. Removing a member revokes their access immediately — they will no longer see the organization or its resources.

Path parameters

ParameterTypeDescription
orgIdUUIDOrganization identifier
memberIdUUIDMember record identifier (from the members list, not the user's ID)

Example request

curl -X DELETE \
  https://pharlo.io/api/v1/auth/organizations/018e1f3a-7c2b-7000-8f4d-1a2b3c4d5e6f/members/018e3b5c-2d4e-7000-af6a-4d5e6f7a8b9c \
  -H "Authorization: Bearer $JWT_TOKEN"

Response 204 No Content

No response body. A 204 confirms the member was removed successfully.


Error responses

StatusReason
401Missing or expired JWT token
403Insufficient role — admin or owner required for this action
404Organization or member not found, or the authenticated user is not a member
409Cannot remove the owner, or cannot change the owner role
{
  "error": "Access denied",
  "details": {}
}

See Error Handling for the full list of error codes.


See also