---
title: "Create Memory"
method: POST
path: "/api/ai/deployments/{deploymentId}/memories"
tags: ["MemoriesService"]
---

# Create Memory

`POST /api/ai/deployments/{deploymentId}/memories`

Create a new memory.

## Path parameters

- `deploymentId` string, required

## Request body

- ProtosAiV1CreateMemoryRequest
  - `memory` ProtosAiV1Memory
    - `id` string — The memories database id
    - `content` string — The user-provided plain text memory message
    - `ruleId` string — The rule id that the memory is associated with
    - `ruleName` string — The name of the rule that the memory is associated with
    - `repositoryId` string — The repository id that the memory is associated with
    - `repositoryName` string — The name of the repository that the memory is associated with
    - `createdAt` string, date-time — The timestamp when the memory was created
    - `createdBy` string — The user who created the memory
    - `context` string[] — Where the memory should apply, e.g. "TRIAGE" or "GUIDANCE" Defined in AiMemoryContext
    - `stage` 'AI_MEMORY_STAGE_LIVE' | 'AI_MEMORY_STAGE_SUGGESTED' | 'AI_MEMORY_STAGE_DELETED', enum — The state of the memory | value | description | |-------|---------------| | AI_MEMORY_STAGE_LIVE | | | AI_MEMORY_STAGE_SUGGESTED | | | AI_MEMORY_STAGE_DELETED | |
    - `pathPrefixes` string[] — The path prefixes that the memory should apply to
    - `suggestionSources` ProtosAiV1AiMemorySuggestionSources
      - `sources` ProtosAiV1AiMemorySource[]
        - `note` string — The reference note that the memory is associated with
        - `createdBy` string — The user who created the memory
        - `createdAt` string, date-time — The timestamp when the note was created
        - `sampleIssueId` string — A randomly chosen issue IDs that the note is associated with
        - `prCommentUrl` string — URL to the PR/MR comment where this triage occurred (constructed dynamically on fetch)
        - `reviewCommentId` string — The ID of the review comment that originated this memory (used to construct pr_comment_url)
    - `preanalysisCounts` ProtosAiV1MemoryPreanalysisCounts
      - `newlyTruePositive` string
      - `newlyFalsePositive` string
      - `remainsTruePositive` string
      - `remainsFalsePositive` string
    - `vulnerabilityClass` string — The vulnerability class the memory applies to
    - `projectTagId` integer — The project tag ID that the memory applies to (mutually exclusive with repository_id)
  - `deploymentId` string

## Response `200`

OK

- ProtosAiV1CreateMemoryResponse
  - `memory` ProtosAiV1Memory
    - `id` string — The memories database id
    - `content` string — The user-provided plain text memory message
    - `ruleId` string — The rule id that the memory is associated with
    - `ruleName` string — The name of the rule that the memory is associated with
    - `repositoryId` string — The repository id that the memory is associated with
    - `repositoryName` string — The name of the repository that the memory is associated with
    - `createdAt` string, date-time — The timestamp when the memory was created
    - `createdBy` string — The user who created the memory
    - `context` string[] — Where the memory should apply, e.g. "TRIAGE" or "GUIDANCE" Defined in AiMemoryContext
    - `stage` 'AI_MEMORY_STAGE_LIVE' | 'AI_MEMORY_STAGE_SUGGESTED' | 'AI_MEMORY_STAGE_DELETED', enum — The state of the memory | value | description | |-------|---------------| | AI_MEMORY_STAGE_LIVE | | | AI_MEMORY_STAGE_SUGGESTED | | | AI_MEMORY_STAGE_DELETED | |
    - `pathPrefixes` string[] — The path prefixes that the memory should apply to
    - `suggestionSources` ProtosAiV1AiMemorySuggestionSources
      - `sources` ProtosAiV1AiMemorySource[]
        - `note` string — The reference note that the memory is associated with
        - `createdBy` string — The user who created the memory
        - `createdAt` string, date-time — The timestamp when the note was created
        - `sampleIssueId` string — A randomly chosen issue IDs that the note is associated with
        - `prCommentUrl` string — URL to the PR/MR comment where this triage occurred (constructed dynamically on fetch)
        - `reviewCommentId` string — The ID of the review comment that originated this memory (used to construct pr_comment_url)
    - `preanalysisCounts` ProtosAiV1MemoryPreanalysisCounts
      - `newlyTruePositive` string
      - `newlyFalsePositive` string
      - `remainsTruePositive` string
      - `remainsFalsePositive` string
    - `vulnerabilityClass` string — The vulnerability class the memory applies to
    - `projectTagId` integer — The project tag ID that the memory applies to (mutually exclusive with repository_id)

---

[API](https://skmtc.net/semgrep/apis/semgrep-web-app.md) · [All operations](https://skmtc.net/semgrep/apis/semgrep-web-app/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/semgrep/semgrep-web-app/versions/6483eeecd582/schema)
