Skip to main content

Asset API

The Asset API stores and manages files in two ways:

  • Assets are files for creatives, such as images, PDF files, and HTML5 creative assets (ZIP files), served from a CDN URL. The Asset API handles media uploads and temporary storage, and works with other services, such as the Creative API, for final storage and metadata management.
  • Secure files are kept in private storage and shared through presigned URLs that expire. They have no CDN URL. Each secure file belongs to the Organization Workspace that uploaded it, and only users in that Workspace can access it.

To upload a secure file:

  1. Initiate secure file upload to get a fileId and a presigned uploadUrl.
  2. Send the file to uploadUrl in a PUT request before the URL expires. Set the Content-Type header to the file type's content type and send exactly the number of bytes given in size. Don't send IQM authentication headers to this URL.
  3. Complete secure file upload to confirm the file is uploaded.

After that, you can get a download URL for the file.

This page covers the common endpoints and methods associated with the Asset API.

More resources​

Authentication​

Use the following header parameters for all requests:

Headers
Authorization
string required
Bearer followed by the access_token from the login response.
See Sign up and authenticate.
X-IAA-OW-ID
integer required
Organization Workspace ID header.

Assets details​

Get a list of all assets​

GET

Get a list of all assets in the system. Includes both regular assets and HTML5 creative assets.

An asset id can be used to Get asset details or to perform various actions in Assets management endpoints.

Response properties
id
integer
Asset ID.
storagePath
string
File path of asset.
cdnUrl
string
URL of asset.
created
integer
Unix epoch timestamp of asset creation, in milliseconds.
modifiedDate
string
Date asset modified.
isDisposable
boolean
Indicates whether asset is temporary and can be purged.
isZipFile
boolean
Indicates whether the asset is a ZIP file.
isHtml5Creative
boolean
Indicates whether the asset is an HTML5 creative.
assetDimensions
object
Dimensions of the creative (HTML5 assets only). Contains width and height.
iframeHtml
string
Ready-to-use iframe HTML code (HTML5 assets only).
Response 200
{
"success": true,
"data": [
{
"id": 1,
"storagePath": "assets/201427/tfteBYO_1704204958735.jpg",
"cdnUrl": "https://d3jme5si7t6llb.cloudfront.net/assets/201427/tfteBYO_1704204958735.jpg",
"created": 1704204961147,
"modifiedDate": "2024-01-02T14:16:08.726+0000",
"isDisposable": false,
"isZipFile": false,
"isHtml5Creative": false,
"assetDimensions": null,
"iframeHtml": null
},
{
"id": 2,
"storagePath": "assets/201427/randomPath/index.html",
"cdnUrl": "https://d3jme5si7t6llb.cloudfront.net/assets/201427/randomPath/index.html",
"created": 1704204971010,
"modifiedDate": "2024-01-02T14:16:11.375+0000",
"isDisposable": true,
"isZipFile": true,
"isHtml5Creative": true,
"assetDimensions": {
"width": 300,
"height": 250
},
"iframeHtml": "<iframe src=\"https://d3jme5si7t6llb.cloudfront.net/assets/201427/randomPath/index.html\" width=\"300\" height=\"250\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\"></iframe>"
},
{
"id": 3,
"storagePath": "assets/201427/2mBGamD_1704205759807.jpg",
"cdnUrl": "https://d3jme5si7t6llb.cloudfront.net/assets/201427/2mBGamD_1704205759807.jpg",
"created": 1704205761106,
"modifiedDate": "2024-01-02T08:59:21.508+0000",
"isDisposable": false,
"isZipFile": false,
"isHtml5Creative": false,
"assetDimensions": null,
"iframeHtml": null
}
]
}

Get asset details​

GET

Get properties of a single asset by ID. For HTML5 creative assets, the response includes additional fields for dimensions and iframe HTML code.

