# Add a document to a collection

`POST /workspace/memory/{id}/upload` · Rivier · memory

Add a document to a collection.

- Scope: memory:write
- Graphql: Mutation.memoryCollectionUpload
- Sdk: memory.collection.upload
- Cli: memory collection upload

## Parameters

- `id` (path, required), string

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "filename": {
      "type": "string",
      "minLength": 1,
      "maxLength": 300
    },
    "content": {
      "type": "string",
      "minLength": 1
    }
  },
  "required": [
    "filename",
    "content"
  ],
  "additionalProperties": false
}
```

## Responses

- `201`: Success
- `400`: The request was malformed
- `401`: No valid credential
- `403`: The credential lacks the scope, origin or address
- `429`: Over the key's rate limit; see Retry-After

## Example

```sh
curl -X POST 'https://api.rivier.ai/workspace/memory/{id}/upload' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "filename": "string",
  "content": "string"
}'
```
