TRON.ASOC API: Automation guide
This section describes the key API requests for configuring TRON.ASOC and provides usage examples. You can find the full request specification in Swagger UI at https://{your-domain}/api/v1/swagger/index.html.
Basic information for each request
Base URL: {your-domain}/api/v1.
Common headers:
Content-Type: application/jsonAuthorization: Bearer {your_token}
Common HTTP response codes:
200 OK—Successful request400 Bad request—Invalid request parameters401 Unauthorized—The authentication token is missing or invalid403 Forbidden—You don't have sufficient permissions to perform the operation500 Internal Server Error—Internal server error
Typical configuration process
For initial configuration using basic operations, use the following list of requests:
api/v1/auth/login- Sign in with a Username and Passwordapi/v1/token—Create a tokenapi/v1/role—Create a roleapi/v1/user—Create a userapi/v1/source—Add a scanning sourceapi/v1/sources-type/1/test—Test the source connectionapi/v1/tool—Add a toolapi/v1/project—Create a projectapi/v1/layer—Create a layerapi/v1/quality-gate—Create a quality gateapi/v1/security-rule—Add a security ruleapi/v1/check—Add a security check to a layerapi/v1/check/{{SecurityCheckId}}/run—Start a scanapi/v1/check/{{SecurityCheckId}}/stop- Stop a scanapi/v1/issues?filter—Get a list of detected issuesapi/v1/report—Create a reportapi/v1/report/summary/download?—Download a report
Request details
In all the examples below:
{your-domain}must be replaced with the domain you're using, for example,my.asoc.tronasoc.ru.{{accessToken}}must be replaced with a valid JWT token obtained through/auth/loginor created through/token.
Authentication
Request: POST {{baseUrl}}/api/v1/auth/login
Purpose: Get a JWT token for subsequent requests. The default token lifetime is 9 hours.
Request body:
username- Usernamepassword- Password
Request example:
curl --location 'https://{your-domain}/api/v1/auth/login' \
--header 'Content-Type: application/json' \
--data '{
"username": "username111",
"password": "123456778"
}'
Create a token
Request: POST {{baseUrl}}/api/v1/token
Purpose: Create a long-term API token for integrations
Specify the following in the request:
expires_at—Token expiration datename—Token name
Request example:
curl --location 'https://{your-domain}/api/v1/token' \
--header 'Content-Type: application/json' \
--data '{
"expires_at": "2028-12-31T23:59:34.911353Z",
"name": "DK Api Token"
}'
Create a role
Request: POST {{baseUrl}}/api/v1/role
Purpose: Create a new role for users
Specify the following variables in the request:
role_code—Role coderole_name—Role nameroles—Role settings
Request example:
curl --location 'https://{your-domain}/api/v1/role' \
--header 'Content-Type: application/json' \
--data '{
"role_code": "dev",
"role_name": "qa-s",
"roles":{"settings.authentication":["r","w","x","d"],
"administration.roles":["r","w","x","d"],
"administration.users":["r","w","x","d"]
}
}'
Create a user
Request: POST {{baseUrl}}/api/v1/user
Purpose: Create a new user in the system
Specify the following variables in the request:
username—Usernamepassword—User passwordpassword_confirmation—User password confirmationdisplay_name—Display nameemail—Email addressneed_password_change—Whether the user must change their password when they sign inactive_directory—Whether the user is an AD user (see LDAP authentication for more information)roles—Set of roles
Request example
curl --location 'https://{your-domain}/api/v1/user' \
--header 'Content-Type: application/json' \
--data-raw '{
"username": "User1",
"password": "******",
"password_confirmation": "******",
"display_name": "User1",
"email": "Username1@user.com",
"need_password_change": false,
"active_directory": false,
"roles": ["isoff"]
}'
Add a scanning source
Request: POST {{baseUrl}}/api/v1/source
Purpose: Add a scanning source, for example, a Git repository
The request to add a scanning source includes the following variables:
name- Scanning source namedescription- Scanning source descriptionsource_type_id- Scanning source type IDsettings- Additional settings:url- Source URLbranch_name- Source branch nameauth_method- Authentication method for the sourcelogin- Authentication Username for the sourcepassword- Authentication Password for the source
Request example:
curl --location 'https://{your-domain}/api/v1/source' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{accessToken}}' \
--data-raw '{
"name": "CLICustomSource_20241006T103832251Z_3",
"description": "CLICustomSource_20241006T103832251Z_3",
"source_type_id": 1,
"settings": {
"url": "https://ximilab.gitlab.yandexcloud.net/ximidev/tron-asoc/core",
"branch_name": "develop",
"auth_method": "Login/Password",
"login": "***",
"password": "***"
}
}'
Test a source connection
Request: POST {{baseUrl}}/api/v1/sources-type/1/test
You can also test the CI/CD source connection separately by specifying the following variables in the settings settings:
url- Source URLbranch_name- Source branch nameauth_method- Authentication method for the sourcelogin- Authentication Username for the sourcepassword- Authentication Password for the source
Request example:
curl --location 'https://{your-domain}/api/v1/sources-type/1/test' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{accessToken}}' \
--data-raw '{
"settings": {
"url": "https://ximilab.gitlab.yandexcloud.net/ximidev/tron-asoc/core",
"branch_name": "develop",
"auth_method": "Login/Password",
"login": "***",
"password": "***"
}
}'
Add a tool
Request: POST {{baseUrl}}/api/v1/tool
Purpose: Add a security tool
To add a tool, specify the variables required by the tool. The variables vary depending on the selected tool.
For the PT AI tool, specify the following variables in the request:
scan_result_lang—Scan results languageurl—Tool URLauth_method—Authentication methodapi_token—Token for connecting to the tool, except for CLI tools and Manual
Request example (PT AI):
curl --location 'https://{your-domain}/api/v1/tool' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{accessToken}}' \
--data '{
"description": "{{createSecurityToolDescription}}",
"type_id": 1,
"settings": {
"scan_result_lang": "EN",
"url": "{{PTAIUrl}}",
"auth_method": "Api Token",
"api_token": "{{PTAIApiToken}}"
}
}'
Create a project
Request: POST {{baseUrl}}/api/v1/project
Purpose: Create a new project
To create a project, specify the following variables in the data block of the request:
code- Project codename- Project namedescription- Project descriptiontags—Project tags
Request example:
curl --location 'https://{your-domain}/api/v1/project' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{accessToken}}' \
--data '{
"code": "ASOC967492",
"name": "ASOC967492",
"description": "Project ASOC967492"
"tags": ["tgasoc"]
}'
Request example for creating a project with custom fields:
curl --location 'https://{your-domain}/api/v1/project' \
--header 'Content-Type: application/json' \
--data '{
"code": "ASOC50733846",
"name": "ASOC50733846",
"description": "Test project ASOC50733846",
"tags": ["QA:test"],
"field_values": [
{"field_id": 421, "value": "QA"},
{"field_id": 422, "value": "2025-06-24T00:00:00Z"},
{"field_id": 423, "value": "72e9730b-4cbb-49a7-82ac-fa1f5cad7ab4"},
{"field_id": 424, "value": "https://ximilab.gitlab.yandexcloud.net/ximidev/tron-asoc/front"},
{"field_id": 425, "value": "5145fdca-072c-4672-a956-220f60192203"}
]
}'
Create a layer
Request: POST {{baseUrl}}/api/v1/layer
Purpose: Create a layer in a project
Specify the following parameters in the request:
name- Namedescription- Descriptionproject_code—Project codelayer_type_id—Layer typeis_template—Whether to create the layer from a template
Request example:
curl --location 'https://{your-domain}/api/v1/layer' \
--header 'Content-Type: application/json' \
--data '{
"name": "",
"description": "",
"project_code": "ASOC50733846",
"layer_type_id": 1,
"is_template": false
}'
Create a quality gate
Request: POST {{baseUrl}}/api/v1/quality-gate
To create a quality gate, specify the following variables in the data block of the request:
name- Quality gate name
Request example:
curl --location 'https://{your-domain}/api/v1/quality-gate' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{accessToken}}' \
--data '{
"name": "QG40701017"
}'
To add conditions to a quality gate, specify the following variables in the data block of the request:
quality_gate_id- Quality gate IDcondition_type- Condition typecondition_value- Condition valueoperator- Condition operator valuevalue- Default value
Request example:
curl --location 'https://{your-domain}/api/v1/condition' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{accessToken}}' \
--data '{
"quality_gate_id": "6f50b8e7-e238-4640-28a7b87e4924",
"condition_type": "severity",
"condition_value": "4",
"operator": "not_greater_than",
"value": "0"
}'
To add a quality gate to a layer, specify the following variables in the data block of the request:
layer_id- Pipeline IDquality_gate_id- Quality gate IDaction- Action for linking the quality gate to the layer
Request example:
curl --location 'https://{your-domain}/api/v1/quality-gate/link-pipe' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{accessToken}}' \
--data '{
"layer_id": "b37012de-80ae-4e10-9178-eee6b609ddb0",
"quality_gate_id": "6f50b8e7-e238-4640-28a7b87e4924",
"action": "lock"
}'
Create a security rule
Request: POST {{baseUrl}}/api/v1/security-rule
To create a security rule, specify the following variables in the data block of the request:
name- Security rule namerule_params- Rule parameters:instrument_type- Tool typetool_type_name- Tool namecategory- Tool categorycve- CVE namecwe- CWE nameactive_for_all- Rule scope, whether it applies to allsuppressing_status- Security issue suppression statusexpiry_status- Status after the rule expires
Request example:
curl --location 'https://{your-domain}/api/v1/security-rule' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{accessToken}}' \
--data '{
"name": "SR58594878",
"rule_params": {
"instrument_type": "Container Security",
"tool_type_name": "Kaspersky Container Security",
"category": "Container os dependency vulnerability",
"cve": "CVE-2023-52426",
"cwe": "CWE-776",
"active_for_all": false
},
"suppressing_status": 6,
"expiry_status": 3
}'
Add a security check
Request: POST {{baseUrl}}/api/v1/check
Purpose: Create a security check that links a tool, source, and layer in a project
To add a security check to a pipeline, specify the following variables in the data block of the request:
layer_id- Layer IDproject_code- Project codesecurity_tool_id- Security tool IDtool_auth- Security tool authentication parametersscan_result_lang- Scan result languageurl- Security tool URLauth_method- Authentication methodscan_source_id- Scanning source IDsource_auth- Scanning source authentication parametersurl- Scanning source URLauth_method- Authentication methodbranch_name- Repository branch name (scanning source)run_scan_task- Scan start parameterstype- Scan start type
Request example (PT AI and GitLab):
curl --location 'https://{your-domain}/api/v1/check' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{accessToken}}' \
--data '{
"pipeline_id": "34e19795-517a-4c7a-bdaf83b74d51",
"project_code": "ASOC967492",
"security_tool_id": "e6d95be5-5939-4f41-7b31a5e0719d",
"tool_auth": {
"scan_result_lang": "EN",
"url": "***",
"auth_method": "Api Token",
"api_token": "***"
},
"scan_source_id": "0952f5d8-55af-4229--ffc179b7da20",
"source_auth": {
"url": "https://github.com/http-party/http-server",
"auth_method": "Anonymous",
"branch_name": "master"
},
"run_scan_task": {
"type": "manual"
}
}'
Note: We recommend saving the id of the created check (SecurityCheckId) from the response so you can start it later (see below).
Start a scan
Request: POST {{baseUrl}}/api/v1/check/{{SecurityCheckId}}/run or POST {{baseUrl}}/api/v1/layer/{{LayerId}}/run
Purpose: Manually start a specific security check or an entire layer
To start a scan, specify SecurityCheckId, the security check ID, or LayerId, the layer ID, in the request.
Request examples:
curl --location 'https://{your-domain}/api/v1/check/08bcc80e-a3fc-4ec3-91b4-dc34754d48e1/run' \
--header 'Authorization: Bearer {{accessToken}}'
curl --location 'https://{your-domain}/api/v1/layer/{{LayerId}}/run'
Stop a scan
Request: POST {{baseUrl}}/api/v1/check/{{SecurityCheckId}}/stop
Purpose: Manually stop a specific security check scan
Request example:
curl --location --request POST 'https://{your-domain}/api/v1/check//stop'
Get a list of detected issues
Request: GET {{baseUrl}}/api/v1/issues?filter
Purpose: Get a filtered list of detected vulnerabilities
To get scan results, specify filters. Add a filter to the api/v1/issues?filter request in the following format:
[tool]=PT%20Application%20Inspector&page=1&limit=10&filter[project_code]=ASOC96749244,
where tool is the tool name, page is the page, limit is the record limit, 50 by default, and filter[project_code] is the Project name code.
Request example:
curl --location 'https://{your-domain}/api/v1/issues?filter[tool]=PT%20Application%20Inspector&page=1&limit=10&filter[project_code]=ASOC96749244' \
--header 'Authorization: Bearer {{accessToken}}'
Create a report
Request: POST {{baseUrl}}/api/v1/report
Purpose: Create a report asynchronously
To create a report, specify the following variables in the data block of the request:
name- Report nametype- Report typefilter- Required filters from the available filters:period- Selected time periodproject_code- Project name code
Request example:
curl --location 'https://{your-domain}/api/v1/report' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{accessToken}}' \
--data '{
"name": "",
"type": "summary",
"filter": {
"period": "all",
"project_code": [ "ASOC96749244" ]
}
}'
Download a report
Request: GET {{baseUrl}}/api/v1/report/summary/download?
Purpose: Download a report in the specified format
To download a report, send a request with the following parameters:
format- Report format (pdf, csv, json)filter[project_code]- Project name codefilter[created_at_start]- Report period start datefilter[created_at_end]- Report period end date
Request example:
curl --location 'https://{your-domain}/api/v1/report/summary/download?format=csv&filter[project_code]=ISSUETESTING20241106T071418970Z%2CASOC52372013&filter[created_at_start]=2000-01-01&filter[created_at_end]=2025-01-20' \
--header 'Authorization: Bearer {{accessToken}}'