# Doc Store

## Get the document value for a given key

> Retrieves the document content and version for the specified key. Returns 404 if the key does not exist. The version can be used for optimistic concurrency control in subsequent updates.

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.3.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}}},"paths":{"/sfp/api/doc-store/docs/{key}":{"get":{"operationId":"DocStoreController_read","summary":"Get the document value for a given key","description":"Retrieves the document content and version for the specified key. Returns 404 if the key does not exist. The version can be used for optimistic concurrency control in subsequent updates.","parameters":[{"name":"key","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"The document value has been successfully retrieved."},"403":{"description":"Forbidden - Requires role: member, application"},"404":{"description":"The key was not found."},"500":{"description":"Internal server error."}},"tags":["Doc Store"]}}}}
```

## Create or update a document entry

> Stores or updates a document with the specified key. Supports optimistic concurrency control via version parameter. If version is provided, it must match the current version for updates. For new documents, version should not be provided.

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.3.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}}},"paths":{"/sfp/api/doc-store/docs/{key}":{"post":{"operationId":"DocStoreController_upsert","summary":"Create or update a document entry","description":"Stores or updates a document with the specified key. Supports optimistic concurrency control via version parameter. If version is provided, it must match the current version for updates. For new documents, version should not be provided.","parameters":[{"name":"key","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"value":{"type":"object"}}}}}},"responses":{"201":{"description":"The document entry has been successfully created or updated."},"403":{"description":"Forbidden - Requires role: member, application"},"500":{"description":"Internal server error."}},"tags":["Doc Store"]}}}}
```

## Delete a document entry

> Permanently removes a document from the store. This operation cannot be undone. Returns 404 if the key does not exist. Only users with owner role or application tokens can perform this operation.

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.3.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}}},"paths":{"/sfp/api/doc-store/docs/{key}":{"delete":{"operationId":"DocStoreController_delete","summary":"Delete a document entry","description":"Permanently removes a document from the store. This operation cannot be undone. Returns 404 if the key does not exist. Only users with owner role or application tokens can perform this operation.","parameters":[{"name":"key","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"number"}}}}}},"responses":{"204":{"description":"The document entry has been successfully deleted."},"403":{"description":"Forbidden - Requires role: owner, application"},"404":{"description":"The key was not found."},"409":{"description":"Version mismatch."},"500":{"description":"Internal server error."}},"tags":["Doc Store"]}}}}
```

## Get the document version for a given key

> Retrieves only the version number for the specified key without the document content. Useful for checking if a document has been modified before fetching the full content. Returns 404 if the key does not exist.

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.3.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}}},"paths":{"/sfp/api/doc-store/docs/{key}/version":{"get":{"operationId":"DocStoreController_getVersion","summary":"Get the document version for a given key","description":"Retrieves only the version number for the specified key without the document content. Useful for checking if a document has been modified before fetching the full content. Returns 404 if the key does not exist.","parameters":[{"name":"key","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"The document version has been successfully retrieved."},"403":{"description":"Forbidden - Requires role: member, application"},"404":{"description":"The key was not found."},"500":{"description":"Internal server error."}},"tags":["Doc Store"]}}}}
```

## List all keys

> Returns an array of all document keys in the store. This operation may be expensive for large stores. Keys are returned in no particular order. Use with caution in production environments with many documents.

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.3.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}}},"paths":{"/sfp/api/doc-store/docs":{"get":{"operationId":"DocStoreController_listKeys","summary":"List all keys","description":"Returns an array of all document keys in the store. This operation may be expensive for large stores. Keys are returned in no particular order. Use with caution in production environments with many documents.","parameters":[{"name":"standaloneDocumentsOnly","required":false,"in":"query","description":"When true, returns only documents that are not part of any collection (collection_id is null). When false or omitted, returns all documents including those in collections.","schema":{"type":"boolean"}}],"responses":{"200":{"description":"The list of keys has been successfully retrieved."},"403":{"description":"Forbidden - Requires role: member, application"},"500":{"description":"Internal server error."}},"tags":["Doc Store"]}}}}
```
