POST
/
package-search
/
grep
Search package source code with regex
curl --request POST \
  --url https://apigcp.trynia.ai/v2/package-search/grep \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "registry": "npm",
  "package_name": "react",
  "pattern": "useState|useEffect",
  "version": "18.2.0",
  "language": "TypeScript",
  "filename_sha256": "<string>",
  "a": 123,
  "b": 123,
  "c": 123,
  "head_limit": 10,
  "output_mode": "content"
}'
{
  "version_used": "18.2.0",
  "results": [
    {}
  ],
  "truncation_message": "<string>"
}

Authorizations

Authorization
string
header
required

API key must be provided in the Authorization header

Body

application/json
registry
enum<string>
required

Package registry to search

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

"npm"

package_name
string
required

Name of the package to search

Example:

"react"

pattern
string
required

Regex pattern to search for in the package source code

Example:

"useState|useEffect"

version
string

Specific version to search (optional, defaults to latest)

Example:

"18.2.0"

language
string

Language filter for search results

Example:

"TypeScript"

filename_sha256
string

SHA256 hash of specific file to search in

a
integer

Number of lines after each match to include

b
integer

Number of lines before each match to include

c
integer

Number of lines before and after each match to include

head_limit
integer

Maximum number of results to return

Example:

10

output_mode
enum<string>
default:content

Format of the output results

Available options:
content,
files_with_matches,
count

Response

Package search completed successfully

Raw response from Chroma Package Search API

version_used
string

Version of the package that was searched

Example:

"18.2.0"

results
object[]

Search results from the package

Search result item (format varies by search type)

truncation_message
string

Message indicating if results were truncated