> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wellapp.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get All Memberships

> Retrieve memberships with optional filtering by person

## Filtering & sorting on related objects

Filter and sort on a **related (included) object** by nesting into the relationship — the same relationships you pass to `include`.

* **To-one** relations nest directly: `{ "issuer": { "name": { "_eq": "Acme" } } }`, and sort by a dot-path: `"orderBy": { "field": "issuer.name", "direction": "asc" }`.
* **To-many** relations must be quantified with `_some`, `_every`, or `_none`: `{ "items": { "_some": { "quantity": { "_gt": 1 } } } }`. They are **not** directly sortable (a to-many sort needs an aggregate proxy).
* **Composite** `composite_*` columns are virtual — filter and sort on their underlying source fields, not on the composite.

Workspace row-level security applies at every hop, so a related-object filter never widens your tenant scope. Full operator set, deep-nesting rules, and pagination notes: [Filtering & sorting](/api-reference/filtering-and-sorting).

This resource's related objects (the ones you can `include`) and how to filter or sort on each:

| Relationship | Cardinality        | Filter on a field                                 | Sort by a field                     |
| ------------ | ------------------ | ------------------------------------------------- | ----------------------------------- |
| `person`     | to-one (people)    | `{ "person": { "full_name": { "_eq": … } } }`     | `"field": "person.full_name"` ✅     |
| `workspace`  | to-one (workspace) | `{ "workspace": { "name": { "_eq": … } } }`       | `"field": "workspace.name"` ✅       |
| `invited_by` | to-one (people)    | `{ "invited_by": { "full_name": { "_eq": … } } }` | `"field": "invited_by.full_name"` ✅ |

Replace `field_name` with any field of the related object. See its object-reference page for the full field list.

**Filter by a to-one relation** (and sort by it):

```json theme={null}
{
  "root": "memberships",
  "whereClause": { "person": { "full_name": { "_ilike": "%acme%" } } },
  "orderBy": { "field": "person.full_name", "direction": "asc" }
}
```


## OpenAPI

````yaml GET /v1/memberships
openapi: 3.1.0
info:
  title: Well Document API
  version: 1.0.0
  description: API for uploading and managing financial documents in the Well platform
servers:
  - url: https://api.wellapp.ai
security: []
paths:
  /v1/memberships:
    get:
      summary: Get memberships
      description: Retrieve memberships with optional filtering by person
      parameters:
        - $ref: '#/components/parameters/AuthorizationHeader'
        - name: filter[person]
          in: query
          required: false
          schema:
            type: string
            format: uuid
          description: Filter memberships by person ID
        - name: page[number]
          in: query
          required: false
          schema:
            type: integer
            default: 1
            minimum: 1
          description: Page number
        - name: page[size]
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 20
          description: Number of items per page
      responses:
        '200':
          description: Memberships retrieved successfully
          content:
            application/json:
              example:
                data:
                  - type: memberships
                    id: 550e8400-e29b-41d4-a716-446655440007
                    attributes:
                      role: member
                      created_at: '2024-01-20T10:30:00Z'
                      updated_at: '2024-01-20T10:30:00Z'
                    relationships:
                      workspace:
                        data:
                          type: workspace
                          id: 550e8400-e29b-41d4-a716-446655440003
                      person:
                        data:
                          type: people
                          id: 550e8400-e29b-41d4-a716-446655440000
                included:
                  - type: workspace
                    id: 550e8400-e29b-41d4-a716-446655440003
                    attributes:
                      name: Marketing Team Workspace
                      description: >-
                        Collaborative workspace for the marketing team to manage
                        campaigns and content
                      avatar_color: '#FF5733'
                      external_workspace_id: mkt-workspace-001
                      auto_extract_enabled: false
                      created_at: '2024-01-05T08:00:00Z'
                      updated_at: '2024-01-18T12:15:00Z'
                  - type: people
                    id: 550e8400-e29b-41d4-a716-446655440000
                    attributes:
                      first_name: Sarah
                      last_name: Johnson
                      full_name: Sarah Johnson
                      created_at: '2024-01-10T09:00:00Z'
                      updated_at: '2024-01-10T09:00:00Z'
                meta:
                  total: 1
                  page: 1
                  limit: 20
                  total_pages: 1
              schema:
                $ref: '#/components/schemas/MembershipListResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
components:
  parameters:
    AuthorizationHeader:
      name: Authorization
      in: header
      required: true
      schema:
        type: string
      description: Bearer token for authentication
  schemas:
    MembershipListResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/MembershipResource'
        meta:
          type: object
          properties:
            pagination:
              type: object
              properties:
                page:
                  type: integer
                size:
                  type: integer
                total:
                  type: integer
                total_pages:
                  type: integer
    BadRequestError:
      type: object
      properties:
        code:
          type: string
          example: SCHEMA_VALIDATION_ERROR
          description: Error code identifier
        status:
          type: integer
          example: 400
          description: HTTP status code
        title:
          type: string
          example: Validation Error
          description: Error title
        message:
          type: string
          example: The request is invalid
          description: Detailed error message
        details:
          type: array
          items:
            type: object
            properties:
              instancePath:
                type: string
                description: Path to the invalid field in the request
              schemaPath:
                type: string
                description: Path to the validation rule in the schema
              keyword:
                type: string
                description: Validation keyword that failed
              params:
                type: object
                description: Parameters related to the validation failure
              message:
                type: string
                description: Human-readable validation error message
          description: Array of detailed validation errors
        meta:
          type: object
          properties:
            log_id:
              type: string
              format: uuid
              example: 65c669d4-679c-4a8b-b8c0-fbe37699bb5b
              description: Unique identifier for tracking this error in logs
          required:
            - log_id
      required:
        - code
        - status
        - title
        - message
        - meta
    UnauthorizedError:
      type: object
      properties:
        code:
          type: string
          example: UNAUTHORIZED
          description: Error code identifier
        status:
          type: integer
          example: 401
          description: HTTP status code
        title:
          type: string
          example: Unauthorized
          description: Error title
        message:
          type: string
          example: You are not authorized to access this resource
          description: Detailed error message
        meta:
          type: object
          properties:
            log_id:
              type: string
              format: uuid
              example: 65c669d4-679c-4a8b-b8c0-fbe37699bb5b
              description: Unique identifier for tracking this error in logs
          required:
            - log_id
      required:
        - code
        - status
        - title
        - message
        - meta
    MembershipResource:
      type: object
      properties:
        type:
          type: string
          const: membership
        id:
          type: string
          format: uuid
        attributes:
          $ref: '#/components/schemas/MembershipAttributes'
        relationships:
          $ref: '#/components/schemas/MembershipRelationships'
    MembershipAttributes:
      type: object
      properties:
        role:
          type: string
        firebase_id:
          type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    MembershipRelationships:
      type: object
      properties:
        workspace:
          type: object
          properties:
            data:
              type: object
              properties:
                type:
                  type: string
                id:
                  type: string
        person:
          type: object
          properties:
            data:
              type: object
              properties:
                type:
                  type: string
                id:
                  type: string

````