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

# 메모리 생성

> 인증된 조직에서 고객과 에이전트 쌍에 메모리 fact 하나를 직접 추가합니다. 요청자가 `tier`를 선택하지만 ID, 상태, 보관 한도는 시스템이 관리합니다. 에이전트가 없으면 404 `AGENT_NOT_FOUND`를 반환합니다. 고객이 없거나 다른 조직에 속하면 404 `CUSTOMER_NOT_FOUND`를 반환합니다. 생성된 fact의 `status`는 `active`입니다. 과거 `observed_at` 때문에 보관 한도를 넘으면 생성 직후 `expired`가 될 수 있습니다. 쓰기 작업이 같은 고객과 에이전트 쌍을 잠그고 있으면 5초 후 409 `MEMORY_LOCKED`를 반환합니다.



## OpenAPI

````yaml /api-reference/v3/openapi.json post /memories
openapi: 3.1.0
info:
  title: vox.ai API
  description: >
    vox.ai API v3


    ### v3 공개 계약 규칙


    - 인증은 `Authorization: Bearer <token>` 헤더를 사용합니다. 조직 API 키를 Bearer 토큰으로
    전달합니다.

    - 요청과 응답 필드는 기본적으로 `snake_case`를 사용합니다.

    - `agent.data`는 에이전트 레지스트리와 호환되어야 하므로 `callSettings`, `toolIds`,
    `builtInTools`, `presetDynamicVariables` 같은 camelCase 필드를 유지합니다.

    - `_at`으로 끝나는 타임스탬프는 unix milliseconds입니다. 일부 입력값은 호환성을 위해 10~11자리 unix
    seconds도 허용하고 milliseconds로 정규화합니다.

    - 캠페인 통화 가능 시간은 분 단위 정수(`start_min` / `end_min`)를 사용합니다. 알림 스케줄은 `HH:MM`
    문자열(`start_time` / `end_time`)을 사용합니다.

    - 응답 객체 자신의 식별자는 `id`입니다. 다른 리소스를 참조하는 필드와 path parameter는 `agent_id`,
    `call_id`, `telephone_line_id`처럼 명시적인 이름을 사용합니다.

    - 실패 응답은 `{ "error": { "code", "message", "details" } }` 형태입니다. 가능한 경우
    `details.field`, `details.reason`, `details.allowed_values`를 함께 제공합니다.
  version: 3.0.0
servers:
  - url: https://client-api.tryvox.co/v3
    description: 운영
security: []
paths:
  /memories:
    post:
      tags:
        - Memories
      summary: 메모리 생성
      description: >-
        인증된 조직에서 고객과 에이전트 쌍에 메모리 fact 하나를 직접 추가합니다. 요청자가 `tier`를 선택하지만 ID, 상태,
        보관 한도는 시스템이 관리합니다. 에이전트가 없으면 404 `AGENT_NOT_FOUND`를 반환합니다. 고객이 없거나 다른
        조직에 속하면 404 `CUSTOMER_NOT_FOUND`를 반환합니다. 생성된 fact의 `status`는
        `active`입니다. 과거 `observed_at` 때문에 보관 한도를 넘으면 생성 직후 `expired`가 될 수 있습니다.
        쓰기 작업이 같은 고객과 에이전트 쌍을 잠그고 있으면 5초 후 409 `MEMORY_LOCKED`를 반환합니다.
      operationId: createMemory
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMemoryRequest'
        description: 생성할 메모리 fact입니다.
      responses:
        '201':
          description: 성공 응답
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateMemoryResponse'
        '400':
          description: 요청 검증 오류
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                validationError:
                  summary: 요청 검증 오류
                  value:
                    error:
                      code: VALIDATION_ERROR
                      message: Request validation failed.
                      details:
                        field: name
                        reason: must not be blank
        '401':
          description: 인증이 필요합니다.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  summary: Bearer 토큰 누락 또는 오류
                  value:
                    error:
                      code: UNAUTHORIZED
                      message: Authentication is required.
                      details: {}
        '403':
          description: 권한이 없습니다.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                forbidden:
                  summary: 권한이 없습니다.
                  value:
                    error:
                      code: FORBIDDEN
                      message: Permission denied.
                      details: {}
        '404':
          description: 리소스를 찾을 수 없습니다.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                notFound:
                  summary: 리소스를 찾을 수 없습니다.
                  value:
                    error:
                      code: RESOURCE_NOT_FOUND
                      message: Resource not found.
                      details:
                        resource: agent
        '409':
          description: 충돌이 발생했습니다.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                conflict:
                  summary: 상태 충돌이 발생했습니다.
                  value:
                    error:
                      code: CONFLICT
                      message: The requested operation conflicts with current state.
                      details:
                        current_status: draft
        '429':
          description: 요청 한도를 초과했습니다.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                rateLimited:
                  summary: 요청 한도를 초과했습니다.
                  value:
                    error:
                      code: RATE_LIMIT_EXCEEDED
                      message: Too many requests.
                      details:
                        limit: 5
                        window_seconds: 1
        '500':
          description: 서버 내부 오류가 발생했습니다.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                internalError:
                  summary: 서버 내부 오류가 발생했습니다.
                  value:
                    error:
                      code: INTERNAL_ERROR
                      message: Internal server error.
                      details: {}
        '503':
          description: 서비스를 일시적으로 사용할 수 없습니다.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                serviceUnavailable:
                  summary: 서비스를 일시적으로 사용할 수 없습니다.
                  value:
                    error:
                      code: SERVICE_UNAVAILABLE
                      message: Service temporarily unavailable.
                      details: {}
      security:
        - BearerAuth: []
