Skip to content

API: Images

Import an image file into a new image document, or as a layer of one

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

Last updated:

POST/api/v1/images/import

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.

Request body#

Content type application/json.

NameTypeRequiredDescription
base_revisioninteger (int64)noWith image_id: the revision the layer was planned against.
dry_runbooleanno
hashstringnosha256: and 64 hex characters: an image already in the workspace, instead of path.
heightintegernoThe canvas of a new document, with width.
idempotency_keystringnoWith image_id: 8 to 64 characters; the Idempotency-Key header is the same.
image_idstringnoPut the file in this document as one more layer; without it a new document is made.
namestringnoThe name of the new document, or of the layer when image_id is given; default the name of the file.
pathstringnoAn absolute path to an image file on the machine of the server, read with the rules of media:import.
presetstringnoThe canvas of a new document: video_thumbnail, square_post or vertical_cover.
wait_msintegernoHow long to wait for the ingest of the file, 0 to 25000; default 10000.
widthintegernoThe canvas of a new document, with height; default the size of the file when it fits 4096.

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

400#

Validation failed; errors maps each field to its messages and issues lists each problem with its code, key and params

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

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.

409#

Error (RFC 9457 problem details)

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

422 Unprocessable Content#

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" \
  -H "Authorization: Bearer $STUARTY_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

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.