## POST /v1/memories

Create a memory at a path. A path that already holds a memory returns 409.

Required permissions: write:memories.
API key: Supported.
CLI user token: Supported.
Session token: Requires the ellipsis:api scope, and the session's permissions.ellipsis rules must allow the operation.
Higher permission levels include lower levels: read < write < delete.

### Request

```text
{
  "content": str,
  "path": str
}
```

### Response

```text
{
  "memory": {
    "content": str,
    "content_sha256": str,
    "created_at": str,
    "created_by": { # MemoryUserWriter | MemorySessionWriter |
    # MemoryApiKeyWriter | MemoryGithubWriter
      "type": "user",
      "user": {
        "avatar_url": str,
        "id": str,
        "name": str
      }
    },
    "id": str,
    "last_sync_error": str,
    "last_synced_commit_sha": str,
    "managed_by": str,
    "path": str,
    "source_details": {
      "branch": str,
      "path": str,
      "repo_id": int
    },
    "updated_at": str,
    "updated_by": { # MemoryUserWriter | MemorySessionWriter |
    # MemoryApiKeyWriter | MemoryGithubWriter
      "type": "user",
      "user": {
        "avatar_url": str,
        "id": str,
        "name": str
      }
    }
  }
}
```

### Python

```python
import os

from ellipsis import Ellipsis

client = Ellipsis(api_key=os.environ["ELLIPSIS_API_TOKEN"])

result = client.memories.create(
    "Branches are named `<issue>-<summary>`.\n",
    "team/conventions.md",
)
print(result)
```

### TypeScript

```typescript
import { Ellipsis } from '@ellipsis-dev/sdk';

const client = new Ellipsis({
  apiKey: process.env.ELLIPSIS_API_TOKEN!,
});

const request: Parameters<typeof client.memories.create>[0] = {
  path: 'team/conventions.md',
  content: "Branches are named `<issue>-<summary>`.\n",
};

const result = await client.memories.create(request);
console.log(result);
```

### cURL

```bash
curl -X POST "https://api.ellipsis.dev/v1/memories" \
  -H "Authorization: Bearer $ELLIPSIS_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "path": "team/conventions.md",
  "content": "Branches are named `<issue>-<summary>`.\n"
}'
```

### Request schema

```json
{
  "properties": {
    "content": {
      "type": "string"
    },
    "path": {
      "type": "string"
    }
  },
  "required": [
    "path",
    "content"
  ],
  "type": "object"
}
```

### Response schema

```json
{
  "properties": {
    "memory": {
      "properties": {
        "content": {
          "type": "string"
        },
        "content_sha256": {
          "type": "string"
        },
        "created_at": {
          "format": "date-time",
          "type": "string"
        },
        "created_by": {
          "oneOf": [
            {
              "properties": {
                "session_id": {
                  "type": "string"
                },
                "type": {
                  "const": "session",
                  "default": "session",
                  "type": "string"
                }
              },
              "required": [
                "session_id"
              ],
              "type": "object"
            },
            {
              "properties": {
                "type": {
                  "const": "user",
                  "default": "user",
                  "type": "string"
                },
                "user": {
                  "properties": {
                    "avatar_url": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "avatar_url",
                    "id",
                    "name"
                  ],
                  "type": "object"
                }
              },
              "required": [
                "user"
              ],
              "type": "object"
            },
            {
              "properties": {
                "api_key_id": {
                  "type": "string"
                },
                "type": {
                  "const": "api_key",
                  "default": "api_key",
                  "type": "string"
                }
              },
              "required": [
                "api_key_id"
              ],
              "type": "object"
            },
            {
              "properties": {
                "type": {
                  "const": "github",
                  "default": "github",
                  "type": "string"
                }
              },
              "type": "object"
            }
          ]
        },
        "id": {
          "type": "string"
        },
        "last_sync_error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "last_synced_commit_sha": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "managed_by": {
          "enum": [
            "github",
            "api"
          ],
          "type": "string"
        },
        "path": {
          "type": "string"
        },
        "source_details": {
          "anyOf": [
            {
              "properties": {
                "branch": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "repo_id": {
                  "type": "integer"
                }
              },
              "required": [
                "repo_id",
                "path",
                "branch"
              ],
              "type": "object"
            },
            {
              "type": "null"
            }
          ]
        },
        "updated_at": {
          "format": "date-time",
          "type": "string"
        },
        "updated_by": {
          "oneOf": [
            {
              "properties": {
                "session_id": {
                  "type": "string"
                },
                "type": {
                  "const": "session",
                  "default": "session",
                  "type": "string"
                }
              },
              "required": [
                "session_id"
              ],
              "type": "object"
            },
            {
              "properties": {
                "type": {
                  "const": "user",
                  "default": "user",
                  "type": "string"
                },
                "user": {
                  "properties": {
                    "avatar_url": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "avatar_url",
                    "id",
                    "name"
                  ],
                  "type": "object"
                }
              },
              "required": [
                "user"
              ],
              "type": "object"
            },
            {
              "properties": {
                "api_key_id": {
                  "type": "string"
                },
                "type": {
                  "const": "api_key",
                  "default": "api_key",
                  "type": "string"
                }
              },
              "required": [
                "api_key_id"
              ],
              "type": "object"
            },
            {
              "properties": {
                "type": {
                  "const": "github",
                  "default": "github",
                  "type": "string"
                }
              },
              "type": "object"
            }
          ]
        }
      },
      "required": [
        "id",
        "path",
        "content_sha256",
        "managed_by",
        "created_by",
        "updated_by",
        "created_at",
        "updated_at",
        "content"
      ],
      "type": "object"
    }
  },
  "required": [
    "memory"
  ],
  "type": "object"
}
```