components:
  schemas:
    CreateMemoryRequest:
      properties:
        customer_id:
          type: string
          format: uuid
          title: Customer Id
          description: 고객 UUID입니다.
        agent_id:
          description: 에이전트 UUID입니다.
          format: uuid
          title: Agent Id
          type: string
        tier:
          type: string
          enum:
            - static
            - dynamic
          title: Tier
          description: 메모리 tier입니다. `static`은 영속 메모리이고 `dynamic`은 최근 메모리입니다.
        content:
          type: string
          minLength: 1
          title: Content
          description: 메모리 한 문장입니다. 공백을 제외한 내용이 비어 있으면 400을 반환합니다. 저장 전에 앞뒤 공백을 제거합니다.
        observed_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Observed At
          description: >-
            과거 관측 시각입니다. 밀리초 단위 unix timestamp입니다. 생략하거나 null이면 현재 생성 시각을 사용합니다.
            과거 값을 전달하면 `created_at`으로 저장합니다. tier가 보관 한도를 넘으면 오래된 항목부터 처리하는 백스톱이
            새 fact를 즉시 만료할 수 있습니다. 음수, 미래 시각, 범위를 벗어난 값은 400을 반환합니다.
      type: object
      required:
        - customer_id
        - agent_id
        - tier
        - content
      title: CreateMemoryRequest
      description: >-
        메모리 fact를 직접 생성하는 요청입니다.


        쓰기 엔진의 LLM diff와 달리 요청자가 tier를 선택합니다. ID, 상태, 보관 한도 백스톱은 같은 불변 조건에 따라
        코드가 관리합니다. 과거 `observed_at` 값은 `created_at`으로 저장합니다. tier가 보관 한도를 넘으면 쓰기
        엔진과 마찬가지로 오래된 항목부터 처리하는 백스톱이 새 fact를 즉시 만료할 수 있습니다. 응답의 `status`에 결과를
        `active` 또는 `expired`로 표시합니다.


        `content`는 앞뒤 공백을 제거합니다. 공백만 있거나 비어 있으면 400을 반환하며, 정규화한 값을 저장합니다.
        `observed_at`은 현재 시각보다 늦지 않은 유효한 밀리초 단위 unix timestamp여야 합니다. 음수, 미래 시각,
        범위를 벗어난 값은 400을 반환하므로 datetime 변환 오버플로를 방지합니다.
    CreateMemoryResponse:
      properties:
        id:
          type: string
          title: Id
          description: 메모리 UUID입니다.
        customer_id:
          type: string
          title: Customer Id
          description: 고객 UUID입니다.
        agent_id:
          type: string
          title: Agent Id
          description: 에이전트 UUID입니다.
        tier:
          type: string
          title: Tier
          description: 메모리 tier입니다. 값은 `static` 또는 `dynamic`입니다.
        content:
          type: string
          title: Content
          description: 한 문장으로 구성된 메모리 fact 내용입니다.
        created_at:
          type: integer
          title: Created At
          description: 리소스 생성 시각입니다. 밀리초 단위 unix timestamp입니다.
        source_call_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Call Id
          description: 이 fact의 출처인 통화 UUID입니다. 직접 생성한 경우 null입니다.
        source_chat_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Chat Id
          description: 이 fact의 출처인 채팅 UUID입니다. 직접 생성한 경우 null입니다.
        status:
          type: string
          enum:
            - active
            - expired
          title: Status
          description: >-
            새로 생성한 fact의 상태입니다. 보관 한도 백스톱이 fact를 즉시 만료했으면 `expired`이고, 그렇지 않으면
            `active`입니다.
      type: object
      required:
        - id
        - customer_id
        - agent_id
        - tier
        - content
        - created_at
        - status
      title: CreateMemoryResponse
      description: >-
        직접 생성한 fact와 상태를 담은 응답입니다.


        `MemoryFactResponse`는 활성 fact만 다루므로 상태를 포함하지 않습니다. 생성 응답은 새 fact가
        `active` 상태인지, 보관 한도 백스톱으로 즉시 `expired` 상태가 되었는지 표시합니다. 과거 `observed_at`
        값 때문에 tier가 보관 한도를 넘으면 오래된 항목부터 처리하는 백스톱이 새 fact를 만료할 수 있습니다. 다른 오래된
        fact의 만료 여부는 이 응답에 표시하지 않으며 목록 조회로 확인할 수 있습니다.
    ErrorResponse:
      type: object
      required:
        - error
      title: ErrorResponse
      description: 모든 실패 응답에서 사용하는 v3 error envelope입니다.
      examples:
        - error:
            code: VALIDATION_ERROR
            message: Request validation failed.
            details:
              field: name
              reason: must not be blank
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
          description: 오류 payload입니다.
    ErrorDetail:
      type: object
      required:
        - code
        - message
        - details
      title: ErrorDetail
      description: 기계가 읽을 수 있는 v3 오류 상세 정보입니다.
      examples:
        - code: VALIDATION_ERROR
          message: Request validation failed.
          details:
            field: name
            reason: must not be blank
      properties:
        code:
          type: string
          title: Code
          description: 기계가 읽을 수 있는 오류 code입니다. message parsing 대신 이 값을 사용합니다.
          examples:
            - VALIDATION_ERROR
        message:
          type: string
          title: Message
          description: 사용자에게 표시할 수 있는 오류 메시지입니다. 프로그램 처리는 `code`를 사용합니다.
          examples:
            - Request validation failed.
        details:
          type: object
          title: Details
          additionalProperties: true
          description: 구조화된 context입니다. 주로 `field`, `reason`, `allowed_values`를 포함합니다.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Organization API key
      description: '조직 API 키를 `Authorization: Bearer <token>` 형식으로 보냅니다.'

````