Skip to main content
Read the complete content of a file. This is the L2 (full content) layer in OpenViking’s context hierarchy.

Python SDK

from openviking import OpenViking

client = OpenViking()

# Read entire file
content = client.read("viking://resources/docs/api.md")
print(content)

# Read with offset and limit
partial = client.read("viking://resources/docs/api.md", offset=100, limit=500)
print(partial)

HTTP API

curl -X GET "http://localhost:1933/api/v1/content/read?uri=viking://resources/docs/api.md" \
  -H "X-API-Key: your-key"
GET /api/v1/content/read?uri=viking://resources/docs/api.md

Parameters

uri
string
required
Viking URI of the file to read
offset
integer
default:"0"
Byte offset to start reading from
limit
integer
default:"-1"
Maximum number of bytes to read (-1 for entire file)

Response

status
string
Operation status (ok on success)
result
string
The file content as a string
time
number
Execution time in seconds
{
  "status": "ok",
  "result": "# API Documentation\n\nThis document describes the API...\n\n## Authentication\n\n...",
  "time": 0.1
}

CLI

openviking read viking://resources/docs/api.md

Context Layers

OpenViking provides three levels of content access:
  • L0 (Abstract): ~100 token summary via abstract()
  • L1 (Overview): Structured overview via overview()
  • L2 (Full): Complete content via read() (this method)

Error Cases

  • Returns error if the URI points to a directory (use overview() for directories)
  • Returns error if the file doesn’t exist
  • For binary files, content may not be readable as text