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

# Create Note

> Creates a new note attached to an event, policy, or insured.

**Required permission:** Permission depends on entity type:
- `events` → `claim.notes:update`
- `policies` → `policy.notes:update`
- `insureds` → `insured.notes:update`

**Privileged notes:** If `isPrivileged` is true, the API key must also have `privileged_notes:read` permission.




## OpenAPI

````yaml /openapi/generated-external-api.yaml post /api/external/companies/{companyId}/{entityType}/{entityId}/notes
openapi: 3.0.3
info:
  title: AI Insurance External API
  description: External API for AI Insurance platform
  version: 1.0.0
  contact:
    email: support@aiinsurance.io
servers:
  - url: https://app.aiinsurance.io
    description: Production
security:
  - ApiKeyAuth: []
paths:
  /api/external/companies/{companyId}/{entityType}/{entityId}/notes:
    post:
      tags:
        - Notes
      summary: Create Note
      description: >
        Creates a new note attached to an event, policy, or insured.


        **Required permission:** Permission depends on entity type:

        - `events` → `claim.notes:update`

        - `policies` → `policy.notes:update`

        - `insureds` → `insured.notes:update`


        **Privileged notes:** If `isPrivileged` is true, the API key must also
        have `privileged_notes:read` permission.
      operationId: createNote
      parameters:
        - $ref: '#/components/parameters/companyId'
        - $ref: '#/components/parameters/entityType'
        - $ref: '#/components/parameters/entityId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateNoteRequest'
            examples:
              basicNote:
                summary: Basic note
                value:
                  text: >-
                    Adjuster contacted claimant and scheduled inspection for
                    Monday.
              privilegedNote:
                summary: Privileged note (restricted visibility)
                value:
                  text: Internal investigation notes - do not share with claimant.
                  isPrivileged: true
              withCustomTimestamp:
                summary: Note with custom creation timestamp
                value:
                  text: Historical note imported from legacy system.
                  createdAt: '2024-06-15T14:30:00.000Z'
              withAuthorId:
                summary: Note with specific author (existing user)
                value:
                  text: Note created on behalf of another user.
                  authorId: google-oauth2|123456789
              withAuthorName:
                summary: Note with external author name (no linked user)
                value:
                  text: Historical note imported from legacy system.
                  authorName: Jane Doe (External)
                  createdAt: '2024-06-15T14:30:00.000Z'
      responses:
        '201':
          description: Note created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    description: The ID of the created note
              examples:
                success:
                  summary: Note created
                  value:
                    id: 550e8400-e29b-41d4-a716-446655440003
        '400':
          description: Bad Request - Validation error or entity not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                missingRequiredField:
                  summary: Missing required field
                  value:
                    error:
                      code: KeyMissing
                      message: 'text: Required keys were missing'
                      details:
                        - field: text
                          message: Required keys were missing
                invalidEntityType:
                  summary: Invalid entity type
                  value:
                    error:
                      code: INVALID_ENTITY_TYPE
                      message: 'entityType must be one of: events, policies, insureds'
                entityNotFound:
                  summary: Entity not found
                  value:
                    error:
                      code: NOT_FOUND
                      message: Entity not found
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    companyId:
      name: companyId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: Company identifier
    entityType:
      name: entityType
      in: path
      required: true
      schema:
        $ref: '#/components/schemas/NoteEntityType'
      description: The type of entity (events, policies, or insureds)
    entityId:
      name: entityId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: The ID of the entity
  schemas:
    CreateNoteRequest:
      type: object
      required:
        - text
      properties:
        text:
          type: string
          description: The note content
        isPrivileged:
          type: boolean
          description: >-
            If true, the note is only visible to users with
            privileged_notes:read permission
          default: false
        createdAt:
          type: string
          format: date-time
          description: >-
            Optional creation timestamp (ISO 8601). Defaults to current time if
            not provided.
        authorId:
          type: string
          description: >-
            ID of an existing user to set as the note author. Mutually exclusive
            with authorName.
        authorName:
          type: string
          description: >-
            Free-text author name for external authors not in the system.
            Mutually exclusive with authorId.
    ErrorResponse:
      type: object
      description: Standard error response for all external API endpoints
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Machine-readable error code
              example: VALIDATION_ERROR
            message:
              type: string
              description: Human-readable error message
              example: 'submissionId: Required field is missing'
            details:
              type: array
              description: Additional details for validation errors (field-level errors)
              items:
                type: object
                properties:
                  field:
                    type: string
                    description: The field that caused the error
                    example: submissionId
                  message:
                    type: string
                    description: Description of the field error
                    example: Required field is missing
    NoteEntityType:
      type: string
      description: The type of entity the note is attached to
      enum:
        - events
        - policies
        - insureds
  responses:
    Unauthorized:
      description: Unauthorized - Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missingApiKey:
              summary: Missing API key
              value:
                error:
                  code: UNAUTHORIZED
                  message: Authorization header is required
            bearerTokenNotAllowed:
              summary: Bearer token used instead of API key
              value:
                error:
                  code: UNAUTHORIZED
                  message: External API endpoints require API key authentication
    Forbidden:
      description: Forbidden - Insufficient permissions
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            insufficientPermissions:
              summary: Insufficient permissions
              value:
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
    InternalServerError:
      description: Internal Server Error - Unexpected error occurred
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            internalError:
              summary: Unexpected server error
              value:
                error:
                  code: INTERNAL_ERROR
                  message: An unexpected error occurred. Please try again later.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        API key authentication. Include your API key in the Authorization
        header.

````