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

# Get history

> Get change history for a company. Returns audit trail of modifications with user attribution.



## OpenAPI

````yaml /api-reference/openapi.json get /companies/{companyId}/history
openapi: 3.1.1
info:
  description: >-
    The public Modem API. Authenticate with an organization API key:
    `Authorization: Bearer modem_…`.
  title: Modem API
  version: 1.0.0
servers:
  - description: Production
    url: https://api.modem.dev/v1
security:
  - bearerAuth: []
paths:
  /companies/{companyId}/history:
    get:
      tags:
        - Companies
      summary: Get history
      description: >-
        Get change history for a company. Returns audit trail of modifications
        with user attribution.
      operationId: companies.getHistory
      parameters:
        - in: path
          name: companyId
          required: true
          schema:
            pattern: ^\d+$
            type: string
        - allowEmptyValue: true
          allowReserved: true
          explode: true
          in: query
          name: changedByFilter
          required: false
          schema:
            description: >-
              Filter by actor type. Defaults to user and agent changes (excludes
              system).
            items:
              description: >-
                Actor type that initiated the change: system
                (internal/cascading), agent (AI), or user (manual).
              enum:
                - agent
                - system
                - user
              title: Changed By Type
              type: string
            title: Changed By Filter
            type: array
          style: deepObject
        - allowEmptyValue: true
          allowReserved: true
          in: query
          name: limit
          required: false
          schema:
            default: 20
            description: Maximum number of history records to return (default 20, max 50).
            exclusiveMinimum: 0
            maximum: 50
            title: Limit
            type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  history:
                    items:
                      properties:
                        changedAt:
                          format: date-time
                          type: string
                        changedBy:
                          description: >-
                            Actor type that initiated the change: system
                            (internal/cascading), agent (AI), or user (manual).
                          enum:
                            - agent
                            - system
                            - user
                          title: Changed By Type
                          type: string
                        changes:
                          additionalProperties: {}
                          propertyNames:
                            type: string
                          type: object
                        id:
                          anyOf:
                            - format: uuid
                              type: string
                            - format: uuid
                              type: string
                        operation:
                          description: >-
                            Type of database operation that triggered the
                            history record.
                          enum:
                            - DELETE
                            - INSERT
                            - UPDATE
                          title: Topic History Operation
                          type: string
                        previousValues:
                          anyOf:
                            - additionalProperties: {}
                              propertyNames:
                                type: string
                              type: object
                            - type: 'null'
                        user:
                          anyOf:
                            - properties:
                                id:
                                  anyOf:
                                    - type: string
                                    - type: string
                                image:
                                  anyOf:
                                    - type: string
                                    - type: 'null'
                                  description: Optional URL to the user avatar image.
                                  title: Image
                                name:
                                  description: Human-readable name of the user.
                                  title: Name
                                  type: string
                              required:
                                - id
                                - image
                                - name
                              type: object
                            - type: 'null'
                      required:
                        - changedBy
                        - changes
                        - id
                        - operation
                        - previousValues
                        - user
                      type: object
                    type: array
                  mergedInto:
                    anyOf:
                      - properties:
                          id:
                            type: string
                          mergedAt:
                            format: date-time
                            type: string
                          targetCompany:
                            anyOf:
                              - properties:
                                  id:
                                    type: string
                                  name:
                                    type: string
                                required:
                                  - id
                                  - name
                                type: object
                              - type: 'null'
                          user:
                            anyOf:
                              - properties:
                                  id:
                                    anyOf:
                                      - type: string
                                      - type: string
                                  image:
                                    anyOf:
                                      - type: string
                                      - type: 'null'
                                    description: Optional URL to the user avatar image.
                                    title: Image
                                  name:
                                    description: Human-readable name of the user.
                                    title: Name
                                    type: string
                                required:
                                  - id
                                  - image
                                  - name
                                type: object
                              - type: 'null'
                        required:
                          - id
                          - targetCompany
                          - user
                        type: object
                      - type: 'null'
                  merges:
                    items:
                      properties:
                        id:
                          type: string
                        mergedAt:
                          format: date-time
                          type: string
                        sourceCompanies:
                          items:
                            properties:
                              id:
                                type: string
                              name:
                                type: string
                            required:
                              - id
                              - name
                            type: object
                          type: array
                        user:
                          anyOf:
                            - properties:
                                id:
                                  anyOf:
                                    - type: string
                                    - type: string
                                image:
                                  anyOf:
                                    - type: string
                                    - type: 'null'
                                  description: Optional URL to the user avatar image.
                                  title: Image
                                name:
                                  description: Human-readable name of the user.
                                  title: Name
                                  type: string
                              required:
                                - id
                                - image
                                - name
                              type: object
                            - type: 'null'
                      required:
                        - id
                        - sourceCompanies
                        - user
                      type: object
                    type: array
                  totalCount:
                    type: number
                required:
                  - history
                  - mergedInto
                  - merges
                  - totalCount
                type: object
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Invalid request (validation failed).
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Missing or invalid API key.
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: The API key does not have access to this resource.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: The requested resource was not found.
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Rate limit exceeded.
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Internal server error.
components:
  schemas:
    Error:
      properties:
        code:
          description: Machine-readable error code, e.g. `NOT_FOUND`.
          examples:
            - NOT_FOUND
          type: string
        data:
          description: Optional structured error details.
        defined:
          description: True if the error was declared in the procedure contract.
          type: boolean
        message:
          description: Human-readable error message.
          type: string
        status:
          description: HTTP status code.
          examples:
            - 404
          type: integer
      required:
        - code
        - defined
        - message
        - status
      type: object
  securitySchemes:
    bearerAuth:
      description: Organization API key (`modem_…`).
      scheme: bearer
      type: http

````