Custom Base Images

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

Create a Custom Base Image from an existing container project

post

In order to create a custom base image, you first need to import your base images into Snyk. You can do this through the CLI, UI, or API.

This endpoint marks an image as a custom base image. This means that the image will get added to the pool of images from which Snyk can recommend base image upgrades.

Note, after the first image in a repository gets added, a versioning schema cannot be passed in this endpoint. To update the versioning schema, the PATCH endpoint must be used.

Authorizations
AuthorizationstringRequired

API key value must be prefixed with "Token ".

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
post
/custom_base_images
POST /rest/custom_base_images?version=text HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Content-Type: application/vnd.api+json
Accept: */*
Content-Length: 176

{
  "data": {
    "attributes": {
      "include_in_recommendations": true,
      "project_id": "2cab3939-d112-4ef0-836d-e09c87cbe69b",
      "versioning_schema": {
        "type": "semver"
      }
    },
    "type": "custom_base_image"
  }
}
{
  "data": {
    "attributes": {
      "include_in_recommendations": true,
      "project_id": "2cab3939-d112-4ef0-836d-e09c87cbe69b",
      "versioning_schema": {
        "type": "semver"
      }
    },
    "id": "2cab3939-d112-4ef0-836d-e09c87cbe69b",
    "type": "custom_base_image"
  },
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "self": "https://example.com/api/this_resource"
  }
}

Get a custom base image collection

get

Get a list of custom base images with support for ordering and filtering. Either the org_id or group_id parameters must be set to authorize successfully. If sorting by version, the repository filter is required.

Authorizations
AuthorizationstringRequired

API key value must be prefixed with "Token ".

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: 10 · max: 100Optional

Number of results to return per page

Default: 10Example: 10
project_idstring · uuidOptional

The ID of the container project that the custom base image is based off of.

org_idstring · uuidOptional

The organization ID of the custom base image

group_idstring · uuidOptional

The group ID of the custom base image

repositorystringOptional

The image repository

tagstringOptional

The image tag

include_in_recommendationsbooleanOptional

Whether this image should be recommended as a base image upgrade

sort_bystring · enumOptional

Which column to sort by. If sorting by version, the versioning schema is used.

Possible values:
sort_directionstring · enumOptional

Which direction to sort

Default: ASCPossible values:
Responses
200

Returns custom base images

application/vnd.api+json
get
/custom_base_images
GET /rest/custom_base_images?version=text HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
{
  "data": [
    {
      "attributes": {
        "group_id": "123e4567-e89b-12d3-a456-426614174000",
        "include_in_recommendations": true,
        "org_id": "123e4567-e89b-12d3-a456-426614174000",
        "project_id": "123e4567-e89b-12d3-a456-426614174000",
        "repository": "text",
        "tag": "text"
      },
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "type": "text"
    }
  ],
  "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 a custom base image

patch

Updates a custom base image's attributes

Authorizations
AuthorizationstringRequired

API key value must be prefixed with "Token ".

Path parameters
custombaseimage_idstring · uuidRequired

Unique identifier for custom base image

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

Returns the updated custom base image

application/vnd.api+json
patch
/custom_base_images/{custombaseimage_id}
PATCH /rest/custom_base_images/{custombaseimage_id}?version=text HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Content-Type: application/vnd.api+json
Accept: */*
Content-Length: 168

{
  "data": {
    "attributes": {
      "include_in_recommendations": true,
      "versioning_schema": {
        "type": "semver"
      }
    },
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "type": "custom_base_image"
  }
}
{
  "data": {
    "attributes": {
      "include_in_recommendations": true,
      "project_id": "2cab3939-d112-4ef0-836d-e09c87cbe69b",
      "versioning_schema": {
        "type": "semver"
      }
    },
    "id": "2cab3939-d112-4ef0-836d-e09c87cbe69b",
    "type": "custom_base_image"
  },
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "self": "https://example.com/api/this_resource"
  }
}

Get a custom base image

get

Get a custom base image

Authorizations
AuthorizationstringRequired

API key value must be prefixed with "Token ".

Path parameters
custombaseimage_idstring · uuidRequired

Unique identifier for custom base image

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 a custom base image

application/vnd.api+json
get
/custom_base_images/{custombaseimage_id}
GET /rest/custom_base_images/{custombaseimage_id}?version=text HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
{
  "data": {
    "attributes": {
      "include_in_recommendations": true,
      "project_id": "2cab3939-d112-4ef0-836d-e09c87cbe69b",
      "versioning_schema": {
        "type": "semver"
      }
    },
    "id": "2cab3939-d112-4ef0-836d-e09c87cbe69b",
    "type": "custom_base_image"
  },
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "self": "https://example.com/api/this_resource"
  }
}

Delete a custom base image

delete

Delete a custom base image resource. (the related container project is unaffected)

Authorizations
AuthorizationstringRequired

API key value must be prefixed with "Token ".

Path parameters
custombaseimage_idstring · uuidRequired

Unique identifier for custom base image

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
delete
/custom_base_images/{custombaseimage_id}
DELETE /rest/custom_base_images/{custombaseimage_id}?version=text HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*

No content

Last updated

Was this helpful?