Path parameters
assetId
integer
Asset ID.
Response properties
id
integer
Asset ID.
storagePath
string
File path of asset.
cdnUrl
string
URL of asset.
created
integer
Unix epoch timestamp of asset creation, in milliseconds.
modifiedDate
string
Date asset modified.
isDisposable
boolean
Indicates whether asset is temporary and can be purged.
isZipFile
boolean
Indicates whether the asset is a ZIP file.
isHtml5Creative
boolean
Indicates whether the asset is an HTML5 creative.
assetDimensions
object
Dimensions of the creative (HTML5 assets only). Contains width and height.
iframeHtml
string
Ready-to-use iframe HTML code (HTML5 assets only).
Response 200
{
"success": true,
"data": {
"id": 1,
"storagePath": "assets/201427/tfteBYO_1704204958735.jpg",
"cdnUrl": "https://cdn.example.com/assets/201427/tfteBYO_1704204958735.jpg",
"created": 1704204961147,
"modifiedDate": "2024-01-18T06:03:23.823+0000",
"isDisposable": true,
"isZipFile": false,
"isHtml5Creative": false,
"assetDimensions": null,
"iframeHtml": null
}
}
Response 200
{
"success": true,
"data": {
"id": 2,
"storagePath": "assets/201427/randomPath/index.html",
"cdnUrl": "https://cdn.example.com/assets/201427/randomPath/index.html",
"created": 1704204971010,
"modifiedDate": "2024-01-18T06:03:23.823+0000",
"isDisposable": false,
"isZipFile": true,
"isHtml5Creative": true,
"assetDimensions": {
"width": 300,
"height": 250
},
"iframeHtml": "<iframe src=\"https://cdn.example.com/assets/201427/randomPath/index.html\" width=\"300\" height=\"250\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\"></iframe>"
}
}
Response 422
{
"success": false,
"errorObjects": [
{
"error": "No Asset found with the Asset ID provided. Please provide a valid ID."
}
]
}

Assets management​

Add multiple assets​

POST

Add multiple assets to the system. Request accepts an array of multipart file objects and their corresponding metadata. Supports both regular assets (images, PDFs) and HTML5 creative assets (ZIP files).

Parameters
filesMetadata
form data required
Object array in JSON string.
filesMetadata object properties
attachedFileName
string
Name of asset.
originalFileName
string
Name of uploaded multipart file.
disposable
boolean
Indicates whether asset is temporary and can be purged, default: false.
zipFile
boolean
Set to true when uploading a ZIP file for HTML5 creatives, default: false.
html5Creative
boolean
Set to true when uploading an HTML5 creative asset, default: false.
files
multipart/form-data required
Array of asset files to upload.
Response properties
assetID
integer
Unique identifier of the uploaded asset.
assetCDNURL
string
CDN URL of the uploaded asset.
dimensions
object
Dimensions of the creative (HTML5 assets only). Contains width and height.
iframeHtml
string
Ready-to-use iframe HTML code (HTML5 assets only).
Formdata sample
------WebKitFormBoundaryAofpaWXja6BTaYQ9
Content-Disposition: form-data; name="files"; filename="example.jpg"
Content-Type: image/jpeg

------WebKitFormBoundaryAofpaWXja6BTaYQ9
Content-Disposition: form-data; name="filesMetadata"

[{"attachedFileName":"example.jpg","originalFileName":"example.jpg","disposable":false}]
------WebKitFormBoundaryAofpaWXja6BTaYQ9--

Response 200
{
"success": true,
"data": {
"example.jpg": {
"assetID": 697,
"assetCDNURL": "https://d3jme5si7t6llb.cloudfront.net/assets/201427/IHp2jMI_1704987233847.jpg"
}
}
}
Formdata sample
------WebKitFormBoundaryAofpaWXja6BTaYQ9
Content-Disposition: form-data; name="files"; filename="300x250_creative.zip"
Content-Type: application/zip

------WebKitFormBoundaryAofpaWXja6BTaYQ9
Content-Disposition: form-data; name="filesMetadata"

