---
title: Create a variant
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/typescript)

[Images](https://developers.cloudflare.com/api/typescript/resources/images)

[V1](https://developers.cloudflare.com/api/typescript/resources/images/subresources/v1)

[Variants](https://developers.cloudflare.com/api/typescript/resources/images/subresources/v1/subresources/variants)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Create a variant

client.images.v1.variants.create(VariantCreateParams {account\_id, id, options, neverRequireSignedURLs } params, RequestOptionsoptions?): [VariantCreateResponse](<https://developers.cloudflare.com/api/typescript/resources/images#(resource)%20images.v1.variants%20%3E%20(model)%20variant_create_response%20%3E%20(schema)>) {variant }

POST/accounts/{account\_id}/images/v1/variants

Create a CF Images variant that allows you to resize images for different use cases.

##### Security

<details>

<summary>API Token</summary>



The preferred authorization scheme for interacting with the Cloudflare API. <a href="https://developers.cloudflare.com/fundamentals/api/get-started/create-token/">Create a token</a>.

**Example:**<code>Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY</code>

</details>

<details>

<summary>API Email + API Key</summary>



The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

**Example:**<code>X-Auth-Email: user@example.com</code>

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

**Example:**<code>X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194</code>

</details>

##### Accepted Permissions (at least one required)

`Images Write`

##### ParametersExpand Collapse

<details>

<summary>

params: VariantCreateParams {account\_id, id, options, neverRequireSignedURLs }

</summary>

account\_id: string

Path param: Account identifier tag.

maxLength32

<a href="#(resource)%20images.v1.variants%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20account_id">Link to this property</a>

id: string

Body param

maxLength99

<a href="#(resource)%20images.v1.variants%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20id">Link to this property</a>

<details>

<summary>

options: <a href="https://developers.cloudflare.com/api/typescript/resources/images/subresources/v1/subresources/variants/methods/create#(resource)%20images.v1.variants%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20options%20%3E%20(schema)">Options</a>

Body param: Allows you to define image resizing sizes for different use cases.

</summary>

<details>

<summary>

fit: "scale-down"| "contain"| "cover"| 2 more

The fit property describes how the width and height dimensions should be interpreted.

</summary>

One of the following:

"scale-down"

<a href="#(resource)%20images.v1.variants%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20options%20%3E%20(schema)%20%3E%20(property)%20fit%20%3E%20(member)%200">Link to this property</a>

"contain"

<a href="#(resource)%20images.v1.variants%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20options%20%3E%20(schema)%20%3E%20(property)%20fit%20%3E%20(member)%201">Link to this property</a>

"cover"

<a href="#(resource)%20images.v1.variants%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20options%20%3E%20(schema)%20%3E%20(property)%20fit%20%3E%20(member)%202">Link to this property</a>

"crop"

<a href="#(resource)%20images.v1.variants%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20options%20%3E%20(schema)%20%3E%20(property)%20fit%20%3E%20(member)%203">Link to this property</a>

"pad"

<a href="#(resource)%20images.v1.variants%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20options%20%3E%20(schema)%20%3E%20(property)%20fit%20%3E%20(member)%204">Link to this property</a>

</details>

<a href="#(resource)%20images.v1.variants%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20options%20%3E%20(schema)%20%3E%20(property)%20fit">Link to this property</a>

height: number

Maximum height in image pixels.

minimum1

<a href="#(resource)%20images.v1.variants%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20options%20%3E%20(schema)%20%3E%20(property)%20height">Link to this property</a>

<details>

<summary>

metadata: "keep"| "copyright"| "none"

What EXIF data should be preserved in the output image.

</summary>

One of the following:

"keep"

<a href="#(resource)%20images.v1.variants%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20options%20%3E%20(schema)%20%3E%20(property)%20metadata%20%3E%20(member)%200">Link to this property</a>

"copyright"

<a href="#(resource)%20images.v1.variants%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20options%20%3E%20(schema)%20%3E%20(property)%20metadata%20%3E%20(member)%201">Link to this property</a>

"none"

<a href="#(resource)%20images.v1.variants%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20options%20%3E%20(schema)%20%3E%20(property)%20metadata%20%3E%20(member)%202">Link to this property</a>

</details>

<a href="#(resource)%20images.v1.variants%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20options%20%3E%20(schema)%20%3E%20(property)%20metadata">Link to this property</a>

width: number

Maximum width in image pixels.

minimum1

<a href="#(resource)%20images.v1.variants%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20options%20%3E%20(schema)%20%3E%20(property)%20width">Link to this property</a>

</details>

<a href="#(resource)%20images.v1.variants%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20options">Link to this property</a>

neverRequireSignedURLs?: boolean

Body param: Indicates whether the variant can access an image without a signature, regardless of image access control.

<a href="#(resource)%20images.v1.variants%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20neverRequireSignedURLs">Link to this property</a>

</details>

[Link to this property](<#(resource)%20images.v1.variants%20%3E%20(method)%20create%20%3E%20(params)%20default>)

##### ReturnsExpand Collapse

<details>

<summary>

VariantCreateResponse {variant }

</summary>

<details>

<summary>

variant?: Variant {id, options, neverRequireSignedURLs }

</summary>

id: string

maxLength99

<a href="#(resource)%20images.v1.variants%20%3E%20(model)%20variant_create_response%20%3E%20(schema)%20%3E%20(property)%20variant%20%3E%20(property)%20id">Link to this property</a>

<details>

<summary>

options: Options {fit, height, metadata, width }

Allows you to define image resizing sizes for different use cases.

</summary>

<details>

<summary>

fit: "scale-down"| "contain"| "cover"| 2 more

The fit property describes how the width and height dimensions should be interpreted.

</summary>

One of the following:

"scale-down"

<a href="#(resource)%20images.v1.variants%20%3E%20(model)%20variant_create_response%20%3E%20(schema)%20%3E%20(property)%20variant%20%3E%20(property)%20options%20%3E%20(property)%20fit%20%3E%20(member)%200">Link to this property</a>

"contain"

<a href="#(resource)%20images.v1.variants%20%3E%20(model)%20variant_create_response%20%3E%20(schema)%20%3E%20(property)%20variant%20%3E%20(property)%20options%20%3E%20(property)%20fit%20%3E%20(member)%201">Link to this property</a>

"cover"

<a href="#(resource)%20images.v1.variants%20%3E%20(model)%20variant_create_response%20%3E%20(schema)%20%3E%20(property)%20variant%20%3E%20(property)%20options%20%3E%20(property)%20fit%20%3E%20(member)%202">Link to this property</a>

"crop"

<a href="#(resource)%20images.v1.variants%20%3E%20(model)%20variant_create_response%20%3E%20(schema)%20%3E%20(property)%20variant%20%3E%20(property)%20options%20%3E%20(property)%20fit%20%3E%20(member)%203">Link to this property</a>

"pad"

<a href="#(resource)%20images.v1.variants%20%3E%20(model)%20variant_create_response%20%3E%20(schema)%20%3E%20(property)%20variant%20%3E%20(property)%20options%20%3E%20(property)%20fit%20%3E%20(member)%204">Link to this property</a>

</details>

<a href="#(resource)%20images.v1.variants%20%3E%20(model)%20variant_create_response%20%3E%20(schema)%20%3E%20(property)%20variant%20%3E%20(property)%20options%20%3E%20(property)%20fit">Link to this property</a>

height: number

Maximum height in image pixels.

minimum1

<a href="#(resource)%20images.v1.variants%20%3E%20(model)%20variant_create_response%20%3E%20(schema)%20%3E%20(property)%20variant%20%3E%20(property)%20options%20%3E%20(property)%20height">Link to this property</a>

<details>

<summary>

metadata: "keep"| "copyright"| "none"

What EXIF data should be preserved in the output image.

</summary>

One of the following:

"keep"

<a href="#(resource)%20images.v1.variants%20%3E%20(model)%20variant_create_response%20%3E%20(schema)%20%3E%20(property)%20variant%20%3E%20(property)%20options%20%3E%20(property)%20metadata%20%3E%20(member)%200">Link to this property</a>

"copyright"

<a href="#(resource)%20images.v1.variants%20%3E%20(model)%20variant_create_response%20%3E%20(schema)%20%3E%20(property)%20variant%20%3E%20(property)%20options%20%3E%20(property)%20metadata%20%3E%20(member)%201">Link to this property</a>

"none"

<a href="#(resource)%20images.v1.variants%20%3E%20(model)%20variant_create_response%20%3E%20(schema)%20%3E%20(property)%20variant%20%3E%20(property)%20options%20%3E%20(property)%20metadata%20%3E%20(member)%202">Link to this property</a>

</details>

<a href="#(resource)%20images.v1.variants%20%3E%20(model)%20variant_create_response%20%3E%20(schema)%20%3E%20(property)%20variant%20%3E%20(property)%20options%20%3E%20(property)%20metadata">Link to this property</a>

width: number

Maximum width in image pixels.

minimum1

<a href="#(resource)%20images.v1.variants%20%3E%20(model)%20variant_create_response%20%3E%20(schema)%20%3E%20(property)%20variant%20%3E%20(property)%20options%20%3E%20(property)%20width">Link to this property</a>

</details>

<a href="#(resource)%20images.v1.variants%20%3E%20(model)%20variant_create_response%20%3E%20(schema)%20%3E%20(property)%20variant%20%3E%20(property)%20options">Link to this property</a>

neverRequireSignedURLs?: boolean

Indicates whether the variant can access an image without a signature, regardless of image access control.

<a href="#(resource)%20images.v1.variants%20%3E%20(model)%20variant_create_response%20%3E%20(schema)%20%3E%20(property)%20variant%20%3E%20(property)%20neverRequireSignedURLs">Link to this property</a>

</details>

<a href="#(resource)%20images.v1.variants%20%3E%20(model)%20variant_create_response%20%3E%20(schema)%20%3E%20(property)%20variant">Link to this property</a>

</details>

[Link to this property](<#(resource)%20images.v1.variants%20%3E%20(model)%20variant_create_response%20%3E%20(schema)>)

### Create a variant

TypeScript

HTTPTypeScriptPythonGoTerraform

```
import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});

const variant = await client.images.v1.variants.create({
  account_id: '023e105f4ecef8ad9ca31a8372d0c353',
  id: 'hero',
  options: {
    fit: 'scale-down',
    height: 768,
    metadata: 'none',
    width: 1366,
  },
});

console.log(variant.variant);
```

200 example

```
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "variant": {
      "id": "hero",
      "options": {
        "fit": "scale-down",
        "height": 768,
        "metadata": "none",
        "width": 1366
      },
      "neverRequireSignedURLs": true
    }
  },
  "success": true
}
```

##### Returns Examples

200 example

```
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "variant": {
      "id": "hero",
      "options": {
        "fit": "scale-down",
        "height": 768,
        "metadata": "none",
        "width": 1366
      },
      "neverRequireSignedURLs": true
    }
  },
  "success": true
}
```