MarkLogic Retrieval API
- Last Updated: December 3, 2026
- 4 minute read
- Documentation
MarkLogic Retrieval API (MRA) is the component that performs search and document retrieval inside MarkLogic Server. It is separate from MarkLogic MCP Server: MarkLogic MCP Server routes tool calls from your MCP client to MRA, but MRA does the actual work against your data.
MRA provides several endpoints detailed in this section.
If you are new to MRA, then complete the Quick start before reading the reference material in this section.
Documentation index
Core API
Definition endpoint
Search configuration and discovery endpoint
Use this endpoint to dynamically discover what search capabilities are available.
Documents the /v1/retrieve/definition endpoint, which returns available search capabilities including collections, filters, document schemas, and vector embeddings.
Topics covered:
- Discovering available collections (labels)
- Available filters (Value, Word, Range, and View types)
- Document schemas
- Vector metadata (embedding models, dimensions)
- Using definition data to build search UIs
- Code examples (Python, JavaScript, cURL)
Retrieve endpoint
Primary search endpoint documentation
Start here if you are implementing search functionality.
Complete reference for the /v1/retrieve endpoint, the main search interface for MarkLogic Retrieval API. Covers text search, vector search, filters, collection labels, and all request parameters.
Topics covered:
- Text search with full-text indexing
- Phrase search with double quotes for exact matching
- Vector similarity search using embeddings
- Constraint-based filters (Value, Word, Range, View)
- Collection labels (MustHave/MustNotHave)
- TopK result limiting and
totalMatchescount - Request/response formats
- Search behavior and performance
Search Query Best Practices:
When you use /v1/retrieve before augmenting, remember that words in the text field are AND-ed by default. That means all terms must appear in a matching document, which can be very restrictive. To maximize recall, connect synonyms and related terms with OR.
- Good:
"GLP-1 OR liraglutide OR semaglutide OR glucagon-like peptide" - Too narrow:
"GLP-1 glucagon-like peptide glucose mice"(ANDs all terms)
Recommended workflow for complex questions:
- Decompose your question into concept groups (for example, drug names / outcomes / mechanisms).
- Issue one Retrieve call for eachr concept group using
ORwithin each group. - Collect all unique document URIs across calls.
- Pass the deduplicated URIs to Augment to fetch full content.
- Filter augmented documents for relevance before synthesizing.
Augment endpoint
Document retrieval by URI
Use this endpoint after /v1/retrieve to get full document content.
Complete reference for the /v1/retrieve/augment endpoint, which retrieves full document content by URI.
Use after searching to get complete documents.
Topics covered:
- Retrieving documents by URI
- Batch document retrieval
- Response format with full content
- Error handling
- Code examples
Retrieve SQL metadata endpoint
SQL catalog discovery endpoint
Use this endpoint before /v1/retrieve/sql to find valid query targets.
Documents the GET /v1/retrieve/sql/metadata endpoint, which returns the SQL schemas, tables and views, columns, functions, collations, and collection URIs that the calling user can query.
Topics covered:
- Catalog contents
- Row limit and truncation reporting
- Error responses
- Metadata caching in MarkLogic MCP Server
Retrieve SQL endpoint
Read-only SQL query endpoint
Use this endpoint after /v1/retrieve/sql/metadata to query the data that you discovered.
Complete reference for the POST /v1/retrieve/sql endpoint, which runs one read-only SQL query in the security context of the calling user.
Topics covered:
- Query requirements
- Response format with columns and rows
- Row limit and truncation
400and403error responses
Retrieve SPARQL metadata endpoint
SPARQL metadata discovery endpoint
Use this endpoint before /v1/retrieve/sparql to discover namespace prefixes and graph IRIs visible to the calling identity.
Documents the GET /v1/retrieve/sparql/metadata endpoint.
Topics covered:
- Prefix and graph metadata
- Metadata list limits and truncation
- Error responses
Retrieve SPARQL endpoint
Read-only SPARQL query endpoint
Use this endpoint after /v1/retrieve/sparql/metadata to run one SELECT or ASK query in the calling identity's security context.
Documents the POST /v1/retrieve/sparql endpoint and its SPARQL 1.1 Query Results JSON response.
Topics covered:
- Query forms and request validation
- SELECT and ASK response formats
- Query row limits and truncation
- Error responses
Filter and configuration
Filters
Comprehensive filter usage guide
Detailed guide to using constraint-based filters in search requests. Covers all filter types with practical examples.
Topics covered:
- Value filters (exact matches)
- Word filters (tokenized, case-insensitive word matches)
- Range filters (dates, numbers)
- View filters (TDE/Optic joins)
- Filter combination logic (AND)
- Common filter patterns
- Troubleshooting filters
Essential for advanced search queries with filtering.
retrieve-config-json.md
Configuration file reference
Technical reference for the retrieveConfig.json configuration file that defines search capabilities. For system administrators and developers setting up MRA.
Topics covered:
- Configuration file structure
- Document schema references
- Vector metadata configuration
- Extraction XPath configuration
- SQL row limits
- Relationship to
/v1/retrieve/definition - Configuration workflow
- Troubleshooting
For system setup and configuration - not needed for MRA consumers.
Documentation conventions
Throughout these guides:
- 🔹 Code examples are provided using cURL.
- 🔹 Response formats show actual API structures with field descriptions.
- 🔹 ⚠️ Warnings indicate features that are planned but not yet implemented.
- 🔹 Related documentation links appear at the end of each guide.