[{"attachedFileName":"300x250_creative.zip","originalFileName":"300x250.zip","disposable":false,"zipFile":true,"html5Creative":true}]
------WebKitFormBoundaryAofpaWXja6BTaYQ9--

Response 200
{
"success": true,
"data": {
"300x250_creative.zip": {
"assetID": 19234,
"assetCDNURL": "https://d3jme5si7t6llb.cloudfront.net/assets/204876/OQ6NQ8B_1772197041498/index.html?cb=1",
"dimensions": {
"width": 300,
"height": 250
},
"iframeHtml": "<iframe src=\"https://d3jme5si7t6llb.cloudfront.net/assets/204876/OQ6NQ8B_1772197041498/index.html?cb=1\" width=\"300\" height=\"250\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\"></iframe>"
}
}
}
Response 422
{
"success": false,
"errorObjects": [
{
"error": "Please pass File(s) metaData"
}
]
}

Update asset details​

PATCH

Update the details of an existing asset by ID.

Path parameters
assetId
integer
Asset ID.
Request schema
storagePath
string
File path of asset.
cdnUrl
string
Asset CDN URL.
disposable
boolean
Indicates whether asset is temporary and can be purged (true), default: true.
Request sample
{
"storagePath": "string",
"cdnUrl": "string",
"disposable": true
}
Response 200
{
"success": true,
"data": {
"statusCode": 200,
"responseObject": {
"message": "Asset updated successfully"
}
}
}

Delete asset​

DELETE

Delete a single asset by ID.

Path parameters
assetId
integer
Asset ID.
Response 200
{
"success": true,
"data": "Asset deleted successfully."
}

Secure files​

Initiate secure file upload​

POST

Start a secure file upload. Returns a file ID and a presigned URL to upload the file to, which expires after expiresInSeconds (currently 600 seconds).

Request schema
fileName
string required
File name, including the extension. The extension must match fileType. Spaces are replaced with underscores, and characters other than letters, numbers, ., _, and - are removed.
fileType
string required
File type. See the table below for allowed values.
size
integer required
File size in bytes, up to 524288000 (500 MB). The uploaded file must be exactly this size.
folderName
string
Folder to group the file under in storage. Letters, numbers, _, and - only, up to 100 characters.
fileTypeExtensionsContent-Type for the upload
CSV.csvtext/csv
EXCEL.xlsx, .xlsapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet (.xlsx) or application/vnd.ms-excel (.xls)
ZIP.zipapplication/zip
KMZ.kmzapplication/vnd.google-earth.kmz
KML.kmlapplication/vnd.google-earth.kml+xml
PDF.pdfapplication/pdf
DOC.docapplication/msword
DOCX.docxapplication/vnd.openxmlformats-officedocument.wordprocessingml.document
TXT.txttext/plain
MD.mdtext/markdown
PNG.pngimage/png
JPG.jpgimage/jpg
JPEG.jpegimage/jpeg
GIF.gifimage/gif
MOV.movvideo/quicktime
MP4.mp4video/mp4
MP3.mp3audio/mpeg
WAV.wavaudio/wav
OGG.oggaudio/ogg
Response properties
fileId
string
File ID (UUID). Use it in the other secure file endpoints.
uploadUrl
string
Presigned URL to PUT the file to.
expiresInSeconds
integer
Seconds until uploadUrl expires.
Request sample
{
"fileName": "campaign_assets.zip",
"fileType": "ZIP",
"size": 204800,
"folderName": "customer-imports"
}
Response 200
{
"success": true,
"data": {
"fileId": "a3f1c2d4-8b7e-4f5a-9c6d-1e2b3a4c5d6e",
"uploadUrl": "https://s3.amazonaws.com/secure-bucket/123/a3f1c2d4.../campaign_assets.zip?X-Amz-Signature=...",
"expiresInSeconds": 600
}
}
Upload sample
curl -X PUT "<uploadUrl>" \
-H "Content-Type: application/zip" \
--data-binary @campaign_assets.zip
More responses
Response 400
{
"success": false,
"errorObjects": [
{
"error": "fileType ZIP requires a .zip file extension"
}
]
}
Response 409
{
"success": false,
"errorObjects": [
{
"error": "Unable to generate unique file id. Please retry."
}
]
}

