Create a variant

Specify variants that allow you to resize images for different use cases.

/accounts/{account_identifier}/images/v1/variants

post

Cloudflare Images Variants

cloudflare-images-variants-create-a-variant

Debug "planAvailability"

null

Debug "tokenPermissions"

null

Debug "parameters"

[
  {
    "in": "path",
    "name": "account_identifier",
    "required": true,
    "schema": {
      "description": "Account identifier tag.",
      "example": "023e105f4ecef8ad9ca31a8372d0c353",
      "maxLength": 32,
      "readOnly": true,
      "type": "string"
    }
  }
]

Debug "requestBody"

{
  "content": {
    "application/json": {
      "schema": {
        "properties": {
          "id": {
            "example": "hero",
            "maxLength": 99,
            "pattern": "^[a-zA-Z0-9]$"
          },
          "neverRequireSignedURLs": {
            "default": false,
            "description": "Indicates whether the variant can access an image without a signature, regardless of image access control.",
            "example": true,
            "type": "boolean"
          },
          "options": {
            "description": "Allows you to define image resizing sizes for different use cases.",
            "properties": {
              "fit": {
                "description": "The fit property describes how the width and height dimensions should be interpreted.",
                "enum": [
                  "scale-down",
                  "contain",
                  "cover",
                  "crop",
                  "pad"
                ],
                "example": "scale-down",
                "type": "string"
              },
              "height": {
                "description": "Maximum height in image pixels.",
                "example": 768,
                "minimum": 1,
                "type": "number"
              },
              "metadata": {
                "description": "What EXIF data should be preserved in the output image.",
                "enum": [
                  "keep",
                  "copyright",
                  "none"
                ],
                "example": "none",
                "type": "string"
              },
              "width": {
                "description": "Maximum width in image pixels.",
                "example": 1366,
                "minimum": 1,
                "type": "number"
              }
            },
            "required": [
              "fit",
              "metadata",
              "width",
              "height"
            ],
            "type": "object"
          }
        },
        "required": [
          "id",
          "options"
        ],
        "type": "object"
      }
    }
  },
  "required": true
}

Debug "responses"

