Doc Store / Collections

sfp server API reference for Doc Store / Collections: 11 endpoints.

POST/sfp/api/doc-store/collections

Creates a new document collection with the specified name. Collections are logical groupings of related documents. Returns a unique collection ID. Fails if a collection with the same name already exists.

Authorization

access-token
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

curl -X POST "https://example.com/sfp/api/doc-store/collections" \  -H "Content-Type: application/json" \  -d '{}'
Empty
GET/sfp/api/doc-store/collections

Returns a list of all document collections with their IDs and names. Collections are returned in no particular order. Use this to discover available collections before querying documents.

Authorization

access-token
AuthorizationBearer <token>

In: header

Response Body

curl -X GET "https://example.com/sfp/api/doc-store/collections"
Empty
GET/sfp/api/doc-store/collections/{collectionName}

Retrieves a collection by name along with all documents it contains. This can be expensive for large collections. Consider using the query endpoint with pagination for better performance on large datasets. Use store=changelog to retrieve from the dedicated changelog table.

Authorization

access-token
AuthorizationBearer <token>

In: header

Path Parameters

collectionName*string

Query Parameters

store?string

Target store for the collection. Defaults to "doc" for backward compatibility.

Value in

  • "doc"
  • "changelog"
  • "packages"
  • "builds"

Response Body

curl -X GET "https://example.com/sfp/api/doc-store/collections/string"
Empty
DELETE/sfp/api/doc-store/collections/{collectionName}

Permanently deletes an entire collection and all its documents. This destructive operation: - Removes the collection and ALL documents within it - Cannot be undone - all data is permanently lost - Frees up the collection name for reuse

    Use with extreme caution. Consider backing up important data before deletion. This endpoint requires elevated privileges.

Authorization

access-token
AuthorizationBearer <token>

In: header

Path Parameters

collectionName*string

Response Body

curl -X DELETE "https://example.com/sfp/api/doc-store/collections/string"
Empty
POST/sfp/api/doc-store/collections/{collectionName}/query

DEPRECATED: This endpoint has issues with nested collection names (e.g., 'org/repo/collection'). Please use the cross-collection query endpoint at POST /doc-store/collections/query with pathPattern instead.

    Executes advanced queries against documents in a specific collection. Features include:    - Complex filtering with multiple operators (eq, ne, gt, lt, gte, lte, in, nin, regex)    - Nested field queries using dot notation (e.g., 'user.email')    - Sorting by multiple fields with ascending/descending order    - Pagination support with limit and offset    - Field projection to return only specific fields    This is the recommended way to retrieve documents when you need specific filtering or working with large collections.

Authorization

access-token
AuthorizationBearer <token>

In: header

Path Parameters

collectionName*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/sfp/api/doc-store/collections/string/query" \  -H "Content-Type: application/json" \  -d '{    "pathPattern": "<your-collection-name>",    "filters": [      {        "field": "status",        "operator": "eq",        "value": "active"      }    ]  }'
[  {    "collection": "string",    "key": "string",    "value": {},    "version": 0  }]
POST/sfp/api/doc-store/collections/query

Executes queries across multiple collections using path patterns. This powerful endpoint allows: - Querying single collections by exact path (e.g., 'org/repo/builds-v2') - Wildcard patterns to match multiple collections (e.g., 'repo_*/metadata') - Cross-collection queries for impact analysis and health checks - All standard query features (filtering, sorting, pagination) - Properly handles nested collection names with slashes - Use store=changelog to query the dedicated changelog table

    **This is the recommended endpoint for all collection queries**, as it correctly handles nested collection paths.    Common use cases:    - Query specific collections with nested names (e.g., 'flxbl-io/sf-core/builds-v2')    - Find all metadata across repositories    - Search for specific configurations across environments    - Aggregate data from multiple sources

Authorization

access-token
AuthorizationBearer <token>

In: header

Query Parameters

store?string

Target store for the query. Defaults to "doc" for backward compatibility.

