Skip to content
API Now! is currently in closed beta. We are constantly updating these guides as we release updates!

ImageURL (Semantic Module)

← Back to Modules Reference

The ImageURL semantic module manages visual media attachments—such as user profile pictures, product photo galleries, cover banners, and catalog thumbnails.

Rather than handling complex multi-part binary file streaming through your application endpoints, decorating a property with ImageURL leverages API Now’s Two-Phase Upload Architecture. Clients upload images directly to secure cloud storage, while the Serverless Engine validates image formats, enforces size limits, optimizes files into modern web formats (such as WebP), and serves images via secure, expiring signed URLs.


AttributeSpecification
ScopeProperty (Applied to a text property)
Data TypeString
Default Max Size5242880 bytes (5 MB)
Default Allowed MIME Typesimage/jpeg, image/png, image/webp, image/gif
Automatic OptimizationEnabled by default (requireOptimization: true)
Delivery MechanismTime-limited Read-Only Signed URLs (15-minute expiration)

1. Image Format Allow List (allowedMimeTypes)

Section titled “1. Image Format Allow List (allowedMimeTypes)”

Restricts uploads strictly to visual formats. By default, only safe, standard web images (JPEG, PNG, WebP, and GIF) are permitted. Non-image files (such as PDFs, scripts, or executables) are blocked during initial upload initialization.

2. Automatic Image Optimization (requireOptimization)

Section titled “2. Automatic Image Optimization (requireOptimization)”

When enabled (default: true), the runtime automatically compresses oversized uploads and re-encodes images into lightweight, modern web formats (like WebP). This significantly reduces page load times and mobile bandwidth usage without requiring third-party image transformation pipelines.

API Now decouples binary file storage from your database records:

  1. Initialize (POST /.well-known/upload): The client requests permission to upload, specifying filename and image MIME type, and receives a temporary signed upload URL plus a unique file_reference token.
  2. Direct Upload (PUT upload_url): The client uploads the binary image directly to cloud storage, bypassing API servers.
  3. Record Association: The client passes the file_reference token as the string value when creating or updating the record.

For a complete architectural walkthrough of this workflow, see the File Uploads Guide.

Images are not exposed through static public bucket links. When reading records (GET /products/prod_101 or GET /products), the engine replaces the internal storage reference with a temporary, read-only Signed URL valid for 15 minutes. Access is protected by the entity’s authorization and RBAC rules—if a user lacks permission to read the record, they cannot view the image.


When configuring the ImageURL semantic in the Domain Modeler, you can adjust:

OptionTypeDefaultDescription
maxSizeInBytesnumber5242880 (5 MB)Maximum permitted file size in bytes.
allowedMimeTypesstring[]['image/jpeg', 'image/png', 'image/webp', 'image/gif']Allow list of permitted image MIME types.
requireOptimizationbooleantrueHints the engine to optimize and convert uploaded images to WebP.

The client initiates an upload:

POST /api/v1/.well-known/upload
Content-Type: application/json
{
"filename": "headshot.png",
"contentType": "image/png"
}

Server Response (200 OK):

{
"data": {
"file_reference": "ref_img_89a1c24e",
"upload_url": "https://storage.googleapis.com/app-bucket/tmp/ref_img_89a1c24e.png?GoogleAccessId=..."
}
}

After uploading the binary content to the upload_url, the client creates the user profile:

POST /profiles
Content-Type: application/json
{
"name": "Sarah Connor",
"avatar": "ref_img_89a1c24e"
}

Server Response (201 Created):

{
"data": {
"id": "prof_301",
"name": "Sarah Connor",
"avatar": "https://storage.googleapis.com/app-bucket/uploads/profiles/prof_301/avatar.webp?X-Goog-Signature=..."
}
}

When querying the record, the platform dynamically generates a fresh signed URL:

GET /profiles/prof_301

Server Response (200 OK):

{
"data": {
"id": "prof_301",
"name": "Sarah Connor",
"avatar": "https://storage.googleapis.com/app-bucket/uploads/profiles/prof_301/avatar.webp?X-Goog-Signature=..."
}
}

  • ImageURL: Visual graphics, avatars, product photos, and banners (enforces image MIME types and WebP optimization).
  • FileURL: Document attachments, invoice PDFs, spreadsheets, and ZIP archives.
  • URL: Standard external hyperlinks pointing to third-party web addresses.

  • Applicable Property Types: Apply to a String property in the Domain Modeler.
  • Length Constraints: String properties default to a Maximum Length of 255 characters, which is plenty of space for internal storage tokens and file references.