API v1
Agents
Agents Workspace

Workspace: File Read

Read a file from the agent's workspace filesystem. Supports partial reads via line ranges.

post/v1/agents/{agent_id}/workspace/file_read

Request

  • Base URL
    https://api.xpander.ai (the document declares no server; this is the origin it was published from)
  • Auth
    API key in header x-api-key

Path parameters

agent_idstring required

Request body

pathstring required

Relative path to the file to read from the workspace filesystem.

start_lineinteger nullable

1-indexed starting line number for partial reads. Omit to read from the beginning.

end_lineinteger nullable

1-indexed ending line number (inclusive) for partial reads. Omit to read to the end.

encodingstring

File encoding to use when reading. Falls back to detected encoding if decoding fails.

Example request

{
  "path": "config.yaml",
  "start_line": 1,
  "end_line": 50,
  "encoding": "utf-8"
}

Response

Successful Response

contentstring

File content (full or partial based on line range)

lines_countinteger

Total number of lines in the returned content

encoding_detectedstring

The encoding used to decode the file

Changes

No recorded changes to this operation across all 5 revisions of this API.