POST
/
package-search
/
read-file
Read specific lines from a package file
curl --request POST \
  --url https://apigcp.trynia.ai/v2/package-search/read-file \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "registry": "npm",
  "package_name": "react",
  "filename_sha256": "a1b2c3d4e5f6...",
  "start_line": 1,
  "end_line": 100,
  "version": "18.2.0"
}'
{
  "version_used": "<string>",
  "file_path": "<string>",
  "start_line": 123,
  "end_line": 123,
  "content": "<string>",
  "total_lines": 123
}

Authorizations

Authorization
string
header
required

API key must be provided in the Authorization header

Body

application/json
registry
enum<string>
required

Package registry containing the file

Available options:
crates_io,
golang_proxy,
npm,
py_pi
Example:

"npm"

package_name
string
required

Name of the package containing the file

Example:

"react"

filename_sha256
string
required

SHA256 hash of the file to read (obtained from grep/hybrid search)

Example:

"a1b2c3d4e5f6..."

start_line
integer
required

Starting line number (1-based, inclusive)

Required range: x >= 1
Example:

1

end_line
integer
required

Ending line number (1-based, inclusive)

Required range: x >= 1
Example:

100

version
string

Specific version of the package (optional, defaults to latest)

Example:

"18.2.0"

Response

File content retrieved successfully

version_used
string

Version of the package

file_path
string

Path of the file within the package

start_line
integer

Starting line number

end_line
integer

Ending line number

content
string

File content for the specified line range

total_lines
integer

Total number of lines in the file