Policies
Create a new org-level policy.
Org level Policy APIs Access Notice: Access to our Org level Policy APIs is currently restricted via "snykCodeConsistentIgnores" feature flag and will result in a 403 Forbidden error without the flag enabled. Please contact your account representative for eligibility requirements.
Org ID
Requested API version
2021-06-04
Pattern: ^(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))?))$
POST /rest/orgs/{org_id}/policies HTTP/1.1
Host: api.snyk.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/vnd.api+json
Accept: */*
Content-Length: 304
{
"data": {
"attributes": {
"action": {
"data": {
"expires": "2024-03-16T00:00:00Z",
"ignore_type": "wont-fix",
"reason": "text"
}
},
"action_type": "ignore",
"conditions_group": {
"conditions": [
{
"field": "snyk/asset/finding/v1",
"operator": "includes",
"value": "text"
}
],
"logical_operator": "and"
},
"name": "text"
},
"type": "policy"
}
}
{
"data": {
"attributes": {
"action": {
"data": {
"expires": "2024-03-16T00:00:00Z",
"ignore_type": "wont-fix",
"reason": "text"
}
},
"action_type": "ignore",
"conditions_group": {
"conditions": [
{
"field": "snyk/asset/finding/v1",
"operator": "includes",
"value": "text"
}
],
"logical_operator": "and"
},
"created_at": "2024-03-16T00:00:00Z",
"created_by": {
"email": "text",
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "text"
},
"name": "text",
"review": "pending",
"updated_at": "2024-03-16T00:00:00Z"
},
"id": "f16c31b5-6129-4571-add8-d589da9be524",
"type": "policy"
},
"jsonapi": {
"version": "1.0"
},
"links": {
"self": "https://example.com/api/this_resource"
}
}
Get all policies for the requested organisation.
Org level Policy APIs Access Notice: Access to our Org level Policy APIs is currently restricted via "snykCodeConsistentIgnores" feature flag and will result in a 403 Forbidden error without the flag enabled. Please contact your account representative for eligibility requirements.
Org ID
Requested API version
2021-06-04
Pattern: ^(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
10
Example: 10
Select only policies with an expiry strictly before the given time.
2024-03-16T00:00:00Z
Select only policies with an expiry strictly past the given time.
2024-03-16T00:00:00Z
Select only policies that never expire.
true
GET /rest/orgs/{org_id}/policies HTTP/1.1
Host: api.snyk.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"data": [
{
"attributes": {
"action": {
"data": {
"expires": "2024-03-16T00:00:00Z",
"ignore_type": "wont-fix",
"reason": "text"
}
},
"action_type": "ignore",
"conditions_group": {
"conditions": [
{
"field": "snyk/asset/finding/v1",
"operator": "includes",
"value": "text"
}
],
"logical_operator": "and"
},
"created_at": "2024-03-16T00:00:00Z",
"created_by": {
"email": "text",
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "text"
},
"name": "text",
"review": "pending",
"updated_at": "2024-03-16T00:00:00Z"
},
"id": "f16c31b5-6129-4571-add8-d589da9be524",
"type": "policy"
}
],
"jsonapi": {
"version": "1.0"
},
"links": {
"first": "https://example.com/api/resource?ending_before=v1.eyJpZCI6IjExIn0K",
"last": "https://example.com/api/resource?starting_after=v1.eyJpZCI6IjMwIn0K",
"next": "https://example.com/api/resource?starting_after=v1.eyJpZCI6IjEwIn0K"
}
}
Update the org-level policy.
Org level Policy APIs Access Notice: Access to our Org level Policy APIs is currently restricted via "snykCodeConsistentIgnores" feature flag and will result in a 403 Forbidden error without the flag enabled. Please contact your account representative for eligibility requirements.
Org ID
Policy ID
Requested API version
2021-06-04
Pattern: ^(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))?))$
PATCH /rest/orgs/{org_id}/policies/{policy_id} HTTP/1.1
Host: api.snyk.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/vnd.api+json
Accept: */*
Content-Length: 439
{
"data": {
"attributes": {
"action": {
"data": {
"expires": "2024-03-16T00:00:00Z",
"ignore_type": "wont-fix",
"reason": "text"
}
},
"conditions_group": {
"conditions": [
{
"field": "snyk/asset/finding/v1",
"operator": "includes",
"value": "text"
}
],
"logical_operator": "and"
},
"name": "text",
"review": "pending"
},
"id": "f16c31b5-6129-4571-add8-d589da9be524",
"meta": {
"key1": "value1",
"key2": {
"sub_key": "sub_value"
},
"key3": [
"array_value1",
"array_value2"
]
},
"type": "policy"
}
}
{
"data": {
"attributes": {
"action": {
"data": {
"expires": "2024-03-16T00:00:00Z",
"ignore_type": "wont-fix",
"reason": "text"
}
},
"action_type": "ignore",
"conditions_group": {
"conditions": [
{
"field": "snyk/asset/finding/v1",
"operator": "includes",
"value": "text"
}
],
"logical_operator": "and"
},
"created_at": "2024-03-16T00:00:00Z",
"created_by": {
"email": "text",
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "text"
},
"name": "text",
"review": "pending",
"updated_at": "2024-03-16T00:00:00Z"
},
"id": "f16c31b5-6129-4571-add8-d589da9be524",
"type": "policy"
},
"jsonapi": {
"version": "1.0"
},
"links": {
"self": "https://example.com/api/this_resource"
}
}
Get a specific org-level policy based on its ID.
Org level Policy APIs Access Notice: Access to our Org level Policy APIs is currently restricted via "snykCodeConsistentIgnores" feature flag and will result in a 403 Forbidden error without the flag enabled. Please contact your account representative for eligibility requirements.
Org ID
Policy ID
Requested API version
2021-06-04
Pattern: ^(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))?))$
GET /rest/orgs/{org_id}/policies/{policy_id} HTTP/1.1
Host: api.snyk.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"data": {
"attributes": {
"action": {
"data": {
"expires": "2024-03-16T00:00:00Z",
"ignore_type": "wont-fix",
"reason": "text"
}
},
"action_type": "ignore",
"conditions_group": {
"conditions": [
{
"field": "snyk/asset/finding/v1",
"operator": "includes",
"value": "text"
}
],
"logical_operator": "and"
},
"created_at": "2024-03-16T00:00:00Z",
"created_by": {
"email": "text",
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "text"
},
"name": "text",
"review": "pending",
"updated_at": "2024-03-16T00:00:00Z"
},
"id": "f16c31b5-6129-4571-add8-d589da9be524",
"type": "policy"
},
"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"
}
}
Delete an existing org-level policy.
Org level Policy APIs Access Notice: Access to our Org level Policy APIs is currently restricted via "snykCodeConsistentIgnores" feature flag and will result in a 403 Forbidden error without the flag enabled. Please contact your account representative for eligibility requirements.
Org ID
Policy ID
Requested API version
2021-06-04
Pattern: ^(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))?))$
DELETE /rest/orgs/{org_id}/policies/{policy_id} HTTP/1.1
Host: api.snyk.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
No content
Last updated
Was this helpful?