For the complete documentation index, see llms.txt. This page is also available as Markdown.

SastRuleExtensions

Snyk API reference for the SastRuleExtensions endpoints, including request parameters and response schemas

This document uses the REST API. For more details, see the Authentication for API page.

Create a SAST rule extension

post

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
Authorizations
AuthorizationstringRequired

API key value must be prefixed with "Token ".

Path parameters
group_idstring · uuidRequired

Unique identifier for group in request path

Example: b667f176-df52-4b0a-9954-117af6b05ab7
Query parameters
versionstringRequired

Requested API version

Example: 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))?))$
Body
Responses
201

SAST rule extension successfully created. SAST rule extensions will only apply once published and assigned.

application/vnd.api+json
post/groups/{group_id}/sast/rule_extensions
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

get

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
Authorizations
AuthorizationstringRequired

API key value must be prefixed with "Token ".

Path parameters
group_idstring · uuidRequired

Unique identifier for group in request path

Example: b667f176-df52-4b0a-9954-117af6b05ab7
Query parameters
versionstringRequired

Requested API version

Example: 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))?))$
starting_afterstringOptional

Return the page of results immediately after this cursor

Example: v1.eyJpZCI6IjEwMDAifQo=
ending_beforestringOptional

Return the page of results immediately before this cursor

Example: v1.eyJpZCI6IjExMDAifQo=
limitinteger · int32 · min: 1 · max: 100Optional

Number of results to return per page

Default: 10Example: 10
Responses
200

Returns a list of all the SAST rule extensions associated with the requested Group ID and its child Org(s)

application/vnd.api+json
get/groups/{group_id}/sast/rule_extensions
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 a SAST rule extension by SAST rule extension ID

patch

Update the SAST rule extension for the requested SAST rule extension ID

Required permissions

  • group.rule_extension.edit
Authorizations
AuthorizationstringRequired

API key value must be prefixed with "Token ".

Path parameters
group_idstring · uuidRequired

Unique identifier for group in request path

Example: b667f176-df52-4b0a-9954-117af6b05ab7
rule_extension_idstring · uuidRequired

Unique identifier for SAST rule extension in request path

Example: 4a994d3b-d15e-45c3-bf24-6a26a02ed9ea
Query parameters
versionstringRequired

Requested API version

Example: 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))?))$
Body
Responses
200

SAST rule extension updated successfully.

application/vnd.api+json
patch/groups/{group_id}/sast/rule_extensions/{rule_extension_id}
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 a SAST rule extension by SAST rule extension ID

get

Get the SAST rule extension for the requested SAST rule extension ID

Required permissions

  • group.rule_extension.read
Authorizations
AuthorizationstringRequired

API key value must be prefixed with "Token ".

Path parameters
group_idstring · uuidRequired

Unique identifier for group in request path

Example: b667f176-df52-4b0a-9954-117af6b05ab7
rule_extension_idstring · uuidRequired

Unique identifier for SAST rule extension in request path

Example: 4a994d3b-d15e-45c3-bf24-6a26a02ed9ea
Query parameters
versionstringRequired

Requested API version

Example: 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))?))$
Responses
200

SAST rule extension retrieved successfully.

application/vnd.api+json
get/groups/{group_id}/sast/rule_extensions/{rule_extension_id}
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 a SAST rule extension by SAST rule extension ID

delete

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
Authorizations
AuthorizationstringRequired

API key value must be prefixed with "Token ".

Path parameters
group_idstring · uuidRequired

Unique identifier for group in request path

Example: b667f176-df52-4b0a-9954-117af6b05ab7
rule_extension_idstring · uuidRequired

Unique identifier for SAST rule extension in request path

Example: 4a994d3b-d15e-45c3-bf24-6a26a02ed9ea
Query parameters
versionstringRequired

Requested API version

Example: 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))?))$
Responses
204

SAST rule extension deleted successfully.

delete/groups/{group_id}/sast/rule_extensions/{rule_extension_id}
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

Trigger a SAST rule extension impact test.

post

Create a test on a Snyk Code project to understand the impact of the input SAST Rule Extension.

Required permissions

  • group.rule_extension.read
Authorizations
AuthorizationstringRequired

API key value must be prefixed with "Token ".

Path parameters
group_idstring · uuidRequired

Unique identifier for group in request path

Example: b667f176-df52-4b0a-9954-117af6b05ab7
Query parameters
versionstringRequired

Requested API version

Example: 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))?))$
Body
Responses
202

The operation was accepted but a result is not available at this time

application/vnd.api+json
post/groups/{group_id}/sast/rule_extensions/tests
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"
  }
}

Retrieve the SAST rule extension impact test status.

get

Get the SAST rule extension test status for a requested Snyk Code project.

Required permissions

  • group.rule_extension.read
Authorizations
AuthorizationstringRequired

API key value must be prefixed with "Token ".

Path parameters
group_idstring · uuidRequired

Unique identifier for group in request path

Example: b667f176-df52-4b0a-9954-117af6b05ab7
test_idstring · uuidRequired

Unique identifier for a test result

Example: 2e31dbe3-2f5f-432c-aab8-d7d51e1078cd
Query parameters
versionstringRequired

Requested API version

Example: 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))?))$
Responses
200

Returns the status and url to poll for the test result with a retry-after header to indicate polling cadence.

application/vnd.api+json
get/groups/{group_id}/sast/rule_extensions/tests/{test_id}
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"
  }
}

Retrieve the impact test result for a SAST rule extension.

get

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
Authorizations
AuthorizationstringRequired

API key value must be prefixed with "Token ".

Path parameters
group_idstring · uuidRequired

Unique identifier for group in request path

Example: b667f176-df52-4b0a-9954-117af6b05ab7
test_idstring · uuidRequired

Unique identifier for a test result

Example: 2e31dbe3-2f5f-432c-aab8-d7d51e1078cd
Query parameters
versionstringRequired

Requested API version

Example: 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))?))$
Responses
200

Returns the test results of the input SAST rule extension against a Snyk Code project.

application/vnd.api+json
get/groups/{group_id}/sast/rule_extensions/tests/{test_id}/results
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?