## Upload an image `client.Images.V1.New(ctx, params) (*Image, error)` **post** `/accounts/{account_id}/images/v1` Upload an image with up to 10 Megabytes using a single HTTP POST (multipart/form-data) request. An image can be uploaded by sending an image file or passing an accessible to an API url. ### Parameters - `params V1NewParams` - `AccountID param.Field[string]` Path param: Account identifier tag. - `ID param.Field[string]` Body param: An optional custom unique identifier for your image. - `Creator param.Field[string]` Body param: Can set the creator field with an internal user ID. - `File param.Field[Reader]` Body param: An image binary data. Only needed when type is uploading a file. - `Metadata param.Field[unknown]` Body param: User modifiable key-value store. Can use used for keeping references to another system of record for managing images. - `RequireSignedURLs param.Field[bool]` Body param: Indicates whether the image requires a signature token for the access. - `URL param.Field[string]` Body param: A URL to fetch an image from origin. Only needed when type is uploading from a URL. ### Returns - `type Image struct{…}` - `ID string` Image unique identifier. - `Creator string` Can set the creator field with an internal user ID. - `Filename string` Image file name. - `Meta unknown` User modifiable key-value store. Can be used for keeping references to another system of record for managing images. Metadata must not exceed 1024 bytes. - `RequireSignedURLs bool` Indicates whether the image can be a accessed only using it's UID. If set to true, a signed token needs to be generated with a signing key to view the image. - `Uploaded Time` When the media item was uploaded. - `Variants []string` Object specifying available variants for an image. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/images" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) image, err := client.Images.V1.New(context.TODO(), images.V1NewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", image.ID) } ``` #### Response ```json { "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": { "id": "id", "creator": "107b9558-dd06-4bbd-5fef-9c2c16bb7900", "filename": "logo.png", "meta": { "key": "value" }, "requireSignedURLs": true, "uploaded": "2014-01-02T02:20:00.123Z", "variants": [ "https://imagedelivery.net/MTt4OTd0b0w5aj/107b9558-dd06-4bbd-5fef-9c2c16bb7900/thumbnail", "https://imagedelivery.net/MTt4OTd0b0w5aj/107b9558-dd06-4bbd-5fef-9c2c16bb7900/hero", "https://imagedelivery.net/MTt4OTd0b0w5aj/107b9558-dd06-4bbd-5fef-9c2c16bb7900/original" ] }, "success": true } ```