Hi Dinse,
Thanks for getting in touch.
For triggering a scan in Burp Enterprise via the API, with a custom scan configuration and extension you have applied to the site, I would recommend using the Burp Enterprise GraphQL API, which includes more functionality. The REST API is quite limited.
You can convert the GraphQL query to curl if you wish. I would recommend using the free Insomnia tool to create the query as a GraphQL POST request and you can also easily convert this to curl using Insomnia.
https://insomnia.rest/download1) New request > POST > GraphQL query
2) Enter the URL
"YOUR-ENTERPRISE-SERVER-URL:PORT/graphql/v1"
3) Go to the "Header" tab > Add a new header called "Authorization" and enter the API key for the Burp Enterprise API user you have already set up
https://portswigger.net/burp/documentation/enterprise/administration-tasks/ci-cd/create-api-user4) Build and test your query (example below)
5) Right click on the request from the left menu > Copy as curl
Below is an example request which will trigger a non-recurring scan to start instantly, specifying a custom scan configuration. For extensions, if you have applied these to the site in Burp Enterprise > Site details they will be applied to the scan automatically. (For scan configurations, you have to specify this even if default configurations are applied to the site. We are looking to change this next year).
Firstly you will want to fetch the list of
"site_id"
and
"scan_configuration_ids"
parameters you will need for your request.
GetSiteTree:query GetSiteTree {
site_tree {
sites {
id
name
parent_id
}
}
}
In this example lets say my "site_id" is "1".
GetScanConfigurationsquery GetScanConfigurations {
scan_configurations {
id
name
}
}
In this example lets say my scan configuration ID for my custom configuration is "37791324-14be-41c5-807d-1ff99b8b4ea1".
GraphQL POSTmutation CreateScheduleItem($input:CreateScheduleItemInput!) {
create_schedule_item(input: $input) {
schedule_item {
id
}
}
}
Query variables
{
"input": {
"site_id": "1",
"scan_configuration_ids": [
"37791324-14be-41c5-807d-1ff99b8b4ea1"
]
}
}
The GraphQL POST converted to curl:curl --request POST \
--url YOUR-ENTERPRISE-SERVER-URL:8085/graphql/v1 \
--header 'Authorization: YOUR-API-KEY' \
--header 'Content-Type: application/json' \
--data '{"query":"mutation CreateScheduleItem($input:CreateScheduleItemInput!) {\ncreate_schedule_item(input: $input) {\nschedule_item {\nid\n}\n}\n}","variables":{"input":{"site_id":"1","scan_configuration_ids":["37791324-14be-41c5-807d-1ff99b8b4ea1"]}},"operationName":"CreateScheduleItem"}'
Relevant documentation is here:
https://portswigger.net/burp/documentation/enterprise/api-documentationhttps://portswigger.net/burp/extensibility/enterprise/graphql-api/https://portswigger.net/burp/extensibility/enterprise/graphql-api/create_schedule_item.htmlLet me know if you need any further assistance.