Cloud
Create and trigger a new scan for an environment
Required permissions
Create scans (org.cloud_scans.create)
Organization ID
9a46d918-8764-458c-1234-0987abcd6543
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))?))$
Created scan successfully
Bad Request: A parameter provided as a part of the request was invalid.
Unauthorized: the request requires an authentication token.
Forbidden: the request requires an authentication token with more or different permissions.
Not Found: The resource being operated on could not be found.
Conflict: The requested operation conflicts with the current state of the resource in some way.
Internal Server Error: An error was encountered while attempting to process the request.
POST /rest/orgs/{org_id}/cloud/scans HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Content-Type: application/vnd.api+json
Accept: */*
Content-Length: 148
{
"data": {
"attributes": {},
"relationships": {
"environment": {
"data": {
"id": "12000000-0000-0000-0000-000000000000",
"type": "environment"
}
}
},
"type": "scan"
}
}
{
"data": {
"attributes": {
"created_at": "2022-05-06T12:25:15-04:00",
"error": "",
"finished_at": "2022-05-06T12:25:15-04:00",
"kind": "user_initiated",
"options": {
"role_arn": "arn:aws:iam::123456789012:role/SnykCloud1234"
},
"revision": 1,
"status": "success",
"updated_at": "2022-05-06T12:25:15-04:00"
},
"id": "d5b640e5-d88c-4c17-9bf0-93597b7a1ce2",
"relationships": {
"environment": {
"data": {
"id": "12000000-0000-0000-0000-000000000000",
"type": "environment"
},
"links": {
"related": "/path/to/<related resource>/<related-id>?version=<resolved version>&..."
}
},
"organization": {
"data": {
"id": "10000000-0000-0000-0000-000000000000",
"type": "organization"
},
"links": {
"related": "/path/to/<related resource>/<related-id>?version=<resolved version>&..."
}
}
},
"type": "scan"
},
"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"
}
}
List scans for an organization
Required permissions
View scans (org.cloud_scans.read)
Organization ID
9a46d918-8764-458c-1234-0987abcd6543
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
Returns a list of scan instances
Bad Request: A parameter provided as a part of the request was invalid.
Unauthorized: the request requires an authentication token.
Forbidden: the request requires an authentication token with more or different permissions.
Not Found: The resource being operated on could not be found.
Conflict: The requested operation conflicts with the current state of the resource in some way.
Internal Server Error: An error was encountered while attempting to process the request.
GET /rest/orgs/{org_id}/cloud/scans HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
{
"data": [
{
"attributes": {
"created_at": "2022-05-06T12:25:15-04:00",
"error": "",
"finished_at": "2022-05-06T12:25:15-04:00",
"kind": "user_initiated",
"options": {
"role_arn": "arn:aws:iam::123456789012:role/SnykCloud1234"
},
"revision": 1,
"status": "success",
"updated_at": "2022-05-06T12:25:15-04:00"
},
"id": "d5b640e5-d88c-4c17-9bf0-93597b7a1ce2",
"relationships": {
"environment": {
"data": {
"id": "12000000-0000-0000-0000-000000000000",
"type": "environment"
},
"links": {
"related": "/path/to/<related resource>/<related-id>?version=<resolved version>&..."
}
},
"organization": {
"data": {
"id": "10000000-0000-0000-0000-000000000000",
"type": "organization"
},
"links": {
"related": "/path/to/<related resource>/<related-id>?version=<resolved version>&..."
}
}
},
"type": "scan"
}
],
"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"
}
}
Get a single scan for an organization
Required permissions
View scans (org.cloud_scans.read)
Organization ID
9a46d918-8764-458c-1234-0987abcd6543
Scan ID
56465b1d-8764-458c-1234-0987abcd6543
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))?))$
Returns a single scan instance
Bad Request: A parameter provided as a part of the request was invalid.
Unauthorized: the request requires an authentication token.
Forbidden: the request requires an authentication token with more or different permissions.
Not Found: The resource being operated on could not be found.
Conflict: The requested operation conflicts with the current state of the resource in some way.
Internal Server Error: An error was encountered while attempting to process the request.
GET /rest/orgs/{org_id}/cloud/scans/{scan_id} HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
{
"data": {
"attributes": {
"created_at": "2022-05-06T12:25:15-04:00",
"error": "",
"finished_at": "2022-05-06T12:25:15-04:00",
"kind": "user_initiated",
"options": {
"role_arn": "arn:aws:iam::123456789012:role/SnykCloud1234"
},
"revision": 1,
"status": "success",
"updated_at": "2022-05-06T12:25:15-04:00"
},
"id": "d5b640e5-d88c-4c17-9bf0-93597b7a1ce2",
"relationships": {
"environment": {
"data": {
"id": "12000000-0000-0000-0000-000000000000",
"type": "environment"
},
"links": {
"related": "/path/to/<related resource>/<related-id>?version=<resolved version>&..."
}
},
"organization": {
"data": {
"id": "10000000-0000-0000-0000-000000000000",
"type": "organization"
},
"links": {
"related": "/path/to/<related resource>/<related-id>?version=<resolved version>&..."
}
}
},
"type": "scan"
},
"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"
}
}
List resources for an organization
Required permissions
View resources (org.cloud_resources.read)
Organization ID
9a46d918-8764-458c-1234-0987abcd6543
Filter resources by environment ID (multi-value, comma-separated)
052781a7-17f6-494d-0000-25c8b509abcd
Filter resources by resource type (multi-value, comma-separated)
aws_s3_bucket
Filter resources by resource ID (multi-value, comma-separated)
example-bucket
Filter resources by native ID (multi-value, comma-separated) (AWS ARN)
arn:aws:s3:::example-bucket
Filter resources by resource UUID (multi-value, comma-separated)
4a662442-7445-55c3-adcc-cbbbdd99999
Filter resources by platform (multi-value, comma-separated): aws
aws
Filter resources by name (multi-value, comma-separated)
example-bucket
Kind of resource: cloud
cloud - cloud - iac
Filter resources by location (multi-value, comma-separated) (AWS region)
us-west-2
Filter resources by whether they have been removed or not.
true
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
Returns a list of resources
Bad Request: A parameter provided as a part of the request was invalid.
Unauthorized: the request requires an authentication token.
Forbidden: the request requires an authentication token with more or different permissions.
Not Found: The resource being operated on could not be found.
Conflict: The requested operation conflicts with the current state of the resource in some way.
Internal Server Error: An error was encountered while attempting to process the request.
GET /rest/orgs/{org_id}/cloud/resources HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
{
"data": [
{
"attributes": {
"created_at": "2022-08-10T17:19:33.14749Z",
"hash": "3333342563a86c675333de5848c9220a7bb35c039e7b9c0688c10f72b4666666",
"kind": "runtime",
"location": "us-west-2",
"name": "example-bucket",
"namespace": "us-west-2",
"native_id": "arn:aws:s3:::example-bucket",
"options": "json here",
"origin": "aws-account",
"platform": "aws",
"resource_id": "example-bucket",
"resource_type": "aws_s3_bucket",
"revision": 1,
"state": {
"acl": "private",
"arn": "arn:aws:s3:::example-bucket",
"bucket": "example-bucket"
},
"tags": {
"stage": "prod"
},
"updated_at": "2022-08-10T17:19:33.14749Z"
},
"id": "d5b640e5-d88c-4c17-9bf0-93597b7a1ce2",
"relationships": {
"environment": {
"data": {
"id": "11000000-0000-0000-0000-000000000000",
"type": "environment"
},
"links": {
"related": "/path/to/<related resource>/<related-id>?version=<resolved version>&..."
}
},
"organization": {
"data": {
"id": "10000000-0000-0000-0000-000000000000",
"type": "organization"
},
"links": {
"related": "/path/to/<related resource>/<related-id>?version=<resolved version>&..."
}
},
"scan": {
"data": {
"id": "12000000-0000-0000-0000-000000000000",
"type": "scan"
},
"links": {
"related": "/path/to/<related resource>/<related-id>?version=<resolved version>&..."
}
}
},
"type": "resource"
}
],
"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"
}
}
Generate IAC template for Snyk to access your cloud resources
Required permissions
Create environments (org.cloud_environments.create)
Organization ID
9a46d918-8764-458c-1234-0987abcd6543
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))?))$
Created permissions successfully
Bad Request: A parameter provided as a part of the request was invalid.
Unauthorized: the request requires an authentication token.
Forbidden: the request requires an authentication token with more or different permissions.
Not Found: The resource being operated on could not be found.
Conflict: The requested operation conflicts with the current state of the resource in some way.
Internal Server Error: An error was encountered while attempting to process the request.
POST /rest/orgs/{org_id}/cloud/permissions HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Content-Type: application/vnd.api+json
Accept: */*
Content-Length: 74
{
"data": {
"attributes": {
"platform": "aws",
"type": "cf"
},
"type": "permission"
}
}
{
"data": {
"attributes": {
"data": "text",
"type": "cf"
},
"id": "d5b640e5-d88c-4c17-9bf0-93597b7a1ce2",
"type": "permission"
},
"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"
}
}
Create a new environment and run a scan
Required permissions
Create environments (org.cloud_environments.create)
Organization ID
9a46d918-8764-458c-1234-0987abcd6543
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))?))$
Created environment successfully
Bad Request: A parameter provided as a part of the request was invalid.
Unauthorized: the request requires an authentication token.
Forbidden: the request requires an authentication token with more or different permissions.
Not Found: The resource being operated on could not be found.
Conflict: The requested operation conflicts with the current state of the resource in some way.
Internal Server Error: An error was encountered while attempting to process the request.
POST /rest/orgs/{org_id}/cloud/environments HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Content-Type: application/vnd.api+json
Accept: */*
Content-Length: 129
{
"data": {
"attributes": {
"kind": "aws",
"options": {
"role_arn": "arn:aws:iam::336447867772:role/SnykCloud1234"
}
},
"type": "environment"
}
}
{
"data": {
"attributes": {
"created_at": "2022-05-06T12:25:15-04:00",
"kind": "aws",
"name": "Demo AWS Environment",
"native_id": "12345678910",
"options": {
"role_arn": "arn:aws:iam::123456789012:role/SnykCloud1234"
},
"properties": {
"account_id": "123456789012"
},
"revision": 1,
"status": "success",
"updated_at": "2022-05-06T12:25:15-04:00"
},
"id": "d5b640e5-d88c-4c17-9bf0-93597b7a1ce2",
"relationships": {
"organization": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "organization"
},
"links": {
"related": "/path/to/<related resource>/<related-id>?version=<resolved version>&..."
}
},
"project": {
"data": {
"id": "11111111-1111-11111-1111-111111111111",
"type": "project"
}
}
},
"type": "environment"
},
"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"
}
}
List environments for an organization
Required permissions
View environments (org.cloud_environments.read)
Organization ID
9a46d918-8764-458c-1234-0987abcd6543
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 environments created after this date
2022-05-06T12:25:15-04:00
Return environments created before this date
2022-05-06T12:25:15-04:00
Return environments updated after this date
2022-05-06T12:25:15-04:00
Return environments updated before this date
2022-05-06T12:25:15-04:00
Environment name
Demo AWS Environment
Environment kind: aws
aws
Possible values: Filter environments by latest scan status (multi-value, comma-separated)
error
Possible values: Filter environments by environment ID (multi-value, comma-separated)
052781a7-17f6-494d-0000-25c8b509abcd
Filter environments by project ID
9a46d918-8764-458c-1234-0987abcd6543
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
Returns a list of environments
Bad Request: A parameter provided as a part of the request was invalid.
Unauthorized: the request requires an authentication token.
Forbidden: the request requires an authentication token with more or different permissions.
Not Found: The resource being operated on could not be found.
Conflict: The requested operation conflicts with the current state of the resource in some way.
Internal Server Error: An error was encountered while attempting to process the request.
GET /rest/orgs/{org_id}/cloud/environments HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
{
"data": [
{
"attributes": {
"created_at": "2022-05-06T12:25:15-04:00",
"kind": "aws",
"name": "Demo AWS Environment",
"native_id": "12345678910",
"options": {
"role_arn": "arn:aws:iam::123456789012:role/SnykCloud1234"
},
"properties": {
"account_id": "123456789012"
},
"revision": 1,
"status": "success",
"updated_at": "2022-05-06T12:25:15-04:00"
},
"id": "d5b640e5-d88c-4c17-9bf0-93597b7a1ce2",
"relationships": {
"organization": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "organization"
},
"links": {
"related": "/path/to/<related resource>/<related-id>?version=<resolved version>&..."
}
},
"project": {
"data": {
"id": "11111111-1111-11111-1111-111111111111",
"type": "project"
}
}
},
"type": "environment"
}
],
"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 an environment
Required permissions
Update environments (org.cloud_environments.edit)
Organization ID
9a46d918-8764-458c-1234-0987abcd6543
Unique identifier for an environment
052781a7-17f6-494d-0000-25c8b509abcd
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))?))$
Updated an environment successfully
Bad Request: A parameter provided as a part of the request was invalid.
Unauthorized: the request requires an authentication token.
Forbidden: the request requires an authentication token with more or different permissions.
Not Found: The resource being operated on could not be found.
Conflict: The requested operation conflicts with the current state of the resource in some way.
Internal Server Error: An error was encountered while attempting to process the request.
PATCH /rest/orgs/{org_id}/cloud/environments/{environment_id} HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Content-Type: application/vnd.api+json
Accept: */*
Content-Length: 160
{
"data": {
"attributes": {
"options": {
"role_arn": "arn:aws:iam::123456789012:role/SnykCloud1234"
}
},
"id": "d5b640e5-d88c-4c17-9bf0-93597b7a1ce2",
"type": "environment"
}
}
{
"data": {
"attributes": {
"created_at": "2022-05-06T12:25:15-04:00",
"kind": "aws",
"name": "Demo AWS Environment",
"native_id": "12345678910",
"options": {
"role_arn": "arn:aws:iam::123456789012:role/SnykCloud1234"
},
"properties": {
"account_id": "123456789012"
},
"revision": 1,
"status": "success",
"updated_at": "2022-05-06T12:25:15-04:00"
},
"id": "d5b640e5-d88c-4c17-9bf0-93597b7a1ce2",
"relationships": {
"organization": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "organization"
},
"links": {
"related": "/path/to/<related resource>/<related-id>?version=<resolved version>&..."
}
},
"project": {
"data": {
"id": "11111111-1111-11111-1111-111111111111",
"type": "project"
}
}
},
"type": "environment"
},
"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"
}
}
Delete an environment
Required permissions
Delete environments (org.cloud_environments.delete)
Organization ID
9a46d918-8764-458c-1234-0987abcd6543
Unique identifier for an environment
052781a7-17f6-494d-0000-25c8b509abcd
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))?))$
Returns an empty response
Bad Request: A parameter provided as a part of the request was invalid.
Unauthorized: the request requires an authentication token.
Forbidden: the request requires an authentication token with more or different permissions.
Not Found: The resource being operated on could not be found.
Conflict: The requested operation conflicts with the current state of the resource in some way.
Internal Server Error: An error was encountered while attempting to process the request.
DELETE /rest/orgs/{org_id}/cloud/environments/{environment_id} HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
No content
Last updated
Was this helpful?