Value in

  • "doc"
  • "changelog"
  • "packages"
  • "builds"

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/sfp/api/doc-store/collections/query" \  -H "Content-Type: application/json" \  -d '{    "pathPattern": "<your-collection-name>",    "filters": [      {        "field": "status",        "operator": "eq",        "value": "active"      }    ]  }'
[  {    "collection": "string",    "key": "string",    "value": {},    "version": 0  }]
POST/sfp/api/doc-store/collections/{collectionName}/docs/{key}

Creates a new document or updates an existing one in the specified collection. Implements optimistic concurrency control: - For new documents: Do not provide a version number - For updates: Must provide the current version number to prevent concurrent modification conflicts - Version numbers are automatically incremented on successful updates - Use store=changelog to store in the dedicated changelog table (optimized for write-heavy operations)

    The document value can be any valid JSON structure. Collections are created automatically if they don't exist. Returns the document with its new version number.

Authorization

access-token
AuthorizationBearer <token>

In: header

Path Parameters

key*string
collectionName*string

Query Parameters

store?string

Target store for the document. Defaults to "doc" for backward compatibility.

Value in

  • "doc"
  • "changelog"
  • "packages"
  • "builds"

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

curl -X POST "https://example.com/sfp/api/doc-store/collections/string/docs/string" \  -H "Content-Type: application/json" \  -d '{    "value": {}  }'
Empty
GET/sfp/api/doc-store/collections/{collectionName}/docs/{key}

Retrieves a single document by its key from the specified collection. Returns: - The document value as stored - The current version number for optimistic concurrency control - Use store=changelog to retrieve from the dedicated changelog table

    Use this endpoint when you know the exact document key. For searching or filtering, use the query endpoints instead.

Authorization

access-token
AuthorizationBearer <token>

In: header

Path Parameters

key*string
collectionName*string

Query Parameters

store?string

Target store for the document. Defaults to "doc" for backward compatibility.

Value in

  • "doc"
  • "changelog"
  • "packages"
  • "builds"

Response Body

curl -X GET "https://example.com/sfp/api/doc-store/collections/string/docs/string"
Empty
DELETE/sfp/api/doc-store/collections/{collectionName}/docs/{key}

Permanently deletes a specific document from a collection. This operation: - Removes the document immediately and permanently - Cannot be undone - ensure you have backups if needed - Does not affect other documents in the collection - Use store=changelog to delete from the dedicated changelog table

    Requires owner or application role for security. The collection itself remains even if it becomes empty.

Authorization

access-token
AuthorizationBearer <token>

In: header

Path Parameters

key*string
collectionName*string

Query Parameters

store?string

Target store for the document. Defaults to "doc" for backward compatibility.

Value in

  • "doc"
  • "changelog"
  • "packages"
  • "builds"

Response Body

curl -X DELETE "https://example.com/sfp/api/doc-store/collections/string/docs/string"
Empty
GET/sfp/api/doc-store/collections/{collectionName}/docs/{key}/version

Retrieves only the version number of a document without its content. This lightweight endpoint is useful for: - Checking if a document has been modified before fetching - Verifying version before updates to prevent conflicts - Monitoring document changes - Use store=changelog to check version in the dedicated changelog table

    Returns only the version number, making it efficient for version checks.

Authorization

access-token
AuthorizationBearer <token>

In: header

Path Parameters

key*string
collectionName*string

Query Parameters

store?string

Target store for the document. Defaults to "doc" for backward compatibility.

Value in

  • "doc"
  • "changelog"
  • "packages"
  • "builds"

Response Body

curl -X GET "https://example.com/sfp/api/doc-store/collections/string/docs/string/version"
Empty
GET/sfp/api/doc-store/collections/{collectionName}/docs

Retrieves a list of all document keys and versions in a collection without their content. This endpoint: - Returns only keys and version numbers, not document values - Useful for discovering available documents - Efficient for large collections as it doesn't transfer document content

    For retrieving actual document content, use the query endpoint or get individual documents by key.

Authorization

access-token
AuthorizationBearer <token>

In: header

Path Parameters

collectionName*string

Response Body

curl -X GET "https://example.com/sfp/api/doc-store/collections/string/docs"
Empty