# V2 ## List images V2 `images.v2.list(V2ListParams**kwargs) -> V2ListResponse` **get** `/accounts/{account_id}/images/v2` List up to 10000 images with up to 1000 results per page. Use the optional parameters below to get a specific range of images. Pagination is supported via continuation_token. **Metadata Filtering (Optional):** You can optionally filter images by custom metadata fields using the `meta.[]=` syntax. **Supported Operators:** - `eq` / `eq:string` / `eq:number` / `eq:boolean` - Exact match - `in` / `in:string` / `in:number` - Match any value in list (pipe-separated) **Metadata Filter Constraints:** - Maximum 5 metadata filters per request - Maximum 5 levels of nesting (e.g., `meta.first.second.third.fourth.fifth`) - Maximum 10 elements for list operators (`in`) - Supports string, number, and boolean value types **Examples:** ``` # List all images /images/v2 # Filter by metadata [eq] /images/v2?meta.status[eq:string]=active # Filter by metadata [in] /images/v2?meta.status[in]=pending|deleted|flagged # Filter by metadata [in:number] /images/v2?meta.ratings[in:number]=4|5 # Filter by nested metadata /images/v2?meta.region.name[eq]=eu-west # Combine metadata filters with creator /images/v2?meta.status[eq]=active&creator=user123 # Multiple metadata filters (AND logic) /images/v2?meta.status[eq]=active&meta.priority[eq:number]=5 ``` ### Parameters - `account_id: str` Account identifier tag. - `continuation_token: Optional[str]` Continuation token to fetch next page. Passed as a query param when requesting List V2 api endpoint. - `creator: Optional[str]` Internal user ID set within the creator field. Setting to empty string "" will return images where creator field is not set - `meta: Optional[Meta]` - `field_operator: Optional[str]` Optional metadata filter(s). Multiple filters can be combined with AND logic. **Operators:** - `eq`, `eq:string`, `eq:number`, `eq:boolean` - Exact match - `in`, `in:string`, `in:number` - Match any value in pipe-separated list **Examples:** - `meta.status[eq]=active` - `meta.priority[eq:number]=5` - `meta.enabled[eq:boolean]=true` - `meta.region[in]=us-east|us-west|eu-west` - `per_page: Optional[float]` Number of items per page - `sort_order: Optional[Literal["asc", "desc"]]` Sorting order by upload time - `"asc"` - `"desc"` ### Returns - `class V2ListResponse: …` - `continuation_token: Optional[str]` Continuation token to fetch next page. Passed as a query param when requesting List V2 api endpoint. - `images: Optional[List[Image]]` - `id: Optional[str]` Image unique identifier. - `creator: Optional[str]` Can set the creator field with an internal user ID. - `filename: Optional[str]` Image file name. - `meta: Optional[object]` 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. - `require_signed_urls: Optional[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: Optional[datetime]` When the media item was uploaded. - `variants: Optional[List[str]]` Object specifying available variants for an image. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) v2s = client.images.v2.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(v2s.continuation_token) ``` #### 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": { "continuation_token": "continuation_token", "images": [ { "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 } ``` ## Domain Types ### V2 List Response - `class V2ListResponse: …` - `continuation_token: Optional[str]` Continuation token to fetch next page. Passed as a query param when requesting List V2 api endpoint. - `images: Optional[List[Image]]` - `id: Optional[str]` Image unique identifier. - `creator: Optional[str]` Can set the creator field with an internal user ID. - `filename: Optional[str]` Image file name. - `meta: Optional[object]` 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. - `require_signed_urls: Optional[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: Optional[datetime]` When the media item was uploaded. - `variants: Optional[List[str]]` Object specifying available variants for an image. # Direct Uploads ## Create authenticated direct upload URL V2 `images.v2.direct_uploads.create(DirectUploadCreateParams**kwargs) -> DirectUploadCreateResponse` **post** `/accounts/{account_id}/images/v2/direct_upload` Direct uploads allow users to upload images without API keys. A common use case are web apps, client-side applications, or mobile devices where users upload content directly to Cloudflare Images. This method creates a draft record for a future image. It returns an upload URL and an image identifier. To verify if the image itself has been uploaded, send an image details request (accounts/:account_identifier/images/v1/:identifier), and check that the `draft: true` property is not present. ### Parameters - `account_id: str` Account identifier tag. - `id: Optional[str]` Optional Image Custom ID. Up to 1024 chars. Can include any number of subpaths, and utf8 characters. Cannot start nor end with a / (forward slash). Cannot be a UUID. - `creator: Optional[str]` Can set the creator field with an internal user ID. - `expiry: Optional[Union[str, datetime]]` The date after which the upload will not be accepted. Minimum: Now + 2 minutes. Maximum: Now + 6 hours. - `metadata: Optional[object]` User modifiable key-value store. Can be used for keeping references to another system of record, for managing images. - `require_signed_urls: Optional[bool]` Indicates whether the image requires a signature token to be accessed. ### Returns - `class DirectUploadCreateResponse: …` - `id: Optional[str]` Image unique identifier. - `upload_url: Optional[str]` The URL the unauthenticated upload can be performed to using a single HTTP POST (multipart/form-data) request. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) direct_upload = client.images.v2.direct_uploads.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(direct_upload.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", "uploadURL": "https://upload.imagedelivery.net/FxUufywByo0m2v3xhKSiU8/e22e9e6b-c02b-42fd-c405-6c32af5fe600" }, "success": true } ``` ## Domain Types ### Direct Upload Create Response - `class DirectUploadCreateResponse: …` - `id: Optional[str]` Image unique identifier. - `upload_url: Optional[str]` The URL the unauthenticated upload can be performed to using a single HTTP POST (multipart/form-data) request.