Naturali Knowledge API
Unified search across documents and knowledge sources
Unified search across documents and knowledge sources
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/naturali-ai:naturali-ai-knowledge-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: naturali.ai Knowledge API
version: 1.0.0
description: The naturali.ai API. This document is the merge of every per-resource spec under openapi/v1/ — the single wire contract for all v1 endpoints.
contact:
name: naturali.ai
url: https://naturali.ai
servers:
- url: https://api.naturali.ai
description: Host of your naturali.ai deployment; every path carries the /v1 prefix.
security:
- bearerAuth: []
- oauth2:
- mcp:access
tags:
- name: Knowledge
description: Unified search across documents and knowledge sources
paths:
/v1/projects/{project_id}/knowledge/search:
parameters:
- $ref: '#/components/parameters/ProjectId'
post:
tags:
- Knowledge
summary: Search knowledge
description: Searches across documents and memories using hybrid retrieval — a vector query and a full-text query per source, fused by reciprocal rank — by the stored vector of an existing document or memory (`similar_to_document_id`, `similar_to_memory_id`), or by file paths, document IDs, memory store IDs, or tags. At least one of `query`, `similar_to_document_id`, `similar_to_memory_id`, `tags`, `document_paths`, `document_ids`, or `memory_store_ids` must be provided.
operationId: searchKnowledge
requestBody:
required: true
content:
application/json:
schema:
type: object
additionalProperties: false
properties:
query:
type: string
description: Search query text. Runs a vector query and a full-text query over each store and fuses the rankings; the full-text channel matches exact tokens and phrases, the vector channel everything else.
example: customer communication preferences
similar_to_document_id:
x-naturali-ref: documents
type: string
description: 'Ranks by this document''s stored embedding (the mean of its chunk embeddings) instead of a query: the vector channel alone, no embedding call, and none of the document''s own chunks in the results. Not combinable with `query` or `similar_to_memory_id`.'
example: doc_V1StGXR8Z5jdHi6B
similar_to_memory_id:
x-naturali-ref: memories
type: string
description: 'Ranks by this memory''s stored embedding instead of a query: the vector channel alone, no embedding call, and the memory itself left out of the results. Not combinable with `query` or `similar_to_document_id`.'
example: mem_V1StGXR8Z5jdHi6B
min_similarity:
type: number
description: 'Minimum raw cosine `similarity_score` a **vector** candidate must reach to take part in ranking, applied before fusion. Only applies when `query` or a `similar_to_*` source is provided. Lexical candidates are deliberately exempt: a result that literally contains the searched token is the evidence, and dropping it for a low cosine is the failure hybrid search exists to prevent. Not a floor on `score`, whose fused value encodes rank position rather than similarity.'
minimum: 0
maximum: 1
example: 0.5
rrf_k:
type: integer
description: The `k` in the reciprocal rank fusion term `1 / (k + rank)`, which sets how steeply a result's contribution decays with its position in each ranked list. A smaller value weights the very top of each list more heavily. Defaults to 60. Only applies when `query` is provided; ignored with a `similar_to_*` source, which ranks by one channel.
minimum: 1
example: 60
recency_half_life_days:
type: number
description: 'Half-life, in days, of a recency decay applied to **memory store** results after fusion: a result''s `score` is multiplied by `2 ^ (-age_in_days / recency_half_life_days)`, where age is measured from its `updated_at`. Document results are never decayed. `0`, the default, disables the blend entirely. Accepts fractions (`0.5` is twelve hours). How many ranks a given half-life costs depends on `rrf_k`. Only applies when `query` is provided. **No value is known to be safe in general**: every half-life measured against the reference corpus that lifted recency-sensitive queries also cost relevance-sensitive ones, which is why this ships disabled. Measure against your own corpus before setting it.'
minimum: 0
example: 30
limit:
type: integer
description: Maximum number of results to return (default 10). A value above 100 is clamped to 100 — the ceiling bounds the vector scan this one request performs, so a larger `limit` returns everything there is up to that many rows rather than being refused.
minimum: 1
example: 10
include_documents:
type: boolean
default: true
description: Set `false` to leave the document store out of this search. A `query` names no store, so it reaches both; the store-specific filters narrow *within* a store rather than choosing between them. This is the switch, and a filter naming the other store never overrides it. `false` for both stores is `400`.
example: false
include_memories:
type: boolean
default: true
description: Set `false` to leave the memory store out of this search. The mirror of `include_documents`, for a caller that wants documents alone.
example: false
memory_store_ids:
x-naturali-ref: memory-stores
type: array
description: Search memories within these specific memory stores
items:
type: string
example:
- mstore_V1StGXR8Z5jdHi6B
actor_id:
x-naturali-ref: actors
type: string
description: Searches only the memories that belong to this actor; documents are not narrowed. Pin it in a tool's `preset_parameters` as `{{context:actor_id}}` so an agent searches the memories of the end user it serves only.
example: actor_V1StGXR8Z5jdHi6B
document_paths:
type: array
description: Filter results to documents whose file path starts with one of these prefixes
items:
type: string
example:
- /sales/
- /hr/
document_ids:
x-naturali-ref: documents
type: array
description: Filter results to specific document IDs
items:
type: string
example:
- doc_V1StGXR8Z5jdHi6B
tags:
description: 'Filter results to documents and memories whose `tags` contain every one of these key-value pairs (exact, case-sensitive match). Scopes both stores, so passing it alone searches both — as `query` does. For memories it matches at memory granularity: a memory is returned when its parent memory store''s tags match or its own do.'
allOf:
- $ref: '#/components/schemas/TagBag'
metadata:
description: 'Filter document results by their `metadata` bag. A document-store filter: a memory carries no such bag, so passing it alone searches documents, as `document_paths` does.'
allOf:
- $ref: '#/components/schemas/StructuredFilter'
responses:
'200':
description: Search results
content:
application/json:
schema:
type: object
required:
- results
properties:
results:
type: array
items:
$ref: '#/components/schemas/KnowledgeResult'
'400':
description: Bad request — at least one search parameter is required, and a `similar_to_*` source takes neither `query` nor the other source
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: Forbidden, or a `query` and no project in scope the caller holds `embeddings:CreateEmbeddings` on to bill its embedding to
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: The `similar_to_*` source does not exist or the caller cannot search it
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'409':
description: SIMILARITY_SOURCE_NOT_EMBEDDED — the `similar_to_*` source has no embedding yet
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'413':
$ref: '#/components/responses/PayloadTooLarge'
'429':
$ref: '#/components/responses/TooManyRequests'
'500':
$ref: '#/components/responses/InternalError'
'502':
$ref: '#/components/responses/AdmissionUnavailable'
'503':
description: EMBEDDING_NOT_CONFIGURED — the vector channel has no usable embedding provider; the search surfaces it rather than degrading to lexical only.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
4XX:
$ref: '#/components/responses/AdmissionRefused'
components:
responses:
TooManyRequests:
description: '`QUOTA_EXCEEDED` — a `requests` quota on the calling API key or its project is spent for the window; `Retry-After` says when it reopens'
headers:
Retry-After:
description: Seconds until the quota window admits a request again
schema:
type: integer
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
AdmissionUnavailable:
description: The deployment's admission service is asked about this write and did not answer — `ADMISSION_UNAVAILABLE`; the write did not happen
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
AdmissionRefused:
description: The deployment's admission service refused this write — answered under the service's own `4xx` status, with its `code` (matching `^[A-Za-z_][A-Za-z0-9_]{0,63}$`, not necessarily an `ERROR_CODES` key), `message` and `meta`; the write did not happen. A status this operation also declares on its own is documented there
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
PayloadTooLarge:
description: '`REQUEST_REJECTED` — the request body is over the size the body parser accepts'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
InternalError:
description: Unexpected server error — `INTERNAL_ERROR`, with the raw message never forwarded
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
schemas:
TagBag:
type: object
additionalProperties:
type: string
x-cli-flag-name: tags
description: 'Key-value labels on a resource. A flat object of string values — an array, a nested object or a number is rejected with `400 VALIDATION_FAILED`, never coerced. Keys are opaque and stored verbatim, so `cost_center` and `costCenter` are two different tags. Matched by JSONB containment wherever tags are read: the `?tags=` filter, knowledge search, and the IAM `iam:ResourceTag/<key>` condition.
Keys beginning `system.` are reserved: the platform writes them to record which conversation, actor, agent and role a row came from, and a write naming one is refused with `400 RESERVED_TAG_KEY`. They are read and filtered like any other tag.
The bag is bounded, because every pair reaches the IAM context of every access check on the resource: at most 50 keys, each key at most 128 characters and each value at most 256. A write past a bound — including a merge that would grow the stored bag past the key count — is `400 VALIDATION_FAILED` with `meta.limit` naming the bound it crossed. `system.*` keys are the platform''s and do not count against the 50.'
example:
team: finance
env: prod
StructuredFilter:
type: object
description: 'Narrows results by a JSON field, such as the `metadata` bag. Each key is a field; its value is either a value to match exactly, or an object naming one or more operators.
Equality and `in` match the stored value exactly, so `3` and `"3"` are different filters.
`gt`, `gte`, `lt` and `lte` order the field against the operand, and the operand''s own JSON type says which comparison is meant: a number orders numerically, a string lexicographically. They work on any field, in any scope. A row whose field holds another type is excluded from the comparison rather than erroring on it, so a range never fails on a bag that happens to hold text where another holds a number. An operand that is neither a number nor a string — a boolean, `null`, a list, an object — has no ordering and is `400 VALIDATION_FAILED`, naming the field in `meta.field`.'
additionalProperties: true
example:
quarter: Q1
revision:
gte: 3
lt: 11
status:
in:
- draft
- final
DocumentKnowledgeResult:
type: object
required:
- source_type
- document_id
- content
- created_at
- updated_at
properties:
source_type:
type: string
enum:
- document
description: The type of knowledge source this result comes from
example: document
document_id:
x-naturali-ref: documents
type: string
description: Public ID of the document
example: doc_V1StGXR8Z5jdHi6B
document_version:
type: integer
description: The document version the chunk belongs to. Cite it to record which text was read; the document's versions keep that text after it changes.
example: 3
chunk_id:
type: string
description: Public ID of the document chunk that matched the query
example: dchunk_V1StGXR8Z5jdHi6B
page:
type:
- integer
- 'null'
description: Page number within the source PDF (1-indexed). Null for plain-text documents.
example: 3
file_id:
x-naturali-ref: files
type: string
description: Public ID of the underlying file
example: file_V1StGXR8Z5jdHi6B
project_id:
x-naturali-ref: projects
type: string
description: Public ID of the project the document belongs to
example: proj_V1StGXR8Z5jdHi6B
path:
type: string
description: Logical path of the file within the project
example: /sales/policies.txt
filename:
type: string
description: Filename of the underlying file
example: policies.txt
size:
type: integer
description: File size in bytes
example: 1024
title:
type: string
description: Document title
example: Sales Communication Policy
metadata:
description: Arbitrary metadata attached to the document, returned verbatim in the casing it was written with at create/update time (e.g. a key written as `strapiDocumentId` is returned as `strapiDocumentId`, not `strapi_document_id`) — it is not converted between snake_case and camelCase like other response fields.
allOf:
- $ref: '#/components/schemas/MetadataBag'
tags:
$ref: '#/components/schemas/TagBag'
content:
type:
- string
- 'null'
description: Full text content of the document
score:
type: number
description: 'Reciprocal-rank-fusion relevance ranking — higher is better. The **ordering** it produces is the contract; the absolute value is not, is deliberately not rescaled into 0–1, and the formula behind it may change. Results are sorted by it. Nothing filters on it: `min_similarity` filters `similarity_score`. Only present when `query` was provided. Use `similarity_score` when you need the raw cosine value.'
example: 0.0328
signals:
type: object
description: 'Which retrieval channels ranked this result before fusion, and its 1-based position in that channel''s own ordering. A channel that did not return the result is absent, so presence reads as "this channel found it". `score` says where the result landed; this says how it got there — `{ "lexical": 1 }` is a pure token hit, `{ "vector": 2, "lexical": 1 }` a result both channels found and fusion promoted. Only present when `query` was provided; a channel that degraded is absent from every result. Diagnostic: nothing filters or sorts on it.'
properties:
vector:
type: integer
minimum: 1
description: Rank in the vector (cosine) channel, best first.
example: 2
lexical:
type: integer
minimum: 1
description: Rank in the lexical (full-text) channel, best first.
example: 1
example:
vector: 2
lexical: 1
similarity_score:
type: number
description: Raw cosine similarity (0–1) between the query and this result. Pinned to that meaning — unlike `score`, it is never redefined — and populated on every result of a `query` search, a lexical-only hit included. Absent only when the embedding provider was unreachable and the search answered from the lexical channel alone, where there is no query vector to measure against.
minimum: 0
maximum: 1
example: 0.82
created_at:
type: string
format: date-time
description: Creation timestamp
updated_at:
type: string
format: date-time
description: Last updated timestamp
ErrorResponse:
type: object
required:
- error
properties:
error:
type: object
description: Structured error. Every error response uses this shape, so `code` can be read without first checking the type of `error`.
required:
- code
- message
properties:
code:
type: string
description: 'Machine-readable error code: lower_snake for an error naturali raises (`access_denied`), UPPER_SNAKE for one the runtime reports (`RESOURCE_NOT_FOUND`).'
example: access_denied
message:
type: string
description: Human-readable explanation.
example: Your role in this project does not carry this action.
details:
type: object
additionalProperties: true
description: Structured context for an error naturali raises, such as the `resource` and `limit` of a `plan_limit_reached`.
meta:
type: object
description: Structured context for an error the runtime reports.
KnowledgeResult:
oneOf:
- $ref: '#/components/schemas/DocumentKnowledgeResult'
- $ref: '#/components/schemas/MemoryKnowledgeResult'
discriminator:
propertyName: source_type
mapping:
document: '#/components/schemas/DocumentKnowledgeResult'
memory: '#/components/schemas/MemoryKnowledgeResult'
MemoryKnowledgeResult:
type: object
required:
- source_type
- memory_id
- memory_store_id
- memory_store_name
- content
- created_at
- updated_at
properties:
source_type:
type: string
enum:
- memory
description: The type of knowledge source this result comes from
example: memory
memory_id:
type: string
description: Public ID of the memory
example: mem_V1StGXR8Z5jdHi6B
memory_store_id:
x-naturali-ref: memory-stores
type: string
description: Public ID of the parent memory store
example: mstore_V1StGXR8Z5jdHi6B
memory_store_name:
type: string
description: Human-readable name of the parent memory store
example: Customer Preferences
content:
type: string
description: Text content of the memory
tags:
description: The memory's tags; absent when it has none
allOf:
- $ref: '#/components/schemas/TagBag'
score:
type: number
description: 'Reciprocal-rank-fusion relevance ranking — higher is better. The **ordering** it produces is the contract; the absolute value is not, is deliberately not rescaled into 0–1, and the formula behind it may change. Results are sorted by it. Nothing filters on it: `min_similarity` filters `similarity_score`. Only present when `query` was provided. Use `similarity_score` when you need the raw cosine value.'
example: 0.0161
signals:
type: object
description: 'Which retrieval channels ranked this result before fusion, and its 1-based position in that channel''s own ordering. A channel that did not return the result is absent, so presence reads as "this channel found it". `score` says where the result landed; this says how it got there — `{ "lexical": 1 }` is a pure token hit, `{ "vector": 2, "lexical": 1 }` a result both channels found and fusion promoted. Only present when `query` was provided; a channel that degraded is absent from every result. Diagnostic: nothing filters or sorts on it.'
properties:
vector:
type: integer
minimum: 1
description: Rank in the vector (cosine) channel, best first.
example: 2
lexical:
type: integer
minimum: 1
description: Rank in the lexical (full-text) channel, best first.
example: 1
example:
vector: 2
lexical: 1
similarity_score:
type: number
description: Raw cosine similarity (0–1) between the query and this result. Pinned to that meaning — unlike `score`, it is never redefined — and populated on every result of a `query` search, a lexical-only hit included. Absent only when the embedding provider was unreachable and the search answered from the lexical channel alone, where there is no query vector to measure against.
minimum: 0
maximum: 1
example: 0.79
created_at:
type: string
format: date-time
description: Creation timestamp
updated_at:
type: string
format: date-time
description: Last updated timestamp
MetadataBag:
type: object
description: 'Caller-owned annotations on a resource, stored as the object they were written as: the types a value was written with are the types a read returns, so a filter can ask an ordering question about a number. Unlike other body fields, keys are stored and returned verbatim in the casing supplied — they are not converted between snake_case and camelCase.
No key is reserved, and that is the point: every piece of state the platform owns lives in its own typed column, so nothing written here reaches platform state. The platform never reads the bag — it is not an IAM context, not a policy input and not part of a prompt — which is what separates it from a tag bag.'
example:
author: John
revision: 2
parameters:
ProjectId:
name: project_id
in: path
required: true
description: Project public ID (proj_ prefix).
schema:
type: string
example: proj_V1StGXR8Z5jdHi6B
securitySchemes:
bearerAuth:
type: http
scheme: bearer
description: A naturali API key (nat_sk_…) or a session JWT.
oauth2:
type: oauth2
description: 'A connected app''s OAuth access token, issued by this API''s authorization server (discovery: /.well-known/oauth-authorization-server). Its one scope carries every operation, confined to the projects the user chose when approving the app.'
flows:
authorizationCode:
authorizationUrl: https://api.naturali.ai/authorize
tokenUrl: https://api.naturali.ai/token
refreshUrl: https://api.naturali.ai/token
scopes:
mcp:access: Every operation this API serves, on the projects the grant covers.