Skip to main content

v1

Creates, updates, deletes, gets or lists a v1 resource.

Overview

Namev1
TypeResource
Idcloudflare.images.v1

Fields

The following fields are returned by SELECT queries:

Image details response

NameDatatypeDescription
idstringImage unique identifier.
creatorstringCan set the creator field with an internal user ID. (example: 107b9558-dd06-4bbd-5fef-9c2c16bb7900)
filenamestringImage file name. (example: logo.png)
metaobjectUser modifiable key-value store. Can be used for keeping references to another system of record for managing images. Metadata must not exceed 1024 bytes.
requireSignedURLsbooleanIndicates 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.
uploadedstring (date-time)When the media item was uploaded. (example: 2014-01-02T02:20:00.123Z)
variantsarrayObject specifying available variants for an image.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectimage_id, account_idFetch details for a single image.
listselectaccount_idpage, per_page, creatorList up to 100 images with one request. Use the optional parameters below to get a specific range of images.
createinsertaccount_idUpload 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.
editupdateimage_id, account_idUpdate image access control. On access control change, all copies of the image are purged from cache.
deletedeleteimage_id, account_idDelete an image on Cloudflare Images. On success, all copies of the image are deleted and purged from cache.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
account_idstringThe Cloudflare account ID.
image_idstring
creatorstring
pagenumber
per_pagenumber

SELECT examples

Fetch details for a single image.

SELECT
id,
creator,
filename,
meta,
requireSignedURLs,
uploaded,
variants
FROM cloudflare.images.v1
WHERE image_id = '{{ image_id }}' -- required
AND account_id = '{{ account_id }}' -- required
;

INSERT examples

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.

INSERT INTO cloudflare.images.v1 (
creator,
file,
id,
metadata,
requireSignedURLs,
url,
account_id
)
SELECT
'{{ creator }}',
'{{ file }}',
'{{ id }}',
'{{ metadata }}',
{{ requireSignedURLs }},
'{{ url }}',
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;

UPDATE examples

Update image access control. On access control change, all copies of the image are purged from cache.

UPDATE cloudflare.images.v1
SET
creator = '{{ creator }}',
metadata = '{{ metadata }}',
requireSignedURLs = {{ requireSignedURLs }}
WHERE
image_id = '{{ image_id }}' --required
AND account_id = '{{ account_id }}' --required
RETURNING
errors,
messages,
result,
success;

DELETE examples

Delete an image on Cloudflare Images. On success, all copies of the image are deleted and purged from cache.

DELETE FROM cloudflare.images.v1
WHERE image_id = '{{ image_id }}' --required
AND account_id = '{{ account_id }}' --required
;