Skip to content

API: Images

Import an image file sent as the body of the request into a new image document, or as a layer of one

POST /api/v1/images/import/file: Import an image file sent as the body of the request into a new image document, or as a layer of one

Last updated:

POST/api/v1/images/import/file

Authentication#

Send the secret in the header Authorization: Bearer <secret>: the local token in local mode, an API key in network mode. An API key needs the edit scope; the local token has every scope. See the API overview for both modes.

Query parameters#

NameTypeRequiredDescription
namestringnoName of the new image document.
file_namestringnoFile name of the upload, used for the name and the format when name is not sent.
presetstringnoSize preset of the new document.
image_idstringnoImport as a layer of this image document instead of a new one.
widthintegernoWidth in pixels of the new document.. min 0
heightintegernoHeight in pixels of the new document.. min 0
base_revisionintegernoThe revision of the image the layer is added to; a stale one is E_STALE_REVISION.. min 0
wait_msintegernoWait up to this many milliseconds for the import to finish.. min 0
idempotency_keystringnoMakes a retry return the first answer; the Idempotency-Key header does the same.
dry_runbooleannoValidate and report, change nothing.

Responses#

200 OK#

Content type application/json. Schema: ImageImportResult.

NameTypeRequiredDescription
appliedbooleanno
createdbooleanno
dry_runbooleanno
findingsarray of Findingno
hashstringno
heightintegerno
image_idstringno
job_idstringno
layer_idstringno
lintLintTotalsno
namestringno
replayedbooleanno
revisioninteger (int64)no
statestringno
textstringno
untrusted_noticestringno
widthintegerno

401 Unauthorized#

Error (RFC 9457 problem details)

Content type application/problem+json. Schema: Problem.

403#

Error (RFC 9457 problem details)

Content type application/problem+json. Schema: Problem.

429#

Error (RFC 9457 problem details)

Content type application/problem+json. Schema: Problem.

Any other status#

Error (RFC 9457 problem details)

Content type application/problem+json. Schema: Problem.

curl -X POST "http://127.0.0.1:7878/api/v1/images/import/file" \
  -H "Authorization: Bearer $STUARTY_KEY"

Response examples

{
  "applied": false,
  "created": false,
  "dry_run": false,
  "findings": [
    {
      "code": "string",
      "hint": "string",
      "item": "string",
      "message": "string",
      "range": {},
      "severity": "string"
    }
  ],
  "hash": "string",
  "height": 0,
  "image_id": "string",
  "job_id": "string",
  "layer_id": "string",
  "lint": {
    "errors": 0,
    "lint_scope": "string",
    "warnings": 0
  },
  "name": "string",
  "replayed": false,
  "revision": 0,
  "state": "string",
  "text": "string",
  "untrusted_notice": "string",
  "width": 0
}

The examples are built from the schemas of the OpenAPI document, so a value is a placeholder of its type. The fields that carry the real values are in the tables.