{
  "200": {
    "content": {
      "application/json": {
        "schema": {
          "allOf": [
            {
              "allOf": [
                {
                  "properties": {
                    "errors": {
                      "example": [],
                      "items": {
                        "properties": {
                          "code": {
                            "minimum": 1000,
                            "type": "integer"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "code",
                          "message"
                        ],
                        "type": "object",
                        "uniqueItems": true
                      },
                      "type": "array"
                    },
                    "messages": {
                      "example": [],
                      "items": {
                        "properties": {
                          "code": {
                            "minimum": 1000,
                            "type": "integer"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "code",
                          "message"
                        ],
                        "type": "object",
                        "uniqueItems": true
                      },
                      "type": "array"
                    },
                    "result": {
                      "anyOf": [
                        {
                          "type": "object"
                        },
                        {
                          "items": {},
                          "type": "array"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    },
                    "success": {
                      "description": "Whether the API call was successful",
                      "enum": [
                        true
                      ],
                      "example": true,
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "success",
                    "errors",
                    "messages",
                    "result"
                  ],
                  "type": "object"
                },
                {
                  "properties": {
                    "result": {
                      "anyOf": [
                        {
                          "type": "object"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    }
                  }
                }
              ],
              "type": "object"
            },
            {
              "properties": {
                "result": {
                  "properties": {
                    "variant": {
                      "properties": {
                        "id": {
                          "example": "hero",
                          "maxLength": 99,
                          "pattern": "^[a-zA-Z0-9]$"
                        },
                        "neverRequireSignedURLs": {
                          "default": false,
                          "description": "Indicates whether the variant can access an image without a signature, regardless of image access control.",
                          "example": true,
                          "type": "boolean"
                        },
                        "options": {
                          "description": "Allows you to define image resizing sizes for different use cases.",
                          "properties": {
                            "fit": {
                              "description": "The fit property describes how the width and height dimensions should be interpreted.",
                              "enum": [
                                "scale-down",
                                "contain",
                                "cover",
                                "crop",
                                "pad"
                              ],
                              "example": "scale-down",
                              "type": "string"
                            },
                            "height": {
                              "description": "Maximum height in image pixels.",
                              "example": 768,
                              "minimum": 1,
                              "type": "number"
                            },
                            "metadata": {
                              "description": "What EXIF data should be preserved in the output image.",
                              "enum": [
                                "keep",
                                "copyright",
                                "none"
                              ],
                              "example": "none",
                              "type": "string"
                            },
                            "width": {
                              "description": "Maximum width in image pixels.",
                              "example": 1366,
                              "minimum": 1,
                              "type": "number"
                            }
                          },
                          "required": [
                            "fit",
                            "metadata",
                            "width",
                            "height"
                          ],
                          "type": "object"
                        }
                      },
                      "required": [
                        "id",
                        "options"
                      ],
                      "type": "object"
                    }
                  },
                  "type": "object"
                }
              }
            }
          ]
        }
      }
    },
    "description": "Create a variant response"
  },
  "4XX": {
    "content": {
      "application/json": {
        "schema": {
          "allOf": [
            {
              "allOf": [
                {
                  "allOf": [
                    {
                      "properties": {
                        "errors": {
                          "example": [],
                          "items": {
                            "properties": {
                              "code": {
                                "minimum": 1000,
                                "type": "integer"
                              },
                              "message": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "code",
                              "message"
                            ],
                            "type": "object",
                            "uniqueItems": true
                          },
                          "type": "array"
                        },
                        "messages": {
                          "example": [],
                          "items": {
                            "properties": {
                              "code": {
                                "minimum": 1000,
                                "type": "integer"
                              },
                              "message": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "code",
                              "message"
                            ],
                            "type": "object",
                            "uniqueItems": true
                          },
                          "type": "array"
                        },
                        "result": {
                          "anyOf": [
                            {
                              "type": "object"
                            },
                            {
                              "items": {},
                              "type": "array"
                            },
                            {
                              "type": "string"
                            }
                          ]
                        },
                        "success": {
                          "description": "Whether the API call was successful",
                          "enum": [
                            true
                          ],
                          "example": true,
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "success",
                        "errors",
                        "messages",
                        "result"
                      ],
                      "type": "object"
                    },
                    {
                      "properties": {
                        "result": {
                          "anyOf": [
                            {
                              "type": "object"
                            },
                            {
                              "type": "string"
                            }
                          ]
                        }
                      }
                    }
                  ],
                  "type": "object"
                },
                {
                  "properties": {
                    "result": {
                      "properties": {
                        "variant": {
                          "properties": {
                            "id": {
                              "example": "hero",
                              "maxLength": 99,
                              "pattern": "^[a-zA-Z0-9]$"
                            },
                            "neverRequireSignedURLs": {
                              "default": false,
                              "description": "Indicates whether the variant can access an image without a signature, regardless of image access control.",
                              "example": true,
                              "type": "boolean"
                            },
                            "options": {
                              "description": "Allows you to define image resizing sizes for different use cases.",
                              "properties": {
                                "fit": {
                                  "description": "The fit property describes how the width and height dimensions should be interpreted.",
                                  "enum": [
                                    "scale-down",
                                    "contain",
                                    "cover",
                                    "crop",
                                    "pad"
                                  ],
                                  "example": "scale-down",
                                  "type": "string"
                                },
                                "height": {
                                  "description": "Maximum height in image pixels.",
                                  "example": 768,
                                  "minimum": 1,
                                  "type": "number"
                                },
                                "metadata": {
                                  "description": "What EXIF data should be preserved in the output image.",
                                  "enum": [
                                    "keep",
                                    "copyright",
                                    "none"
                                  ],
                                  "example": "none",
                                  "type": "string"
                                },
                                "width": {
                                  "description": "Maximum width in image pixels.",
                                  "example": 1366,
                                  "minimum": 1,
                                  "type": "number"
                                }
                              },
                              "required": [
                                "fit",
                                "metadata",
                                "width",
                                "height"
                              ],
                              "type": "object"
                            }
                          },
                          "required": [
                            "id",
                            "options"
                          ],
                          "type": "object"
                        }
                      },
                      "type": "object"
                    }
                  }
                }
              ]
            },
            {
              "properties": {
                "errors": {
                  "allOf": [
                    {
                      "example": [],
                      "items": {
                        "properties": {
                          "code": {
                            "minimum": 1000,
                            "type": "integer"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "code",
                          "message"
                        ],
                        "type": "object",
                        "uniqueItems": true
                      },
                      "type": "array"
                    }
                  ],
                  "example": [
                    {
                      "code": 7003,
                      "message": "No route for the URI"
                    }
                  ],
                  "minLength": 1
                },
                "messages": {
                  "allOf": [
                    {
                      "example": [],
                      "items": {
                        "properties": {
                          "code": {
                            "minimum": 1000,
                            "type": "integer"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "code",
                          "message"
                        ],
                        "type": "object",
                        "uniqueItems": true
                      },
                      "type": "array"
                    }
                  ],
                  "example": []
                },
                "result": {
                  "enum": [
                    null
                  ],
                  "nullable": true,
                  "type": "object"
                },
                "success": {
                  "description": "Whether the API call was successful",
                  "enum": [
                    false
                  ],
                  "example": false,
                  "type": "boolean"
                }
              },
              "required": [
                "success",
                "errors",
                "messages",
                "result"
              ],
              "type": "object"
            }
          ]
        }
      }
    },
    "description": "Create a variant response failure"
  }
}

Debug "security"

[
  {
    "api_token": []
  },
  {
    "api_email": [],
    "api_key": []
  }
]