Complete secure file upload​

POST

Confirm that a file was uploaded to its presigned URL. IQM checks that the file is in storage and matches the size given when the upload was initiated, then sets its status to UPLOADED. Call this once per file.

Path parameters
fileId
string required
File ID.
Response properties
status
string
File status: UPLOADED.
Response 200
{
"success": true,
"data": {
"status": "UPLOADED"
}
}
More responses
Response 400
{
"success": false,
"errorObjects": [
{
"error": "Uploaded object not found"
}
]
}
Response 401
{
"success": false,
"errorObjects": [
{
"error": "You are not authorized to access this file"
}
]
}
Response 404
{
"success": false,
"errorObjects": [
{
"error": "File not found"
}
]
}
Response 409
{
"success": false,
"errorObjects": [
{
"error": "Uploaded file size mismatch"
}
]
}

Get secure file details​

GET

Get the details of a secure file by ID. Deleted files return a 404 response.

Path parameters
fileId
string required
File ID.
Response properties
fileId
string
File ID.
fileName
string
Stored file name, after spaces and unsupported characters are replaced or removed.
originalFileName
string
File name as given when the upload was initiated. Downloads use this name.
fileType
string
File type.
size
integer
File size in bytes.
status
string
File status: INITIATED (waiting for the upload to be completed) or UPLOADED.
Response 200
{
"success": true,
"data": {
"fileId": "a3f1c2d4-8b7e-4f5a-9c6d-1e2b3a4c5d6e",
"fileName": "campaign_assets.zip",
"originalFileName": "campaign_assets.zip",
"fileType": "ZIP",
"size": 204800,
"status": "UPLOADED"
}
}
More responses
Response 401
{
"success": false,
"errorObjects": [
{
"error": "You are not authorized to access this file"
}
]
}
Response 404
{
"success": false,
"errorObjects": [
{
"error": "File not found"
}
]
}

Get secure file download URL​

GET

Get a presigned URL to download a secure file. The file must have the UPLOADED status. The URL needs no authentication headers, downloads the file under its originalFileName, and expires after expiresInSeconds (currently 120 seconds).

Path parameters
fileId
string required
File ID.
Response properties
downloadUrl
string
Presigned URL to download the file.
expiresInSeconds
integer
Seconds until downloadUrl expires.
Response 200
{
"success": true,
"data": {
"downloadUrl": "https://s3.amazonaws.com/secure-bucket/123/a3f1c2d4.../campaign_assets.zip?X-Amz-Signature=...",
"expiresInSeconds": 120
}
}
More responses
Response 401
{
"success": false,
"errorObjects": [
{
"error": "You are not authorized to access this file"
}
]
}
Response 404
{
"success": false,
"errorObjects": [
{
"error": "File not found"
}
]
}
Response 409
{
"success": false,
"errorObjects": [
{
"error": "File is not ready for download"
}
]
}

Delete secure file​

DELETE

Delete a secure file by ID and remove it from storage. Works whether or not the upload was completed. Deleting a file that's already deleted also returns a 200 response.

Path parameters
fileId
string required
File ID.
Response 200
{
"success": true,
"data": null
}
More responses
Response 401
{
"success": false,
"errorObjects": [
{
"error": "You are not authorized to access this file"
}
]
}
Response 404
{
"success": false,
"errorObjects": [
{
"error": "File not found"
}
]
}
Response 409
{
"success": false,
"errorObjects": [
{
"error": "File status changed during deletion"
}
]
}
Have a question?
Was this page helpful?