Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

Params

Param name Description
name
optional

Image crop name

Validations:

  • Must be a String

aspect
optional

Image crop aspect ratio

Validations:

  • Must be a String

x
optional

Image crop X coordinate

Validations:

  • Must be a Integer

y
optional

Image crop Y coordinate

Validations:

  • Must be a Integer

height
optional

Image crop height

Validations:

  • Must be a Integer

width
optional

Image crop width

Validations:

  • Must be a Integer

zoom
optional

Image crop zoom for preview tool

Validations:

  • Must be a String

source_media_version
optional

Media version to use, defaults to 'original'

Validations:

  • Must be a String

Examples

// Successful request
POST /api/v2/assets/_dpDVO0UAPQcFHzFysei/image_crops/4
{
  "name": "16:9",
  "aspect": "1.778",
  "x": 960,
  "y": 540,
  "width": 480,
  "height": 270,
  "zoom": "1.00",
  "source_media_version": "original"
}
200
{
  "image_crop": {
    "name": "16:9",
    "aspect": 1.778,
    "x": 960,
    "y": 540,
    "width": 480,
    "height": 270,
    "zoom": 1.0,
    "source_media_version": "original",
    "id": 4
  }
}
// Asset not found
POST /api/v2/assets/:asset_id/image_crops/5
{
  "name": "16:9",
  "aspect": "1.778",
  "x": 960,
  "y": 540,
  "width": 480,
  "height": 270,
  "zoom": "1.00",
  "source_media_version": "original"
}
404
{
  "error": "asset not found"
}
// Image crop not found
POST /api/v2/assets/X_xf03UqAz_JkvF_PS1d/image_crops/:image_crop_id
{
  "name": "16:9",
  "aspect": "1.778",
  "x": 960,
  "y": 540,
  "width": 480,
  "height": 270,
  "zoom": "1.00",
  "source_media_version": "original"
}
404
{
  "error": "Couldn't find ImageCrop with 'id'=:image_crop_id [WHERE \"image_crops\".\"asset_id\" = $1]"
}
// Invalid parameters
POST /api/v2/assets/5x-MlA1ocaK31KMb1jFM/image_crops/6
{
  "name": "16:9",
  "aspect": "1.778",
  "x": 960,
  "y": 540,
  "width": 480,
  "height": 270,
  "zoom": "0.99",
  "source_media_version": "original"
}
400
{
  "error": "Validation failed: Zoom must be greater than or equal to 1.0"
}

Errors

Code Description
401 Unauthorized
404 Not found
500 Internal Server Error
422 Missing parameters