Memory API

수집·관리

문서·첨부 수집과 항목 조회·삭제.


문서·레코드를 워크스페이스에 직접 밀어넣고, 넣은 항목을 조회·삭제합니다. external_id(또는 path)로 멱등 업서트를 합니다.

수집

POST/sources/api/ingest

요청 바디

필드타입필수설명
content (또는 text)string | object필수본문. 문자열 또는 JSON 객체/배열
external_idstring필수 (또는 path)멱등 키. 같은 값 재호출 시 새 버전으로 업서트
pathstring | string[]선택폴더 트리 경로. 생략한 external_id 대신 자연 키로 동작
titlestring기본 external_id표시 제목
source_namestring기본 "API ingest"소스 그룹 이름
scopeprivate | workspace기본 workspace저장 스코프
metadataobject선택임의 JSON 메타데이터
attachments{ url, filename? }[]선택첨부파일 (최대 10개, 각 25MB). 요청 시점에 fetch 해 즉시 랜딩

응답

{
  "ok": true,
  "status": "indexed",
  "source_id": "…",
  "source_item_id": "…",
  "version_id": "…",
  "attachments": [
    { "url": "https://…/report.pdf", "filename": "report.pdf",
      "status": "indexed", "source_item_id": "…" }
  ]
}

statusindexed(신규/변경) 또는 unchanged(동일 content hash) 입니다. attachments 는 첨부를 보낸 경우에만 포함됩니다.

예시

curl -X POST 'https://api.memory.inc/sources/api/ingest' \
  -H 'authorization: Bearer pwk_YOUR_KEY' \
  -H 'content-type: application/json' \
  -d '{
    "external_id": "doc-2026-06-09-001",
    "title": "주간 결정 메모",
    "content": "# 결정\n- 결제 모듈 v2 로 이전",
    "attachments": [
      { "url": "https://bucket.s3.amazonaws.com/q2.pdf?X-Amz-…", "filename": "q2-report.pdf" }
    ]
  }'

폴더 트리로 넣을 땐 external_id 를 생략하고 path 를 자연 키로 씁니다(같은 경로 재업로드 = 제자리 갱신).

curl -X POST 'https://api.memory.inc/sources/api/ingest' \
  -H 'authorization: Bearer pwk_YOUR_KEY' \
  -H 'content-type: application/json' \
  -d '{
    "source_name": "my-docs",
    "path": "docs/api/payments.md",
    "content": "# Payments API\n..."
  }'

첨부 URL 은 요청 시점에 한 번 fetch 합니다. 서명된 presigned URL 은 만료 전에 보내세요. SSRF 방지를 위해 내부망 주소는 차단됩니다.

항목 조회

GET/sources/api/items
쿼리타입설명
external_idstring (반복 가능)특정 external_id
source_namestring소스 이름
typestringsource_type
created_after / created_beforeISO 8601생성 시각 범위
statusactive | hidden | all기본 all
limitnumber기본 50 (최대 200)
{
  "ok": true,
  "count": 1,
  "items": [
    {
      "id": "…", "external_id": "doc-2026-06-09-001",
      "source_name": "API ingest", "source_type": "api",
      "title": "주간 결정 메모", "scope": "workspace",
      "hidden": false, "delete_behavior": "hard_delete"
    }
  ]
}

항목 삭제

DELETE/sources/api/items

셀렉터로 대상을 고릅니다: ids, external_ids, source_name / type, created_after / created_before.

curl -X DELETE 'https://api.memory.inc/sources/api/items' \
  -H 'authorization: Bearer pwk_YOUR_KEY' \
  -H 'content-type: application/json' \
  -d '{ "external_ids": ["doc-2026-06-09-001"] }'
{
  "ok": true,
  "matched": 2,
  "hard_deleted": [{ "id": "…", "external_id": "doc-2026-06-09-001", "source_name": "API ingest" }],
  "hidden": [{ "id": "…", "external_id": "mail-9", "source_name": "Gmail" }]
}

API 로 넣은 항목은 hard_delete(완전 삭제), 커넥터로 동기화된 항목은 hide(숨김 — 원본 보존)로 처리됩니다.