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

# List membership/role change history for an org

> **Beta** — the Audit log feature is in beta. Requests from organizations without it enabled receive `403 Forbidden`.



## OpenAPI

````yaml https://app.kosli.com/api/v2/openapi.json get /membership-audit-log/{org}
openapi: 3.1.0
info:
  title: Kosli API
  summary: The API for communicating with Kosli
  description: >

    # Authentication 


    When making requests against Kosli API, you can authenticate your requests
    using a bearer token. 

    Set the bearer token in the request Authorization header to a valid API
    key. 

    API Keys can be personal or for service accounts. Check the [service
    accounts
    documentation](https://docs.kosli.com/getting_started/service-accounts/) for
    details. 


    ## Curl example


    ```shell

    curl -H "Authorization: Bearer <<your-api-key>>"
    https://app.kosli.com/api/v2/environments/<<your-org-name>>

    ```
  version: '2.0'
servers:
  - url: https://app.kosli.com/api/v2
    description: EU
  - url: https://app.us.kosli.com/api/v2
    description: US
security:
  - HTTPBearer: []
paths:
  /membership-audit-log/{org}:
    get:
      tags:
        - Audit Log
      summary: List membership/role change history for an org
      description: >-
        **Beta** — the Audit log feature is in beta. Requests from organizations
        without it enabled receive `403 Forbidden`.
      operationId: list_audit_log
      parameters:
        - name: org
          in: path
          required: true
          schema:
            type: string
            title: Org
        - name: page
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            description: Page number
            default: 1
            title: Page
          description: Page number
        - name: per_page
          in: query
          required: false
          schema:
            type: integer
            maximum: 100
            minimum: 1
            description: Number of events per page
            default: 15
            title: Per Page
          description: Number of events per page
        - name: search
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Filter by affected user or actor (name substring)
            title: Search
          description: Filter by affected user or actor (name substring)
        - name: event_type
          in: query
          required: false
          schema:
            anyOf:
              - $ref: '#/components/schemas/AuditEventType'
              - type: 'null'
            description: 'Filter by event type: added, changed, or removed'
            title: Event Type
          description: 'Filter by event type: added, changed, or removed'
        - name: role
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            description: Filter by new role. Can be repeated.
            title: Role
          description: Filter by new role. Can be repeated.
        - name: source
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            description: Filter by source (app/scim/invitation/script). Repeatable.
            title: Source
          description: Filter by source (app/scim/invitation/script). Repeatable.
        - name: from_timestamp
          in: query
          required: false
          schema:
            anyOf:
              - type: number
              - type: 'null'
            description: Only events at or after this unix timestamp
            title: From Timestamp
          description: Only events at or after this unix timestamp
        - name: to_timestamp
          in: query
          required: false
          schema:
            anyOf:
              - type: number
              - type: 'null'
            description: Only events at or before this unix timestamp
            title: To Timestamp
          description: Only events at or before this unix timestamp
        - name: sort_by
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/AuditSortBy'
            description: Column to sort by
            default: when
          description: Column to sort by
        - name: sort_dir
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/SortDir'
            description: Sort direction
            default: desc
          description: Sort direction
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuditLogListResponse'
        '403':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/fastapi_app__errors__ForbiddenResponse___locals___ForbiddenResponseModel__17
          description: Forbidden
      security:
        - HTTPBearer: []
        - HTTPBasic: []
components:
  schemas:
    AuditEventType:
      type: string
      enum:
        - added
        - changed
        - removed
      title: AuditEventType
    AuditSortBy:
      type: string
      enum:
        - when
        - user
        - role
        - changed_by
        - source
      title: AuditSortBy
    SortDir:
      type: string
      enum:
        - asc
        - desc
      title: SortDir
    AuditLogListResponse:
      properties:
        _links:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Links
        page:
          type: integer
          title: Page
        per_page:
          type: integer
          title: Per Page
        total_pages:
          type: integer
          title: Total Pages
        total_count:
          type: integer
          title: Total Count
        events:
          items:
            $ref: '#/components/schemas/AuditLogListItemResponse'
          type: array
          title: Events
      additionalProperties: false
      type: object
      required:
        - page
        - per_page
        - total_pages
        - total_count
        - events
      title: AuditLogListResponse
    fastapi_app__errors__ForbiddenResponse___locals___ForbiddenResponseModel__17:
      properties:
        message:
          type: string
          title: Message
          description: Error message
        errors:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Errors
          description: Validation errors by field
      type: object
      required:
        - message
      title: ForbiddenResponseModel
      examples:
        - message: You don't have permission to access this resource
    AuditLogListItemResponse:
      properties:
        id:
          type: string
          title: Id
        user:
          type: string
          title: User
        changed_by:
          type: string
          title: Changed By
        role:
          type: string
          title: Role
        previous_role:
          type: string
          title: Previous Role
        source:
          type: string
          title: Source
        created_at:
          anyOf:
            - type: number
            - type: 'null'
          title: Created At
      type: object
      required:
        - id
        - user
        - changed_by
        - role
        - previous_role
        - source
      title: AuditLogListItemResponse
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````