SastRuleExtensions
Snyk API reference for the SastRuleExtensions endpoints, including request parameters and response schemas
SAST rule extensions adapt Snyk SAST analysis, making Snyk Code Rules more suitable for your code. You must associate SAST rule extensions with particular Snyk Code Rule Keys. Only published SAST rule extensions with assignment would be applied to Snyk SAST scans.
Required permissions
group.rule_extension.create
API key value must be prefixed with "Token ".
Unique identifier for group in request path
b667f176-df52-4b0a-9954-117af6b05ab7Requested API version
2021-06-04Pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$SAST rule extension successfully created. SAST rule extensions will only apply once published and assigned.
Bad Request: one or more parameters are invalid. Check the input to match the expected format. See Snyk API
Unauthorized: the request requires an authentication token. See Revoke and regenerate a Snyk API token.
Forbidden: the request requires an authentication token with more or different permissions. Review token permissions and try again. See PAT permissions.
Not Found: The resource you are trying to access could not be found. Review the request and try again.
Conflict: The requested operation conflicts with the current state of the resource in some way.
Internal Server Error: An unexpected error was encountered while attempting to process the request. Try again. If the error still occurs, contact support.
POST /rest/groups/{group_id}/sast/rule_extensions?version=2021-06-04 HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Content-Type: application/vnd.api+json
Accept: */*
Content-Length: 101
{
"data": {
"attributes": {
"copy_from": "a6fd4971-1d47-4684-a45d-7d0a372912e0"
},
"type": "rule_extensions"
}
}{
"data": {
"attributes": {
"configuration": {
"rule_keys": [
"XSS",
"DOMXSS"
],
"type": "flows_through"
},
"created_at": "2024-10-23T17:32:28Z",
"created_by": "758769f2-5b3a-41eb-b7c2-20bd785be49a",
"kind": "sast_sanitizer",
"published_at": null,
"published_by": null,
"signature": {
"fully_qualified_name": "com.example.xssSanitizer"
},
"status": "draft",
"updated_at": "2024-10-23T17:32:28Z",
"updated_by": "758769f2-5b3a-41eb-b7c2-20bd785be49a"
},
"id": "a6fd4971-1d47-4684-a45d-7d0a372912e0",
"type": "rule_extensions"
},
"jsonapi": {
"version": "1.0"
},
"links": {
"self": "/rest/groups/758769f2-5b3a-41eb-b7c2-20bd785be49a/sast/rule_extensions/a6fd4971-1d47-4684-a45d-7d0a372912e0"
}
}Get a list of all the SAST rule extensions for the requested Group ID and its child Org(s).
Required permissions
group.rule_extension.read
API key value must be prefixed with "Token ".
Unique identifier for group in request path
b667f176-df52-4b0a-9954-117af6b05ab7Requested API version
2021-06-04Pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$Return the page of results immediately after this cursor
v1.eyJpZCI6IjEwMDAifQo=Return the page of results immediately before this cursor
v1.eyJpZCI6IjExMDAifQo=Number of results to return per page
10Example: 10Returns a list of all the SAST rule extensions associated with the requested Group ID and its child Org(s)
Bad Request: one or more parameters are invalid. Check the input to match the expected format. See Snyk API
Unauthorized: the request requires an authentication token. See Revoke and regenerate a Snyk API token.
Forbidden: the request requires an authentication token with more or different permissions. Review token permissions and try again. See PAT permissions.
Not Found: The resource you are trying to access could not be found. Review the request and try again.
Internal Server Error: An unexpected error was encountered while attempting to process the request. Try again. If the error still occurs, contact support.
GET /rest/groups/{group_id}/sast/rule_extensions?version=2021-06-04 HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
{
"data": [
{
"attributes": {
"configuration": {
"rule_keys": [
"text"
],
"type": "flows_through"
},
"created_at": "2026-01-01T00:00:00.000Z",
"created_by": "123e4567-e89b-12d3-a456-426614174000",
"description": "text",
"kind": "sast_sanitizer",
"published_at": "2026-01-01T00:00:00.000Z",
"published_by": "123e4567-e89b-12d3-a456-426614174000",
"signature": {
"fully_qualified_name": "text"
},
"status": "published",
"updated_at": "2026-01-01T00:00:00.000Z",
"updated_by": "123e4567-e89b-12d3-a456-426614174000"
},
"id": "123e4567-e89b-12d3-a456-426614174000",
"type": "rule_extensions"
}
],
"jsonapi": {
"version": "1.0"
},
"links": {
"first": "https://example.com/api/resource",
"last": "https://example.com/api/resource",
"next": "https://example.com/api/resource",
"prev": "https://example.com/api/resource",
"related": "https://example.com/api/resource",
"self": "https://example.com/api/resource"
}
}Update the SAST rule extension for the requested SAST rule extension ID
Required permissions
group.rule_extension.edit
API key value must be prefixed with "Token ".
Unique identifier for group in request path
b667f176-df52-4b0a-9954-117af6b05ab7Unique identifier for SAST rule extension in request path
4a994d3b-d15e-45c3-bf24-6a26a02ed9eaRequested API version
2021-06-04Pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$SAST rule extension updated successfully.
Bad Request: one or more parameters are invalid. Check the input to match the expected format. See Snyk API
Unauthorized: the request requires an authentication token. See Revoke and regenerate a Snyk API token.
Forbidden: the request requires an authentication token with more or different permissions. Review token permissions and try again. See PAT permissions.
Not Found: The resource you are trying to access could not be found. Review the request and try again.
Conflict: The requested operation conflicts with the current state of the resource in some way.
Internal Server Error: An unexpected error was encountered while attempting to process the request. Try again. If the error still occurs, contact support.
PATCH /rest/groups/{group_id}/sast/rule_extensions/{rule_extension_id}?version=2021-06-04 HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Content-Type: application/vnd.api+json
Accept: */*
Content-Length: 115
{
"data": {
"attributes": {
"status": "published"
},
"id": "a6fd4971-1d47-4684-a45d-7d0a372912e0",
"type": "rule_extensions"
}
}{
"data": {
"attributes": {
"configuration": {
"rule_keys": [
"SQLI",
"java/Sqli"
],
"type": "flows_through"
},
"created_at": "2024-10-23T17:32:28Z",
"created_by": "758769f2-5b3a-41eb-b7c2-20bd785be49a",
"description": "SQL injection sanitizer for database queries",
"kind": "sast_sanitizer",
"published_at": "2024-10-24T09:15:00Z",
"published_by": "758769f2-5b3a-41eb-b7c2-20bd785be49a",
"signature": {
"fully_qualified_name": "com.example.sqlSanitizer"
},
"status": "published",
"updated_at": "2024-10-24T09:15:00Z",
"updated_by": "758769f2-5b3a-41eb-b7c2-20bd785be49a"
},
"id": "a6fd4971-1d47-4684-a45d-7d0a372912e0",
"type": "rule_extensions"
},
"jsonapi": {
"version": "1.0"
},
"links": {
"self": "/rest/groups/0188104e-7aea-4047-b383-74d8b42d7452/sast/rule_extensions/a6fd4971-1d47-4684-a45d-7d0a372912e0"
}
}Get the SAST rule extension for the requested SAST rule extension ID
Required permissions
group.rule_extension.read
API key value must be prefixed with "Token ".
Unique identifier for group in request path
b667f176-df52-4b0a-9954-117af6b05ab7Unique identifier for SAST rule extension in request path
4a994d3b-d15e-45c3-bf24-6a26a02ed9eaRequested API version
2021-06-04Pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$SAST rule extension retrieved successfully.
Bad Request: one or more parameters are invalid. Check the input to match the expected format. See Snyk API
Unauthorized: the request requires an authentication token. See Revoke and regenerate a Snyk API token.
Forbidden: the request requires an authentication token with more or different permissions. Review token permissions and try again. See PAT permissions.
Not Found: The resource you are trying to access could not be found. Review the request and try again.
Internal Server Error: An unexpected error was encountered while attempting to process the request. Try again. If the error still occurs, contact support.
GET /rest/groups/{group_id}/sast/rule_extensions/{rule_extension_id}?version=2021-06-04 HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
{
"data": {
"attributes": {
"configuration": {
"rule_keys": [
"SQLI",
"java/Sqli"
],
"type": "flows_through"
},
"created_at": "2024-10-23T17:32:28Z",
"created_by": "758769f2-5b3a-41eb-b7c2-20bd785be49a",
"description": "SQL injection sanitizer for database queries",
"kind": "sast_sanitizer",
"published_at": "2024-10-24T09:15:00Z",
"published_by": "758769f2-5b3a-41eb-b7c2-20bd785be49a",
"signature": {
"fully_qualified_name": "com.example.sqlSanitizer"
},
"status": "published",
"updated_at": "2024-10-24T09:15:00Z",
"updated_by": "758769f2-5b3a-41eb-b7c2-20bd785be49a"
},
"id": "a6fd4971-1d47-4684-a45d-7d0a372912e0",
"type": "rule_extensions"
},
"jsonapi": {
"version": "1.0"
},
"links": {
"self": "/rest/groups/0188104e-7aea-4047-b383-74d8b42d7452/sast/rule_extensions/a6fd4971-1d47-4684-a45d-7d0a372912e0"
}
}Delete the SAST rule extension for the requested SAST rule extension ID. Draft rule extensions can be deleted unconditionally. Published rule extensions can only be deleted if they have no assignments. All assignments must be removed before a published rule extension can be deleted.
Required permissions
group.rule_extension.delete
API key value must be prefixed with "Token ".
Unique identifier for group in request path
b667f176-df52-4b0a-9954-117af6b05ab7Unique identifier for SAST rule extension in request path
4a994d3b-d15e-45c3-bf24-6a26a02ed9eaRequested API version
2021-06-04Pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$SAST rule extension deleted successfully.
Bad Request: one or more parameters are invalid. Check the input to match the expected format. See Snyk API
Unauthorized: the request requires an authentication token. See Revoke and regenerate a Snyk API token.
Forbidden: the request requires an authentication token with more or different permissions. Review token permissions and try again. See PAT permissions.
Not Found: The resource you are trying to access could not be found. Review the request and try again.
Internal Server Error: An unexpected error was encountered while attempting to process the request. Try again. If the error still occurs, contact support.
DELETE /rest/groups/{group_id}/sast/rule_extensions/{rule_extension_id}?version=2021-06-04 HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
No content
Create a test on a Snyk Code project to understand the impact of the input SAST Rule Extension.
Required permissions
group.rule_extension.read
API key value must be prefixed with "Token ".
Unique identifier for group in request path
b667f176-df52-4b0a-9954-117af6b05ab7Requested API version
2021-06-04Pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$The operation was accepted but a result is not available at this time
Unauthorized: the request requires an authentication token. See Revoke and regenerate a Snyk API token.
Forbidden: the request requires an authentication token with more or different permissions. Review token permissions and try again. See PAT permissions.
Not Found: The resource you are trying to access could not be found. Review the request and try again.
Conflict: The requested operation conflicts with the current state of the resource in some way.
Internal Server Error: An unexpected error was encountered while attempting to process the request. Try again. If the error still occurs, contact support.
POST /rest/groups/{group_id}/sast/rule_extensions/tests?version=2021-06-04 HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Content-Type: application/vnd.api+json
Accept: */*
Content-Length: 224
{
"data": {
"attributes": {
"fully_qualified_name": "text",
"org_id": "123e4567-e89b-12d3-a456-426614174000",
"project_id": "123e4567-e89b-12d3-a456-426614174000",
"rule_keys": [
"text"
],
"type": "flows_through_sanitizer"
},
"type": "tests"
}
}{
"data": {
"attributes": {
"status": "STARTED"
},
"id": "6d5ac645-9309-4ac8-9808-9bd5251785bb",
"links": {
"self": "/groups/b9ee05cf96cab612c1ce0fd02b9c7ef36f0807b4/sast/rule_extensions/tests/2e31dbe3-2f5f-432c-aab8-d7d51e1078cd"
},
"type": "tests"
}
}Get the SAST rule extension test status for a requested Snyk Code project.
Required permissions
group.rule_extension.read
API key value must be prefixed with "Token ".
Unique identifier for group in request path
b667f176-df52-4b0a-9954-117af6b05ab7Unique identifier for a test result
2e31dbe3-2f5f-432c-aab8-d7d51e1078cdRequested API version
2021-06-04Pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$Returns the status and url to poll for the test result with a retry-after header to indicate polling cadence.
Data is available at the location specified in the "location" header
Bad Request: one or more parameters are invalid. Check the input to match the expected format. See Snyk API
Unauthorized: the request requires an authentication token. See Revoke and regenerate a Snyk API token.
Forbidden: the request requires an authentication token with more or different permissions. Review token permissions and try again. See PAT permissions.
Not Found: The resource you are trying to access could not be found. Review the request and try again.
Internal Server Error: An unexpected error was encountered while attempting to process the request. Try again. If the error still occurs, contact support.
GET /rest/groups/{group_id}/sast/rule_extensions/tests/{test_id}?version=2021-06-04 HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
{
"data": {
"attributes": {
"code": "SNYK-CODE-0003",
"id": "f16c31b5-6129-4571-add8-d589da9be524",
"links": {
"about": "https://docs.snyk.io/scan-with-snyk/error-catalog#snyk-0003"
},
"meta": {
"classification": "ACTIONABLE",
"isErrorCatalogError": true,
"level": "error"
},
"status": "ERRORED",
"title": "Client request cannot be processed"
},
"id": "6d5ac645-9309-4ac8-9808-9bd5251785bb",
"links": {
"self": "/groups/b9ee05cf96cab612c1ce0fd02b9c7ef36f0807b4/sast/rule_extensions/tests/2e31dbe3-2f5f-432c-aab8-d7d51e1078cd"
},
"type": "tests"
}
}Get the test result of a Snyk Code project to understand the impact of the input SAST Rule Extension.
Required permissions
group.rule_extension.read
API key value must be prefixed with "Token ".
Unique identifier for group in request path
b667f176-df52-4b0a-9954-117af6b05ab7Unique identifier for a test result
2e31dbe3-2f5f-432c-aab8-d7d51e1078cdRequested API version
2021-06-04Pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$Returns the test results of the input SAST rule extension against a Snyk Code project.
Bad Request: one or more parameters are invalid. Check the input to match the expected format. See Snyk API
Unauthorized: the request requires an authentication token. See Revoke and regenerate a Snyk API token.
Forbidden: the request requires an authentication token with more or different permissions. Review token permissions and try again. See PAT permissions.
Not Found: The resource you are trying to access could not be found. Review the request and try again.
Internal Server Error: An unexpected error was encountered while attempting to process the request. Try again. If the error still occurs, contact support.
GET /rest/groups/{group_id}/sast/rule_extensions/tests/{test_id}/results?version=2021-06-04 HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
{
"data": {
"attributes": {
"added_findings": {
"changes": [
{
"file_path": "src/main/java/DemoController.java",
"location": {
"end_column": 30,
"end_line": 101,
"start_column": 15,
"start_line": 101
},
"priority_score": 856,
"rule_id": "javascript/XSS",
"severity": "medium"
}
],
"count": 1
},
"fully_qualified_name": "org.example.MySqlSanitizer",
"org_id": "123e4567-e89b-12d3-a456-426614174000",
"project_commit_sha": "24bf40375aee46daeffd2c260493b2d562fe2c90",
"project_id": "a3b8d4e1-7f1c-4a09-8b7e-2c6f5d1a0b3f",
"rule_keys": [
"XSS"
],
"total_count": 1,
"type": "if_true_sanitizer"
},
"id": "2e31dbe3-2f5f-432c-aab8-d7d51e1078cd",
"type": "results"
},
"links": {
"self": "/rest/groups/b9ee05cf96cab612c1ce0fd02b9c7ef36f0807b4/sast/rule_extensions/tests/2e31dbe3-2f5f-432c-aab8-d7d51e1078cd/results"
}
}Last updated
Was this helpful?

