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
required

Image crop aspect ratio

Validations:

  • Must be a String

x
required

Image crop X coordinate

Validations:

  • Must be a Integer

y
required

Image crop Y coordinate

Validations:

  • Must be a Integer

height
required

Image crop height

Validations:

  • Must be a Integer

width
required

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/K88L3y2cMCLeqtZSTvec/image_crops
{
  "name": "16:9",
  "aspect": "1.778",
  "x": 960,
  "y": 540,
  "width": 480,
  "height": 270,
  "zoom": "1.00",
  "source_media_version": "original"
}
200
{
  "image_crop": {
    "id": 3,
    "name": "16:9",
    "aspect": 1.778,
    "x": 960,
    "y": 540,
    "width": 480,
    "height": 270,
    "zoom": 1.0,
    "source_media_version": "original"
  }
}
// Asset not found
POST /api/v2/assets/:asset_id/image_crops
{
  "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"
}
// Invalid parameters
POST /api/v2/assets/Lh3Ky6TZsF3jHKsZVSLM/image_crops
{
  "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