Skip to main content
POST
/
api
/
v1
/
rag
/
document
Upsert Document
curl --request POST \
  --url https://api.ravan.ai/api/v1/rag/document \
  --header 'Content-Type: application/json' \
  --header 'X-Api-Key: <api-key>' \
  --data '
{
  "org_id": "<string>",
  "kb_id": "<string>",
  "doc_id": "<string>",
  "text": "<string>",
  "url": "<string>",
  "urls": [
    "<string>"
  ],
  "max_pages": 123,
  "max_depth": 123,
  "metadata": {}
}
'
{
  "success": true,
  "message": "<string>",
  "data": {
    "doc_id": "<string>",
    "kb_id": "<string>",
    "org_id": "<string>",
    "text": "<string>",
    "url": "<string>",
    "status": "<string>",
    "metadata": {},
    "created_at": "<string>",
    "updated_at": "<string>"
  }
}

Authorizations

X-Api-Key
string
required
Your Agni API key used to authenticate the request. Pass it in the X-Api-Key header. Find or rotate it from your Ravan AI account settings.

Body

org_id
string
required
The organization ID that owns the resource. Use the organization ID from your Agni account.
kb_id
string
required
The unique knowledge base ID. Use the ID returned by the knowledge base create or list endpoint.
doc_id
string
required
The unique document ID in the knowledge base. Use a stable ID so later upserts update the same document.
text
string
The text content to ingest, search, or store, depending on the endpoint.
url
string
A publicly reachable URL. Include the full protocol, for example https://example.com/docs.
urls
string[]
A list of publicly reachable URLs. Include the full protocol for each URL.
max_pages
integer
The maximum number of pages to crawl or ingest from the provided URL sources.
max_depth
integer
The maximum crawl depth when discovering or ingesting URLs. Higher values can include more nested pages.
metadata
object
Custom key-value data to attach to the resource. Use this for IDs or attributes from your own systems.

Response

success
boolean
Whether the request succeeded.
message
string
Human-readable status message.
data
object
Returned data.

Authorizations

X-Api-Key
string
header
required

Body

application/json
org_id
string
required

Organization ID

kb_id
string
required

Knowledge Base ID

doc_id
string
required

Document ID

text
string

Document text content

url
string

URL to crawl

urls
string[]

Multiple URLs to crawl

max_pages
integer

Max pages to crawl

max_depth
integer

Max crawl depth

metadata
object

Document metadata

Response

200 - application/json

Successful response

success
boolean
message
string
data
object