Skip to content

Start a repository analysis

Initiates a fresh code analysis on the specified repository.

POST /v1/analyzer/git/

Parameters

Name Type Description Required
repo string The repository URL. Yes
token string GitHub authentication token. No
subdir string Subdirectory in the repository. No
exclude_files array List of files to exclude. No
exclude_directories array List of directories to exclude. No
exclude_extensions array List of file extensions to exclude. No

Example

{
    "repo": "https://github.com/username/repository",
    "token": "abc123",
    "subdir": "src",
    "exclude_files": ["test.py", "setup.py"],
    "exclude_directories": ["test", "docs"],
    "exclude_extensions": [".md", ".txt"]
}

CURL Command

curl -X POST 'https://api.y2ksecurity.com/v1/analyzer/git/' \
-H 'Authorization: Token Y2KSEC_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
    "repo": "https://github.com/username/repository",
    "token": "abc123",
    "subdir": "src",
    "exclude_files": ["test.py", "setup.py"],
    "exclude_directories": ["test", "docs"],
    "exclude_extensions": [".md", ".txt"]
}'

Responses

200 OK

Example Content:

{
    "message": "Code is being analyzed.",
    "track_id": "1234-abcd",
    "status": "Started",
    "monitor_url": "https://api.y2ksecurity.com/v1/analyzer/git/monitor/1234-abcd/"
}
400 BAD REQUEST

Condition: If 'repo' isn't a valid repository.

Example Content:

{
    "repo": [
        "The repository does not exist or you do not have permission to access it."
    ]
}